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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
|
subroutine lstelmi
c ================================== ( Inria ) =============
c
c evaluate utility list's functions with possible indirect args
c
c =============================================================
c
c Copyright INRIA
c
include '../stack.h'
c
if (ddt .eq. 4) then
write(buf(1:4),'(i4)') fin
call basout(io,wte,' lstelmi '//buf(1:4))
endif
c
c functions/fin
c 1 2
c getfield setfield
c
c
rhs=max(0,rhs)
if(top-rhs+lhs+1.ge.bot) then
call error(18)
return
endif
c
goto(10,20) fin
10 continue
c getfield
call intgetfield()
if(err.gt.0) return
goto 99
20 continue
c setfield
call intsetfield()
if(err.gt.0) return
goto 99
99 return
end
subroutine intgetfield()
include '../stack.h'
integer top0,tops,vol,vol2,vol1
integer strpos
external strpos
integer iadr,sadr
c
iadr(l)=l+l-1
sadr(l)=(l/2)+1
c
if (rhs .lt. 1) then
call error(39)
return
endif
lw=lstk(top+1)
c
c extraction
10 continue
if(rhs.ne.2) then
call error(39)
return
endif
c arg2(arg1)
c get arg2
il2=iadr(lstk(top))
if(istk(il2).lt.0) il2=iadr(istk(il2+1))
if(istk(il2).lt.15.or.istk(il2).gt.17) then
err=1
call error(56)
return
endif
m2=istk(il2+1)
id2=il2+3
l2=sadr(il2+m2+3)
c get arg1
top=top-1
il1=iadr(lstk(top))
if(istk(il1).lt.0) il1=iadr(istk(il1+1))
m1=istk(il1+1)
ilist=0
nlist=0
if(istk(il1).eq.15) then
ill=il1
nlist=m1
ll=sadr(ill+3+nlist)
ilist=1
il1=iadr(ll+istk(ill+1+ilist)-1)
if(istk(il1).lt.0) il1=iadr(istk(il1+1))
m1=istk(il1+1)
endif
c
15 continue
c
if(istk(il1).ne.10) goto 20
c . arg2(arg1) with arg1 vector of strings
ilt=iadr(sadr(il2+istk(il2+1)+3))
nt=istk(ilt+1)*istk(ilt+2)
if(nt.ne.1) goto 17
c . Soft coded extraction
buf='Soft coded field names not yet implemented'
call error(999)
return
17 continue
c arg2(arg1) arg1:string, hard coded case
if(istk(il1+1).gt.1.and.istk(il1+2).gt.1) then
call error(21)
return
endif
n1=istk(il1+1)*istk(il1+2)
ili=iadr(lw)
lw=sadr(ili+n1)
err=lw-lstk(bot)
if(err.gt.0) then
call error(17)
return
endif
c . look for corresponding index
l=il1+5+n1
mx=0
do 18 i=1,n1
nl=istk(il1+4+i)-istk(il1+3+i)
n=strpos(istk(ilt+5),nt-1,istk(ilt+5+nt),istk(l),nl)
l=l+nl
if(n.le.0) then
call error(21)
return
endif
n=n+1
mx=max(mx,n)
istk(ili-1+i)=n
18 continue
n=n1
c end of arg1=string case
goto 22
c begining of standard case
20 if(m1.eq.-1) then
c . arg2(:)
l=lstk(top)
if(ilist.ne.nlist) then
if(m2.ne.1) then
call error(21)
return
endif
endif
if(m2.ne.lhs) then
call error(41)
return
endif
if(top+1+m2.ge.bot) then
call error(18)
return
endif
do 21 i=1,m2
vol1=istk(il2+2+i)-istk(il2+1+i)
if(vol1.eq.0) then
err=i
call error(117)
return
endif
lstk(top+1)=lstk(top)+vol1
top=top+1
21 continue
top=top-1
call unsfdcopy(istk(il2+m2+2)-1,stk(l2),1,stk(l),1)
goto 99
else
c . arg2(arg1) standard case
call indxg(il1,m2,ili,n,mx,lw,1)
if(err.gt.0) return
endif
c
22 if(mx.gt.m2) then
call error(21)
return
endif
c
if(ilist.ge.nlist) goto 31
if(n.gt.1) then
call error(21)
return
endif
lt2=sadr(il2+3+m2)+istk(il2+1+istk(ili))-1
ll2=istk(il2+2+istk(ili))-istk(il2+1+istk(ili))
il2=iadr(lt2)
23 ilist=ilist+1
il1=iadr(ll+istk(ill+1+ilist)-1)
if(istk(il1).lt.0) il1=iadr(istk(il1+1))
m1=istk(il1+1)
if(istk(il2).eq.15.or.istk(il2).eq.16) goto 26
call error(21)
return
26 continue
m2=istk(il2+1)
l2=sadr(il2+m2+3)
goto 15
c
31 if(n.ne.lhs) then
call error(41)
return
endif
c
if(top+n+1.ge.bot) then
call error(18)
return
endif
do 32 i=1,n
k=istk(ili-1+i)
vol2=istk(il2+2+k)-istk(il2+1+k)
if(vol2.eq.0) then
err=k
call error(117)
return
endif
lstk(top+1)=lstk(top)+vol2
top=top+1
32 continue
top=top-1
c
ill=iadr(max(lw,lstk(top+1)))
lw=sadr(ill+n)
err=sadr(ill+n)-lstk(bot)
if(err.gt.0) then
call error(17)
return
endif
do 34 i=1,n
k=istk(ili-1+i)
istk(ill-1+i)=istk(il2+1+k)+l2-1
34 continue
c
do 35 i=1,n
k=top-n+i
call unsfdcopy(lstk(k+1)-lstk(k),stk(istk(ill-1+i)),1,
$ stk(lstk(k)),1)
35 continue
goto 99
99 return
end
subroutine intsetfield()
include '../stack.h'
integer typs,topk
logical eptover
c
integer iadr,sadr
c
iadr(l)=l+l-1
sadr(l)=(l/2)+1
c
if (rhs .ne. 3) then
call error(39)
return
endif
if ( eptover(1,psiz)) return
rstk(pt)=0
call putid(ids(1,pt),idstk(1,top))
il3r=iadr(lstk(top))
if(istk(il3r).lt.0) then
if(abs(istk(il3r)).lt.15.or.abs(istk(il3r)).gt.17) then
call error(44)
return
endif
typs=abs(istk(il3r))
il3=iadr(istk(il3r+1))
if(typs.eq.17) then
c change type to tlist
istk(il3r)=-16
istk(il3)=16
endif
else
err=3
call error(118)
return
endif
call intl_i
c reset the proper variable type
pt=pt-1
if (fin.lt.0) call error(21)
if(err.gt.0) then
istk(il3)=typs
return
endif
il=iadr(lstk(top))
if(istk(il).ne.-1.or.istk(il+1).ne.-1) then
buf='Inexpected error, please report'
call error(8881)
endif
topk=istk(il+2)
ilk=iadr(lstk(topk))
istk(ilk)=typs
c return an null variable
istk(il)=0
return
end
|