File: test_scope_varfetch.pro

package info (click to toggle)
gnudatalanguage 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,228 kB
  • ctags: 11,455
  • sloc: cpp: 143,352; makefile: 426; sh: 103; ansic: 44; awk: 18; python: 6
file content (95 lines) | stat: -rw-r--r-- 2,111 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
; by Sylwester Arabas <slayoo@igf.fuw.edu.pl>
; part of GDL - GNU Data Language
;
; this is also important feature since used in recent versions
; of READCOL in the widely used AtroLib
; see also bug report 3573558
;
; this is not a clean version of this test ...
;
function TEST_SCOPE_CARFETCH_SUB
  return, SCOPE_VARFETCH('a', level=-1)
end
;
; this code is used in recent versions of READCOL in AstroLib
;
pro ASTRON_READCOL1, a,b,c
MESSAGE,/continue, 'inside'
list_of_name=['a','b','c']
(SCOPE_VARFETCH(list_of_name[0], LEVEL=0)) = FINDGEN(10)
end

pro ASTRON_READCOL1BIS, a,b,c
MESSAGE,/continue, 'inside'
list_of_name=['a','b','c']
for ii=0, 2 do begin
   (SCOPE_VARFETCH(list_of_name[ii], LEVEL=0)) = FINDGEN(10)
endfor
end

pro ASTRON_READCOL2, a,b,c
MESSAGE,/continue, 'inside'
list_of_name=['a','b','c']
(SCOPE_VARFETCH('a', LEVEL=0)) = FINDGEN(10)
end
;
; ---------------------------------
;
pro TEST_SCOPE_VARFETCH_NO_KEYWORD
;
a = 1234
print, a
if a ne test_scope_carfetch_sub() then exit, status=1
;
debug=1
if KEYWORD_SET(debug) then mydata1=0
ASTRON_READCOL1, mydata1,b1,c1
print, mydata1
;
if KEYWORD_SET(debug) then mydata1bis=0
ASTRON_READCOL1BIS, mydata1bis,b1bis,c1bis
print, mydata1bis

if KEYWORD_SET(debug) then mydata2=0
ASTRON_READCOL2, mydata2,b2,c2
print, mydata2
;
if KEYWORD_SET(test) then STOP
;
end
;
; ---------------------------------
;
pro TEST_SCOPE_VARFETCH_WITH_KEY, help=help, debug=deug, test=test
;
if KEYWORD_SET(help) then begin
   print, 'pro TEST_SCOPE_VARFETCH_WITH_KEY, help=help, debug=deug, test=test'
   return
endif
;
a = 1234
print, a
if a ne TEST_SCOPE_CARFETCH_SUB() then exit, status=1
;
if KEYWORD_SET(debug) then mydata1=0
ASTRON_READCOL1, mydata1,b1,c1
print, mydata1
;
if KEYWORD_SET(debug) then mydata1bis=0
ASTRON_READCOL1BIS, mydata1bis,b1bis,c1bis
print, mydata1bis

if KEYWORD_SET(debug) then mydata2=0
ASTRON_READCOL2, mydata2,b2,c2
print, mydata2
;
if KEYWORD_SET(test) then STOP
;
end

pro TEST_SCOPE_VARFETCH, help=help, debug=deug, test=test

TEST_SCOPE_VARFETCH_WITH_KEY, help=help, debug=deug, test=test
TEST_SCOPE_VARFETCH_NO_KEYWORD

end