14
15
16
17
18
19
20
21
22
26 use dc_string, only: tochar, printf, putline
27 use gtdata_generic, only: get, inquire
28 use dc_trace, only: beginsub, endsub, dbgmessage
29 implicit none
30 type(GT_VARIABLE), intent(in):: var
31 integer, intent(in), optional:: unit
32
33
34
35
36
37 character(*), intent(in), optional:: indent
38
39
40
41 logical, intent(out), optional:: err
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 real, allocatable:: rvalue(:)
60 integer:: siz, stat
61
62 logical:: myerr
63 integer:: out_unit
64 integer:: indent_len
65 character(STRING):: indent_str
66 character(*), parameter:: subname = 'GTVarPutLine'
67continue
68 call beginsub(subname, '%d', i=(/var % mapid/))
70
71
72
73
74 if ( present(unit) ) then
75 out_unit = unit
76 else
78 end if
79
80 indent_len = 0
81 indent_str = ''
82 if ( present(indent) ) then
83 if ( len(indent) /= 0 ) then
84 indent_len = len(indent)
85 indent_str(1:indent_len) = indent
86 end if
87 end if
88
89
90
91
92
93 if ( var % mapid < 0 ) then
94 call printf( out_unit, &
95 & indent_str(1:indent_len) // &
96 & '#<GT_VARIABLE:: @initialized=%y>', &
97 & l = (/.false./) )
98 goto 999
99 end if
100
101
102
103
104
105 call inquire(var, size=siz)
106 call dbgmessage('size = %d', i=(/siz/))
108 allocate(rvalue(siz), stat=stat)
111 goto 999
112 endif
113 call get(var, rvalue, size(rvalue), err=myerr)
114 if (myerr) then
117 call printf( out_unit, &
118 & indent_str(1:indent_len) // &
119 & '#<GT_VARIABLE:: @initialized=%y>', &
120 & l = (/.false./) )
122 end if
123 goto 999
124 endif
125 call printf( out_unit, &
126 & indent_str(1:indent_len) // &
127 & '#<GT_VARIABLE:: @initialized=%y', &
128 & l = (/.true./) )
129
130 call putline( rvalue, unit = out_unit, &
131 & lbounds = lbound(rvalue), &
132 & ubounds = ubound(rvalue), &
133 & indent = indent_str(1:indent_len) // &
134 & ' @value=' )
135
136
137
138
139
140 call printf( out_unit, &
141 & indent_str(1:indent_len) // &
142 & '>' )
143
144 deallocate(rvalue, stat=stat)
146
147999 continue
149 call endsub(subname, '%d stat=%d', i=(/var % mapid, stat/))
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public gt_enomem
integer function, public errorcode()
integer, parameter, public dc_noerr
Provides kind type parameter values.
integer, parameter, public stdout
Unit number for Standard OUTPUT
integer, parameter, public string
Character length for string