File: intexec.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (197 lines) | stat: -rw-r--r-- 4,254 bytes parent folder | download | duplicates (2)
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
      subroutine intexec
c     interface of exec function

c     Copyright INRIA/ENPC
      INCLUDE '../stack.h'
c     
      integer flag,semi,typ
      integer mode(2),retu(6)
      logical opened
      integer iadr,sadr
c
      save opened,lunit
c     
      data semi/43/
      data retu/27,14,29,30,27,23/

c     
      iadr(l)=l+l-1
      sadr(l)=(l/2)+1
c     
      if (ddt .eq. 4) then
         write(buf(1:4),'(i4)') fin
         call basout(io,wte,' matio '//buf(1:4))
      endif
c     

      if(int(rstk(pt)/100).ne.9) goto 01
      if(rstk(pt).eq.902) goto 12
      if(rstk(pt).eq.909) goto 16

 01   lw=lstk(top+1)

      if(rhs.gt.3.or.rhs.lt.1) then
         call error(42)
         return
      endif
      if(lhs.gt.1) then
         call error(41)
         return
      endif

c     options handling
c---------------------
c     default options values
      flag = 3
      if (sym .eq. semi) flag = 0
      icheck=0
c
      if(rhs.gt.1) then
c     . specified options
         do 11 ir=2,rhs
            ilopt=iadr(lstk(top))
            if(istk(ilopt).lt.0) ilopt=iadr(istk(ilopt+1))
            if(istk(ilopt).eq.1) then
c     .        mode given
               flag = int(stk(sadr(ilopt+4)))
            elseif(istk(ilopt).eq.10) then
c     .        error control
               icheck=1
            else
               call error(44)
               return
            endif
            top=top-1
 11      continue
      endif

      if(flag.ge.4) then
         call basout(io,wte,
     $        'step-by-step mode: enter carriage return to proceed')
      endif
      il=iadr(lstk(top))
      typ=abs(istk(il))
      if(typ.eq.1.or.typ.eq.10) then
c     .  exec of a file , opening file
         call v2cunit(top,'rb',lunit,opened,ierr)
         if(ierr.gt.0)  return
         top=top-1
         typ=1
      elseif(typ.eq.11.or.typ.eq.13) then
c     .  exec of a function
         typ=0
      else
         err=1
         call error(44)
         return
      endif
c
      pt=pt+1
c     preserve current error recovery modes
      ids(2,pt)=errct
      ids(3,pt)=err2
      ids(4,pt)=err1
      ids(5,pt)=errpt
c     set error recovery modes
      if(icheck.eq.0) then
         ids(1,pt)=0
      else
c         ids(1,pt)=1+toperr
c         toperr=top
         ids(1,pt)=1+top
         errpt=pt
         imode=1
         imess=1
         num=-1
         errct=(8*imess+imode)*100000+abs(num)
         if(num.lt.0) errct=-errct
      endif

      if(typ.eq.0) goto 15

c     exec of a file
c     ---------------
      pstk(pt)=rio
      rio = lunit
      rstk(pt)=902

      ids(6,pt)=0
      if(opened) ids(6,pt)=1
      icall=5
      fin=flag
c     *call*  macro
      go to 999
 12   continue
      opened=ids(6,pt).eq.1
      if(.not.opened) call clunit(-rio,buf,mode)
      rio=pstk(pt)
      top=top+1
      lhs=1
      if(ids(1,pt).gt.0) then
c     return error number
         top=ids(1,pt)
         il=iadr(lstk(top))
         istk(il)=1
         istk(il+1)=1
         istk(il+2)=1
         istk(il+3)=0
         l=sadr(il+4)
         stk(l)=max(err1,err2)
         lstk(top+1)=l+1
         fun=0
         err1=0
         err2=0
c         toperr=ids(1,pt)-1
      else
         il=iadr(lstk(top))
         istk(il)=0
         lstk(top+1)=lstk(top)+1
         err2=max(ids(3,pt),err2)
         err1=max(ids(4,pt),err1)
      endif
c     restore error recovery modes
      errct=ids(2,pt)
      errpt=ids(5,pt)
      pt=pt-1
      goto 999


c     exec of a function
c     ------------------
 15   continue
      fin=lstk(top)
      pstk(pt)=flag

      rstk(pt)=909
      icall=5
c     *call*  macro
      go to 999
 16   lhs=1
 17   if(ids(1,pt).gt.0) then
c     return error number
         top=ids(1,pt)-1
         il=iadr(lstk(top))
         istk(il)=1
         istk(il+1)=1
         istk(il+2)=1
         istk(il+3)=0
         l=sadr(il+4)
         stk(l)=max(err1,err2)
         lstk(top+1)=l+1
         fun=0
c         toperr=ids(1,pt)-1
      else
         il=iadr(lstk(top))
         istk(il)=0
         lstk(top+1)=lstk(top)+1
      endif
c     restore error recovery modes
      errct=ids(2,pt)
      err2=ids(3,pt)
      err1=ids(4,pt)
      errpt=ids(5,pt)
      pt=pt-1
      goto 999
c
 999  return
      end