File: intexecstr.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 (186 lines) | stat: -rw-r--r-- 4,761 bytes parent folder | download
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
      subroutine intexecstr
c     Copyright INRIA/ENPC
c     Bug 1054 corrected by Francois VOGEL, October 2004
      INCLUDE '../stack.h'
c     
      integer retu(6),comma,eol,topk,mode(2)
      logical eptover,getsmat,checklhs,checkrhs,checkval
      integer iadr,sadr
      logical first,pflag
c
      save opened,lunit,job,icomp
c     
      data retu/27,14,29,30,27,23/,comma/52/,eol/99/
c     
      iadr(l)=l+l-1
      sadr(l)=(l/2)+1
c     
      if(rstk(pt).eq.903) goto 24


      rhs=max(0,rhs)
      topk=top

      if(.not.checklhs('execstr',0,1)) return
      if(.not.checkrhs('execstr',1,3)) return

      imess=1
      if(rhs.eq.3) then
         if(.not.getsmat('execstr',topk,top,m,n,1,1,il1,n1)) return
         if(.not.checkval('execstr',m*n,1) ) return
         l=abs(istk(il1))
         if(l.eq.22) imess=0
         top=top-1
      endif
      if(rhs.ge.2) then
         if(.not.getsmat('execstr',topk,top,m,n,1,1,il1,n1)) return
         if(.not.checkval('execstr',m*n,1) ) return
         top=top-1
         icheck=1
      else
         icheck=0
      endif
      rhs=1
      lw=lstk(top+1)
      il=iadr(lstk(top))
      if(lhs.gt.1) then
         call error(41)
         return
      endif
      if(istk(il).ne.10) then 
         if(istk(il).eq.1.and.istk(il+1).eq.0) then
            if (icheck.eq.1) then
               istk(il)=1
               istk(il+1)=1
               istk(il+2)=1
               istk(il+3)=0
               l=sadr(il+4)
               stk(l)=0
               lstk(top+1)=l+1
            else
               istk(il)=0
               lstk(top+1)=lstk(top)+1
            endif
            return
         endif
         err=1
         call error(55)
         return
      endif
      n=istk(il+1)*istk(il+2)
      l=il+5+n
      if(n.gt.1) then
c     .  add <eol> at the end of the first n-1 lines
         i1=n-1
         do 21 i=n,2,-1
            ld=l+istk(il+3+i)-1
            ln=istk(il+4+i)-istk(il+3+i)
            call icopy(ln,istk(ld),-1,istk(ld+i1),-1)
            i1=i1-1
            istk(ld+i1)=eol
            istk(il+4+i)=istk(il+4+i)+i-1
 21      continue 
      endif
c     add "<eol>,return,<eol><eol>" at the end of the last line
      l1=l-1+istk(l-1)
      istk(l1)=eol
      l1=l1+1
      istk(l1)=comma
      l1=l1+1
      call icopy(6,retu,1,istk(l1),1)
      l1=l1+6
      istk(l1)=comma
      l1=l1+1
      istk(l1)=eol
      l1=l1+1
      istk(l1)=eol
      istk(l-1)=istk(l-1)+11
      lstk(top+1)=sadr(l1)+1
c     
      fin=lstk(top)      
      pt=pt+1
      pstk(pt)=top
      rstk(pt)=903
c     error control
      ids(2,pt)=errct
      ids(3,pt)=err2
      ids(4,pt)=err1
      ids(5,pt)=errpt
      ids(6,pt)=(lct(4)+100)+10000*sym
      if(icheck.eq.0) then
         ids(1,pt)=0
         if(errct.ne.0) then
            imode=abs(errct/100000)
            imode=imode-8*int(imode/8)
         endif
         if (imode.ne.0) errpt=pt
      else
         errpt=pt
         ids(1,pt)=1
         imode=1
         num=-1
         errct=(8*imess+imode)*100000+abs(num)
         if(num.lt.0) errct=-errct
      endif
      icall=5
c     *call*  macro
      go to 999
 24   continue
      if(ids(1,pt).eq.1) then
c     .  error recovery required: return error number
         top=pstk(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(err2,err1)
         lstk(top+1)=l+1
         errct=ids(2,pt)
         err2=0
         err1=0
         errpt=ids(5,pt)
         sym=ids(6,pt)/10000
         lct(4)=ids(6,pt)-10000*sym-100
         fun=0
      else
c     .  error recovery not required by this execstr
         if(errct.ne.0.and.err1.gt.0.and.rstk(pt).eq.903) then
c     .     error recovery required at a higher level
            pt0=ids(5,pt)
c     .     following code copied from errmgr
            pt=pt+1
 25         pt=pt-1
            if(pt.eq.pt0) goto 28
            goto(26,26,27) rstk(pt)-500
            if(r.eq.904) then
               if (ids(2,pt).ne.0) then
c     .           getf(  'c') case, close the file
                  mode(1)=0
                  call clunit(-ids(2,pt),buf,mode)
               endif
            endif
            goto 25
c     .     on depile une fonction
 26         call depfun(lunit,.false.,.false.)
            goto 25
c     .     on depile un exec ou une pause
 27         call depexec(lunit,.false.,.false.,pflag)
            if(.not.pflag) goto 25
 28         top=pstk(pt)
            goto 24
         else
            errpt=ids(5,pt)
            il=iadr(lstk(top))
            istk(il)=0
            lstk(top+1)=lstk(top)+1
            err1=0
         endif
      endif

      pt=pt-1

      goto 999
 999  return
      end