File: errors_cumul.pro

package info (click to toggle)
gnudatalanguage 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,832 kB
  • sloc: cpp: 198,435; ansic: 47,740; sh: 691; python: 474; makefile: 149; xml: 69; f90: 28
file content (74 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;
; Alain C., 28 Feb. 2017
;
; Feb. 2018 : Change in naming convention : 
; ERRORS_CUMUL, ERRORS_ADD, ERRORS_RESET
;
; -----------------------------------------------
;
; Purpose : managing Errors Accumulation
; This procedure adds running "new_errors" into "cumul_errors"
;
; It would surprising if "new_errors" is undefined
; It is *not* surprising that "cumul_errors" may be undefined
; 
; -----------------------------------------------
; In order to test fake errors accumulations in the tests, 
; you can use : ERRORS_CUMUL, /debug 
;
; BUT we will have to change it for a better ON/Off triggering
;
; -----------------------------------------------
;
pro ERRORS_CUMUL, cumul_errors, new_errors, help=help, $
                  debug=debug, verbose=verbose, test=test
;
; this case /debug should be call BEFORE or OUTSIDE
;
if KEYWORD_SET(debug) then begin
    DEFSYSV, '!cumul', 1
    MESSAGE, /continue, 'Fake error has be added now'
    return
endif
;
if KEYWORD_SET(help) OR (N_PARAMS() NE 2) then begin
    print, 'Usage : pro ERRORS_CUMUL, cumul_errors, new_errors, help=help, $'
    print, '                          debug=debug, verbose=verbose, test=test'
    return
endif
;
if KEYWORD_SET(verbose) then begin
    print, 'Value of >>cumul_errors<< : ', cumul_errors
    print, 'Value of >>new_errors<<   : ', new_errors
endif
;
if (SIZE(cumul_errors, /type) GT 0) then begin
    if (SIZE(new_errors, /type) GT 0) then begin
        cumul_errors=cumul_errors+new_errors
    endif
    ;; nothing to add if "new_errors" not defined
endif else begin
    if (SIZE(new_errors, /type) GT 0) then begin
        cumul_errors=new_errors
    endif
endelse
;
if KEYWORD_SET(verbose) then begin
    print, 'NEW Value of >>cumul_errors<< : ', cumul_errors
endif
;
; debug mode
DEFSYSV, '!cumul', exist=exist
if (exist) then begin
   if (!cumul GT 0) then begin
      if (SIZE(cumul_errors,/type) GT 0) then cumul_errors++ else cumul_errors=1
   endif
endif
;
if KEYWORD_SET(verbose) then begin
    print, 'NEW Value of >>cumul_errors<< : ', cumul_errors
endif
;
if KEYWORD_SET(test) then STOP
;
end