Changeset 277
- Timestamp:
- 09/04/07 14:30:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Utilities/report.pro
r269 r277 6 6 ; To ask a question whose answer is not yes/no, use <pro>xquestion</pro>. 7 7 ; 8 ; @param TEXT {in}{required} {type=scalar string or arrays of string}9 ; If TEXT is a scalar string, we look for the line feed character "!C".10 ; If TEXT is set to an array of strings, each8 ; @param TEXTIN {in}{required} {type=scalar string or arrays of string} 9 ; If TEXTIN is a scalar string, we look for the line feed character "!C". 10 ; If TEXTIN is set to an array of strings, each 11 11 ; array element is displayed as a separate line of text. 12 12 ; … … 61 61 ;- 62 62 ; 63 FUNCTION report, text , DEFAULT_NO = default_no, PARENT = parent, QUESTION = question, SIMPLE = simple, _EXTRA = ex63 FUNCTION report, textin, DEFAULT_NO = default_no, PARENT = parent, QUESTION = question, SIMPLE = simple, _EXTRA = ex 64 64 ; 65 65 compile_opt idl2, strictarrsubs … … 67 67 res = -1 ; 68 68 ; we separate the text in different lines (separated by !C) if it is not already done... 69 if n_elements(text) EQ 1 then text = str_sep(text, '!C', /trim) 69 if n_elements(textin) EQ 1 then text = '% ' + str_sep(textin, '!C', /trim) ELSE text = '% ' + textin 70 ; we get the line, routine name ad revision version 71 IF NOT keyword_set(simple) THEN BEGIN 72 ; Look for the revsion in the code of the procedure/function calling this 73 ; report function (ie the one where an problem was detected) in the first 74 ; occurence of the form : 75 ; "; $Id$" 76 prefix = routine_name(1) 77 split = STRSPLIT(prefix, ' ', /EXTRACT) 78 coderoutine = getfile(split[1]) 79 idline = (where(stregex(coderoutine, '^; \$Id: .* .* .* .* \$', /boolean) EQ 1))[0] 80 IF (idline GT 0) THEN BEGIN 81 split = STRSPLIT(coderoutine[idline], ' ', /EXTRACT) 82 prefix = '% '+prefix+ ' rev. ' + split[3] + ': ' 83 ENDIF ELSE BEGIN 84 prefix = '% '+prefix+': ' 85 ENDELSE 86 text = [prefix, text] 87 ENDIF 70 88 ; there is some widgets activated, it is easy, we call dialog_massage 71 89 if (widget_info(/managed))[0] NE 0 then BEGIN … … 76 94 ; there is not any widget activated 77 95 ; do we ask a question ? 78 if keyword_set(question) thenBEGIN96 IF keyword_set(question) THEN BEGIN 79 97 ; what is the answer by default ? 80 98 if keyword_set(default_no) then answer = 'n' ELSE answer = 'y' 81 99 default_answer = answer 82 100 if n_elements(text) GT 1 THEN $ 83 for i = 0, n_elements(text)-2 do print, text[i]101 for i = 0, n_elements(text)-2 do print, text[i] 84 102 read, text[n_elements(text)-1]+' y/n (default answer is '+default_answer+')', answer 85 103 answer = strlowcase(answer) ; … … 99 117 ; If we do not ask any question, we just make a print 100 118 IF NOT keyword_set(question) THEN BEGIN 101 IF keyword_set(simple) THEN prefix = '' ELSE BEGIN 102 ; Look for the revsion in the code of the procedure/function calling this 103 ; report function (ie the one where an problem was detected) in the first 104 ; occurence of the form : 105 ; "; $Id$" 106 split=STRSPLIT(routine_name(1), ' ', /EXTRACT) 107 fileroutine=split[1] 108 coderoutine = getfile(fileroutine) 109 idline = where(stregex(coderoutine,'^; \$Id: .* .* .* .* \$', /boolean) EQ 1, cnt1) 110 IF (idline GT 0) THEN BEGIN 111 split=STRSPLIT(coderoutine[idline],' ', /EXTRACT) 112 revision=split[3] 113 prefix = '% '+routine_name(1)+ ' ' + revision + ': ' 114 ENDIF ELSE BEGIN 115 prefix = '% '+routine_name(1)+': ' 116 ENDELSE 117 ENDELSE 118 IF n_elements(text) GT 1 THEN $ 119 for i = 0, n_elements(text)-2 do print, prefix+text[i] 120 print, prefix+text[n_elements(text)-1] 121 ENDIF 119 FOR i = 0, n_elements(text)-1 do print, text[i] 120 ENDIF 122 121 123 122 return, res 124 123 end
Note: See TracChangeset
for help on using the changeset viewer.