File: errors_add.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (49 lines) | stat: -rw-r--r-- 1,211 bytes parent folder | download | duplicates (5)
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
;
; Alain C., 4 Oct. 2015
;
; Since this procedure is now used in many tests
; and since we do have the level=-1 in MESSAGE,
; it is time to put this code in public place !
;
; Feb. 2018 : Change in naming convention : 
; ERRORS_CUMUL, ERRORS_ADD, ERRORS_RESET
;
; -----------------------------------------------
;
; Purpose : this procedure prints a "message" and
; adds "1" into "nb_errors"
;
; It would surprising if "message" is undefined
; It is *not* surprising if "nb_errors" is undefined
; 
; -----------------------------------------------
;
pro ERRORS_ADD, nb_errors, message, help=help
;
if KEYWORD_SET(help) then begin
   print, 'pro ERRORS_ADD, nb_errors, message, help=help'
   return
endif
;
; at least one param !
;
if N_PARAMS() LT 1 then begin
   print, 'Usage : pro ERRORS_ADD, nb_errors, message'
   return
endif
;
if (SIZE(message,/type) EQ 0) then begin
   MESSAGE, /continue, 'We advice to defined a message !'
   txt='Missing Message !'
endif
txt=STRING(message) 
;
MESSAGE, level=-1, 'Error on operation : '+txt, /continue
;
; we will have to change this code for old IDL versions
; (no ISA before 8)
;
if (SIZE(nb_errors,/type) GT 0) then nb_errors=nb_errors+1 else nb_errors=1
;
end