parse.c

Go to the documentation of this file.
00001 /*     ==================================================================== */
00002 /*     Scilab parsing function */
00003 /*     ==================================================================== */
00004 /*     Copyright INRIA, S. Steer */
00005 /* *------------------------------------------------------------------ */
00006 #include <string.h>
00007 #include <stdio.h>
00008 #include "stack-c.h"
00009 #include "parse.h"
00010 #include "timer.h"
00011 
00012 #undef Lstk
00013 #undef Infstk
00014 
00015 
00016 
00017 #ifdef _MSC_VER
00018 #define abs(x) ((x) >= 0 ? (x) : -(x)) /* pour abs  C2F(parse)() line 1393 */
00019 #endif
00020 
00021 IMPORT struct {
00022   logical iflag, interruptible;
00023 } C2F(basbrk);
00024 
00025 /* Table of constant values */
00026 
00027 static int c__1 = 1;
00028 static int c__0 = 0;
00029 static int c_n1 = -1;
00030 #define comma  52
00031 #define lparen  41
00032 #define rparen  42
00033 #define left  54
00034 #define right  55
00035 #define less  59
00036 #define great  60
00037 #define dot  51
00038 #define name  1
00039 #define num  0
00040 #define cmt  2
00041 #define insert  2
00042 #define extrac  3
00043 #define blank  40
00044 #define semi  43
00045 #define slash  48
00046 
00047 #define equal  50
00048 #define eol  99
00049 #ifndef max 
00050 #define max(x,y)        (((x)>(y))?(x):(y))
00051 #endif 
00052 
00053 #define Pt (C2F(recu).pt)
00054 
00055 extern int C2F(clause)();
00056 extern int C2F(fact)();
00057 extern int C2F(expr)();
00058 extern int C2F(terme)();
00059 extern int C2F(stackp)();
00060 extern int C2F(stackg)();
00061 extern int C2F(macro)();
00062 extern int C2F(getsym)();
00063 
00064 extern int C2F(putid)(); 
00065 extern logical C2F(eqid)();
00066 extern logical C2F(ptover)();
00067 extern int C2F(funs)();
00068 
00069 extern int C2F(sxevents)();
00070 extern int C2F(bexec)();
00071 extern int C2F(ismenu)();
00072 extern int C2F(getmen)();
00073 extern int C2F(tksynchro)();
00074 extern int C2F(checkevts)();
00075 
00076 extern int C2F(findequal)();
00077 extern int C2F(print)();
00078 extern int C2F(cvstr)();
00079 extern int C2F(createref1)();
00080 extern int C2F(comand)();
00081 extern int C2F(cvname)();
00082 extern int C2F(getlin)();
00083 extern int C2F(mrknmd)();
00084 extern int C2F(stimer)();
00085 extern int C2F(basout)();
00086 extern int C2F(mkindx)();
00087 extern int C2F(whatln)();
00088 extern int C2F(prompt)();
00089 extern int C2F(seteol)();
00090 extern int C2F(allops)();
00091 extern int C2F(run)();
00092 extern int C2F(name2var)();
00093 extern void C2F(parsecomment)();
00094 extern int C2F(msgs)();
00095 extern int C2F(error)();
00096 extern logical C2F(compil)();
00097 extern logical C2F(eptover)();
00098 extern logical C2F(Ptover)();
00099 
00100 void handle_onprompt(int *n);
00101 
00102 void Msgs(int n,int ierr)
00103 {
00104    C2F(msgs)(&n,&ierr);
00105 }
00106  
00107 void SciError(int n)
00108 {
00109  C2F(error)(&n);
00110 }
00111 
00112 logical Compil(int code,int * val1,int val2,int val3,int val4)
00113 {
00114   return C2F(compil)(&code, val1, &val2, &val3, &val4);
00115 }
00116 
00117 logical Eptover(int n)
00118 {
00119   int c;
00120   return C2F(eptover)(&n,(c=psiz,&c));
00121 }
00122 logical Ptover(int n)
00123 {
00124   int c;
00125   return C2F(ptover)(&n,(c=psiz,&c));
00126 }
00127 
00128 int C2F(parse)()
00129 {
00130   /* Initialized data */
00131   static int ans[6] = { 672929546,673720360,673720360,673720360,
00132                             673720360,673720360 };
00133   static int varargout[6] = { 169544223,504893467,673720349,673720360,
00134                                   673720360,673720360 };
00135   /* static int catch[6] = {203229708,673720337,673720360,673720360, 673720360,673720360 };*/
00136 
00137   static int *Ids     = C2F(recu).ids-nsiz-1;
00138   static int *Rstk    = C2F(recu).rstk-1;
00139   static int *Pstk    = C2F(recu).pstk-1;
00140   static int *Lstk    = C2F(vstk).lstk-1;
00141   static int *Lin     = C2F(iop).lin-1;
00142   static int *Lpt     = C2F(iop).lpt-1;
00143   static int *Lct     = C2F(iop).lct-1;
00144   /*static double *Stk  = C2F(stack).Stk-1;*/
00145   /*static int    *Istk = (int *)( C2F(stack).Stk)-1;*/
00146 
00147   /* System generated locals */
00148   int i__2, i__3;
00149 
00150   /* Local variables */
00151   static int iesc, ndel, ifin, ibpt;
00152   static int iret;
00153   static int topk;
00154   static int lpts, next;
00155   static int ierr;
00156   static int k, p, r;
00157   static int imode, schar;
00158   static int itime, where;
00159   static logical found;
00160   static int excnt;
00161   static int l1;
00162   static int id[6], lb, io, ir;
00163   static int inxsci;
00164   static logical dotsep;
00165   static int icount;
00166   static int nentry, lastindpos;
00167   static int job, nlc, pts;
00168   static char tmp[80];
00169 
00170 
00171   itime = 10000;
00172   C2F(checkevts)(&inxsci);
00173  L1:
00174   r = 0;
00175   if (Pt > 0) {
00176     r = Rstk[Pt];
00177   }
00178   if (C2F(iop).ddt == 4) {
00179     sprintf(tmp," TOP    pt:%d rstk(pt):%d icall: %d niv: %d err:%d",
00180             Pt,Rstk[Pt], C2F(recu).icall, C2F(recu).niv,C2F(iop).err);
00181     C2F(basout)(&io, &C2F(iop).wte,tmp, strlen(tmp));
00182   }
00183 
00184   if (C2F(recu).icall == 5) {
00185     goto L88;
00186   }
00187   if (Pt > 0) {
00188     goto L86;
00189   }
00190   if (C2F(iop).err > 0) {
00191     goto L98;
00192   }
00193   /*     initialization */
00194   /* ------------------- */
00195  L5:
00196   C2F(com).sym = eol;
00197   job = 0;
00198   if (C2F(iop).rio == -1) {
00199     job = -1;
00200   }
00201   Top = 0;
00202   C2F(com).fin = 0;
00203   C2F(recu).macr = 0;
00204   C2F(recu).paus = 0;
00205   C2F(recu).icall = 0;
00206   C2F(iop).rio = C2F(iop).rte;
00207   Lct[3] = 0;
00208   Lct[4] = 2;
00209   Lpt[1] = 1;
00210   if (job == -1) {
00211     goto L13;
00212   }
00213 
00214  L10:
00215   if (C2F(com).sym != eol) {
00216     goto L15;
00217   }
00218   if (C2F(com).comp[0] == 0) {
00219     goto L12;
00220   }
00221   if (Lin[Lpt[4]+1] == eol) {
00222     goto L88;
00223   }
00224 
00225   /*     get a new line */
00226   /* ------------------- */
00227  L12:
00228   if (Lct[4] <= -10) {
00229     Lct[4] = -Lct[4] - 11;
00230   } else {
00231     if (Lct[4] / 2 % 2 == 1) {
00232       i__2 = Lct[4] / 4;
00233       C2F(prompt)(&i__2, &iesc);
00234       if (iesc == 1) {
00235         /* interrupted line acquisition (mode=7) */
00236         iret = 3;
00237         goto L96;
00238       }
00239       Lct[1] = 0;
00240       if (C2F(recu).paus == 0 && 
00241           C2F(iop).rio == C2F(iop).rte && 
00242           C2F(recu).macr ==  0) {
00243         if (Pt != 0) {
00244           Msgs(30,0);
00245           Pt = 0;
00246         }
00247         if (Top != 0) {
00248           Msgs(31,0);
00249           Top = 0;
00250         }
00251       }
00252     }
00253   }
00254  L13:
00255   C2F(tksynchro)(&C2F(recu).paus);
00256   C2F(getlin)(&job, &c__1);
00257   C2F(tksynchro)(&c_n1);
00258   if (C2F(com).fin == -3) {
00259     /*     interrupted line acquisition */
00260     iret = 2;
00261     goto L96;
00262   } else if (C2F(com).fin == -1) {
00263     /*     Continuation line handling when scilab is called as a routine */
00264     C2F(com).fun = 99;
00265     return 0;
00266   }
00267   job = 0;
00268   C2F(iop).err = 0;
00269 
00270   if (Pt != 0) {
00271     goto L15;
00272   }
00273  L14:
00274   handle_onprompt(&where);
00275   if (C2F(iop).err > 0) {
00276     goto L98;
00277   }
00278   switch ((int)where) {
00279   case 1:  goto L85;
00280   case 2:  goto L88;
00281   }
00282   /*     Beginning of a new statement, clause expression or command */
00283   /* ------------------------------------------------------------ */
00284  L15:
00285   if (inxsci == 1 && scilab_timer_check() ) C2F(sxevents)();
00286   if (C2F(ismenu)() == 1 && C2F(basbrk).interruptible) {
00287     iret = 1;
00288     goto L96;
00289   }
00290 
00291   r = 0;
00292   if (Pt > 0) {
00293     r = Rstk[Pt];
00294   }
00295   if (C2F(iop).ddt == 4) {
00296     sprintf(tmp," parse  pt:%d rstk(pt):%d top: %d niv: %d err:%d",
00297             Pt,r,Top, C2F(recu).niv,C2F(iop).err);
00298     C2F(basout)(&io, &C2F(iop).wte,tmp, strlen(tmp));
00299   }
00300 
00301   excnt = 0;
00302   if (! C2F(basbrk).iflag || C2F(com).comp[0] != 0 ) {
00303     goto L18;
00304   }
00305   /*     Handling of pauses */
00306  L16:
00307   if (Eptover(1)) {
00308     goto L98;
00309   }
00310   Pstk[Pt] = C2F(iop).rio;
00311   Ids[2 + Pt * nsiz] = Top;
00312   C2F(iop).rio = C2F(iop).rte;
00313   Rstk[Pt] = 701;
00314   C2F(basbrk).iflag = FALSE_;
00315   C2F(com).fin = 2;
00316   if (Lct[4] <= -10) {
00317     C2F(com).fin = -1;
00318     Lct[4] = -Lct[4] - 11;
00319   }
00320   /*     *call* macro */
00321   goto L88;
00322   /*     pauses termination */
00323  L17:
00324   C2F(iop).rio = Pstk[Pt];
00325   Top = Ids[2 + Pt * nsiz];
00326   --Pt;
00327   goto L15;
00328  L18:
00329   Lhs = 1;
00330   excnt = 0;
00331   C2F(putid)(id, ans);
00332   /*     preserve current character position */
00333   lpts = Lpt[4] - 1;
00334   pts = Pt;
00335 
00336   C2F(getsym)();
00337   if (C2F(com).sym == right || C2F(com).sym == rparen || C2F(com).sym == less || 
00338       C2F(com).sym == great) {
00339     SciError(1);
00340     goto L98;
00341   } else if (C2F(com).sym == semi || C2F(com).sym == comma || C2F(com).sym == eol) {
00342     goto L77;
00343   } else if (C2F(com).sym == cmt) {
00344     C2F(parsecomment)();
00345     goto L77;
00346   } else if (C2F(com).sym == name) {
00347     lpts = Lpt[3] - 1;
00348     /* try to avoid the comand call whenever it is possible */
00349     if (C2F(com).char1 == equal) {
00350       goto L25;
00351     }
00352     /*         if (char1 .eq. lparen) then */
00353     /*           one can get this case with "if ( ) then" */
00354     /*         endif */
00355     if (Lpt[4] >= 2) {
00356       if (Lin[Lpt[4] - 2] == blank) {
00357         goto L20;
00358       }
00359     }
00360     if (C2F(com).char1 == dot) {
00361       /* name.x */
00362       schar = C2F(com).char1;
00363       goto L30;
00364     }
00365     goto L20;
00366   } else if (C2F(com).sym == left) {
00367     /* is there an explicit affectation */
00368     lpts = Lpt[3] - 1;
00369     Lpt[4] = lpts;
00370     Lpt[3] = lpts;
00371     C2F(com).char1 = blank;
00372     C2F(findequal)(&found);
00373     if (C2F(iop).err > 0) {
00374       goto L98;
00375     }
00376     if (found) {
00377       /* multiple lhs */
00378       goto L40;
00379     } else {
00380       /* no ==> implicit lhs */
00381       goto L50;
00382     }
00383   } else {
00384     /* not lhs defined */
00385     /* set ans for lhs */
00386     if (Eptover(1)) {
00387       goto L98;
00388     }
00389     C2F(putid)(&Ids[1 + Pt * nsiz], ans);
00390     Lhs = 1;
00391     Pstk[Pt] = 0;
00392     /* go to rhs analysis */
00393     goto L60;
00394   }
00395 
00396   /*     lhs begins with name */
00397   /* ------------------------- */
00398   /*     check if it is a simple command like clear,... */
00399  L20:
00400   C2F(comand)(C2F(com).syn, &c__0);
00401   if (C2F(iop).err > 0) {
00402     goto L98;
00403   }
00404   if (C2F(com).fin == 0) {
00405     goto L21;
00406   }
00407   if (C2F(com).fun == 99) {
00408     return 0;
00409   }
00410   if (C2F(com).fun != 0) {
00411     goto L93;
00412   }
00413   if (C2F(com).fin < 0) {
00414     goto L80;
00415   }
00416   if (C2F(com).fin == 2) {
00417     goto L88;
00418   }
00419   if (C2F(com).fin == 3) {
00420     goto L16;
00421   }
00422   if (C2F(com).fin == 4) {
00423     goto L5;
00424   }
00425   if (C2F(com).fin > 0) {
00426     goto L77;
00427   }
00428   /*     name is not a command */
00429  L21:
00430   Rhs = 0;
00431   C2F(com).fin = -5;
00432   /* IL y a p avec fin=-5 (on ne trouve pas les macros parce que l'on ne */
00433   /* veut pas que les macros sans arg soient vues comme des commandes */
00434   /* mais pourquoi pas il suffirait de dire que pour visualiser une macro */
00435   /* il faut faire disp() */
00436   C2F(com).fun = 0;
00437   C2F(funs)(C2F(com).syn);
00438   if (C2F(com).fin > 0) {
00439     /*        name is a builtin name */
00440     if (C2F(com).char1 == equal) {
00441       /*           fun=expr is not allowed */
00442       C2F(putid)(&Ids[1 + (Pt + 1) * nsiz], C2F(com).syn);
00443       SciError(25);
00444       goto L98;
00445     }
00446     /*        skip lhs analysis */
00447     if (Eptover(1)) {
00448       goto L98;
00449     }
00450     C2F(putid)(&Ids[1 + Pt * nsiz], id);
00451     Lhs = 1;
00452     Pstk[Pt] = 0;
00453     /* go to rhs analysis */
00454     goto L60;
00455   }
00456 
00457   /*     peek one character ahead */
00458   if (C2F(com).char1 == semi || C2F(com).char1 == comma || C2F(com).char1 == eol) {
00459     C2F(putid)(id, C2F(com).syn);
00460   }
00461   if (C2F(com).char1 == lparen) {
00462     schar = C2F(com).char1;
00463     goto L30;
00464   }
00465   /*     instruction is just "name", skip lhs analysis */
00466   /*     record name as lhs */
00467   if (Eptover(1)) {
00468     goto L98;
00469   }
00470   C2F(putid)(&Ids[1 + Pt * nsiz], id);
00471   Lhs = 1;
00472   Pstk[Pt] = 0;
00473   /*     go to rhs analysis */
00474   goto L60;
00475 
00476   /*     name = expr  or name == expr syntax */
00477   /* ---------------------------------------- */
00478  L25:
00479   C2F(putid)(id, C2F(com).syn);
00480   lpts = Lpt[2];
00481   C2F(getsym)();
00482   if (C2F(com).char1 == equal) {
00483     /* name == expr syntax ==> implicit lhs */
00484     goto L50;
00485   } else {
00486     /* lhs found */
00487     /* record it */
00488     if (Eptover(1)) {
00489       goto L98;
00490     }
00491     C2F(putid)(&Ids[1 + Pt * nsiz], id);
00492     Lhs = 1;
00493     Pstk[Pt] = 0;
00494     C2F(getsym)();
00495     /* go to rhs analysis */
00496     goto L60;
00497   }
00498 
00499   /*     lhs is name(...) or name.x... */
00500   /* ----------------------------------- */
00501  L30:
00502   Lpt[5] = Lpt[4];
00503   C2F(putid)(id, C2F(com).syn);
00504 
00505   /*     looking for equal to check if it is really an lhs */
00506   C2F(findequal)(&found);
00507   if (C2F(iop).err > 0) {
00508     goto L98;
00509   }
00510   if (! found) {
00511     goto L50;
00512   }
00513   /*     It is really a lhs (insertion syntax) */
00514  L32:
00515   Lpt[4] = Lpt[5];
00516   C2F(com).char1 = schar;
00517 
00518   /* 35     call parseindexlist(excnt) */
00519   /*     if(err.gt.0) goto 98 */
00520   if (Compil(21, &c__0, 0, 0, 0)) {
00521     if (C2F(iop).err > 0) {
00522       return 0;
00523     }
00524   }
00525   /*     begin the index lists */
00526   icount = 0;
00527   C2F(getsym)();
00528 
00529  L33:
00530   /*     begin a new index list (.,..) or .name */
00531   ++icount;
00532 
00533   dotsep = C2F(com).sym == dot;
00534   C2F(getsym)();
00535   if (dotsep) {
00536     /* --> new index list is .name */
00537     if (C2F(com).sym != name) {
00538       SciError(21);
00539       if (C2F(iop).err > 0) {
00540         return 0;
00541       }
00542     }
00543 
00544     if (C2F(com).comp[0] != 0) {
00545       if (Compil(23, C2F(com).syn, 0, 0, 0)) {
00546         if (C2F(iop).err > 0) {
00547           return 0;
00548         }
00549       }
00550     } else {
00551       C2F(name2var)(C2F(com).syn);
00552     }
00553     C2F(getsym)();
00554     /*         icount=icount+1 */
00555     if (C2F(com).sym == dot) {
00556       goto L33;
00557     }
00558     dotsep = FALSE_;
00559     excnt = 1;
00560     goto L36;
00561   }
00562   /*     --> new index list is (.,..) */
00563  L34:
00564   /*     add a new index in index list (i,...) */
00565   ++excnt;
00566   if (Eptover(1)) {
00567     goto L98;
00568   }
00569   C2F(putid)(&Ids[1 + Pt * nsiz], id);
00570   Pstk[Pt] = excnt + icount * 1000;
00571   Rstk[Pt] = 702;
00572   /*     *call* expr */
00573   goto L81;
00574  L35:
00575   C2F(putid)(id, &Ids[1 + Pt * nsiz]);
00576   icount = Pstk[Pt] / 1000;
00577   excnt = Pstk[Pt] - icount * 1000;
00578   --Pt;
00579 
00580   if (C2F(com).sym == comma) {
00581     /* current syntax is (i,j,..) */
00582     C2F(getsym)();
00583     goto L34;
00584   }
00585 
00586   if (C2F(com).sym == rparen) {
00587     /* end of the current index list */
00588     C2F(getsym)();
00589   } else {
00590     SciError(3);
00591     if (C2F(iop).err > 0) {
00592       goto L98;
00593     }
00594   }
00595 
00596  L36:
00597   if (C2F(com).sym == lparen || C2F(com).sym == dot) {
00598     /* begining of a a new index list */
00599     /* first memorize the previous one */
00600     if (excnt > 1) {
00601       /* previously analysed syntax is (i,j,..)( */
00602       if (C2F(com).comp[0] == 0) {
00603         /* form  list with individual indexes i,j,.. */
00604         C2F(mkindx)(&c__0, &excnt);
00605         if (C2F(iop).err > 0) {
00606           return 0;
00607         }
00608       } else {
00609         if (Compil(19, &c__0, excnt, 0, 0)) {
00610           if (C2F(iop).err > 0) {
00611             return 0;
00612           }
00613         }
00614       }
00615       excnt = 1;
00616     }
00617     /* open a new index list */
00618     excnt = 0;
00619     /*         icount=icount+1 */
00620     goto L33;
00621   }
00622   /*     end of all the index lists */
00623   if (icount > 1) {
00624     /* form  list with individual indexes */
00625     if (C2F(com).comp[0] == 0) {
00626       C2F(mkindx)(&icount, &excnt);
00627       if (C2F(iop).err > 0) {
00628         return 0;
00629       }
00630     } else {
00631       if (Compil(19, &icount, excnt, 0, 0)) {
00632         if (C2F(iop).err > 0) {
00633           return 0;
00634         }
00635       }
00636     }
00637     excnt = 1;
00638   }
00639   /*     end of code for recursive index */
00640   if (Rstk[Pt] == 711) {
00641     goto L42;
00642   }
00643 
00644   if (C2F(com).sym == equal) {
00645     /* name(...) = expr syntax */
00646     /* record name as lhs */
00647     if (Eptover(1)) {
00648       goto L98;
00649     }
00650     C2F(putid)(&Ids[1 + Pt * nsiz], id);
00651     Pstk[Pt] = excnt;
00652     Lhs = 1;
00653     C2F(getsym)();
00654     /* go to rhs analysis */
00655     goto L60;
00656   } else {
00657     /* this should never happen. this case has been detected above */
00658     /* when lookin for equal sign */
00659     /* name(...) syntax ==> really an rhs */
00660     if (Eptover(1)) {
00661       goto L98;
00662     }
00663     C2F(putid)(&Ids[1 + Pt * nsiz], ans);
00664     Lhs = 1;
00665     Pstk[Pt] = 0;
00666     goto L60;
00667   }
00668 
00669   /*     multiple lhs [a,...]= or [a(..),..] */
00670   /* ---------------------------------------- */
00671  L40:
00672   Lpt[4] = lpts;
00673   Lpt[3] = lpts;
00674   C2F(com).char1 = blank;
00675   Lhs = 0;
00676   C2F(getsym)();
00677   /*     start lhs arguments list */
00678   C2F(getsym)();
00679  L41:
00680   /*     begin analysis of a new lhs argument */
00681   if (C2F(com).sym != name) {
00682     SciError(274);
00683     goto L98;
00684   }
00685   if (C2F(eqid)(C2F(com).syn, varargout)) {
00686     SciError(275);
00687     goto L98;
00688   }
00689   C2F(putid)(id, C2F(com).syn);
00690   excnt = 0;
00691   next = Lin[Lpt[4] - 2];
00692   if (next == blank || C2F(com).char1 == comma || C2F(com).char1 == right) {
00693     /* argument followed by a blank, a comma or a ] ==> it is a simple name */
00694     C2F(getsym)();
00695     goto L44;
00696   } else if (C2F(com).char1 != lparen && C2F(com).char1 != dot) {
00697     /* invalid lhs */
00698     SciError(273);
00699     goto L98;
00700   }
00701   /*     lhs argument is name(..) or name.xx */
00702   if (Eptover(1)) {
00703     goto L98;
00704   }
00705   Rstk[Pt] = 711;
00706   Lpt[5] = Lpt[4];
00707   schar = C2F(com).char1;
00708   goto L32;
00709   /*     *parse* index */
00710  L42:
00711   --Pt;
00712   goto L44;
00713  L44:
00714   /*     record current lhs arg */
00715   if (Eptover(1)) {
00716     goto L98;
00717   }
00718   C2F(putid)(&Ids[1 + Pt * nsiz], id);
00719   ++Lhs;
00720   Pstk[Pt] = excnt;
00721   Rstk[Pt] = 0;
00722   /*     end analysis of a current lhs arg */
00723   if (C2F(com).sym == right) {
00724     goto L46;
00725   }
00726   if (C2F(com).sym == comma) {
00727     C2F(getsym)();
00728   }
00729   /*     loop on lhs args */
00730   goto L41;
00731 
00732  L46:
00733   C2F(getsym)();
00734   if (C2F(com).sym == equal && C2F(com).char1 != equal) {
00735     /*        really found a lhs go to  the rhs analysis part */
00736     C2F(getsym)();
00737     goto L60;
00738   }
00739   /*     lhs revealed to be an rhs */
00740   /* ------------------------------------- */
00741  L50:
00742   /*     no equal symbol */
00743   goto L51;
00744  L51:
00745   /*     lhs is in fact an  rhs */
00746   /*     1 - reinititialise the parser at the instruction beginning */
00747   Pt = pts;
00748   Lpt[4] = lpts;
00749   Lpt[3] = lpts;
00750   C2F(com).char1 = blank;
00751   /* L52: */
00752   C2F(getsym)();
00753   /*      if(sym.eq.comma.or.sym.eq.semi) goto 52 */
00754   /*     2 - make "ans" the lhs */
00755   if (Eptover(1)) {
00756     goto L98;
00757   }
00758   C2F(putid)(&Ids[1 + Pt * nsiz], ans);
00759   Pstk[Pt] = 0;
00760   Lhs = 1;
00761   /*     3 - go to the rhs analysis part */
00762   goto L60;
00763 
00764   /*     lhs finished, start rhs */
00765   /* ---------------------------- */
00766  L60:
00767   Rstk[Pt] = 703;
00768   /*     *call* expr */
00769   goto L81;
00770  L65:
00771   if (Rstk[Pt - Lhs] == 313) {
00772     /*     store  new variable as "named" at the top of the stack */
00773     if (C2F(com).sym == rparen || C2F(com).sym == comma) {
00774       C2F(mrknmd)();
00775       if (C2F(iop).err > 0) {
00776         goto L98;
00777       }
00778       goto L83;
00779     } else {
00780       SciError(40);
00781       goto L98;
00782     }
00783   }
00784   if (C2F(com).sym == semi || C2F(com).sym == comma || C2F(com).sym == eol|| C2F(com).sym == cmt) {
00785     goto L70;
00786   }
00787   if (Rstk[Pt - Lhs] == 808) {/* syntax error while in try */
00788     /* set back the standard error handling ++++*/
00789     Pt=Pt-Lhs;
00790     C2F(errgst).errct = Ids[2 + Pt * nsiz];     
00791     C2F(errgst).errpt = Ids[5 + Pt * nsiz]; 
00792     /* forgot the catch error */
00793     C2F(errgst).err1 = Ids[3 + Pt * nsiz];
00794     C2F(errgst).err2 = Ids[4 + Pt * nsiz];
00795     C2F(com).comp[0] = 0;
00796     Lpt[2] = Lpt[3]+1;
00797     SciError(276);
00798     Pt = Pt - 1;
00799     goto L98;
00800   } else {
00801     Lpt[2] = Lpt[3]+1;
00802     SciError(276);
00803     goto L98;
00804   }
00805 
00806   /*     store results */
00807   /* ------------------- */
00808  L70:
00809   Lhs = max(Lhs,1);
00810   if (Compil(29, &(Lhs), C2F(com).sym, 0, 0)) {
00811     if (C2F(iop).err > 0) {
00812       return 0;
00813     }
00814     Pt -= Lhs;
00815     Lhs = 0;
00816     goto L77;
00817   }
00818   ndel = 0;
00819  L71:
00820   Rhs = Pstk[Pt];
00821   lastindpos = Top - Lhs - ndel;
00822   if (C2F(errgst).err1 != 0) {
00823     goto L76;
00824   }
00825   if (Rhs == 0) {
00826     /* goto simple affectation */
00827     C2F(stackp)(&Ids[1 + Pt * nsiz], &c__0);
00828     if (C2F(iop).err > 0) {
00829       goto L98;
00830     }
00831     if (C2F(errgst).err1 > 0) {
00832       --Pt;
00833       --Lhs;
00834       goto L98;
00835     }
00836     /* topk points on the newly saved variable */
00837     topk = C2F(com).fin;
00838     /* go to print */
00839     goto L73;
00840   }
00841   /*     partial variable affectation (insertion) */
00842   if (lastindpos + 1 != Top) {
00843     /* create reference variables to get index1,...,indexn, value at */
00844     /* the top of the stack in this order */
00845     /* create reference variables pointing to the  indices */
00846     i__2 = Rhs;
00847     for (ir = 1; ir <= i__2; ++ir) {
00848       i__3 = lastindpos - Rhs + ir;
00849       C2F(createref1)(&i__3);
00850     }
00851     /* create reference variable pointing to the value */
00852     i__2 = Top - Rhs;
00853     C2F(createref1)(&i__2);
00854     /* remind to remove the original indices */
00855     ndel += Rhs;
00856   }
00857   lastindpos -= Rhs;
00858   /*     put a reference to the lhs variable */
00859   C2F(com).fin = -3;
00860   C2F(stackg)(&Ids[1 + Pt * nsiz]);
00861   if (C2F(iop).err > 0) {
00862     goto L98;
00863   }
00864   /*     perform insertion operation */
00865   /*     index1,...,indexn, value ==> updated lhs value (or pointer to) */
00866   if (Eptover(1)) {
00867     goto L98;
00868   }
00869   Pstk[Pt] = Lhs;
00870   C2F(putid)(&Ids[1 + Pt * nsiz], &Ids[1 + (Pt - 1) * nsiz]);
00871   Ids[1 + (Pt - 1) * nsiz] = ndel;
00872   Ids[2 + (Pt - 1) * nsiz] = lastindpos;
00873   Rstk[Pt] = 704;
00874   Rhs += 2;
00875   Lhs = 1;
00876   C2F(com).fin = insert;
00877   /*     *call* allops(insert) */
00878   goto L91;
00879  L72:
00880   Lhs = Pstk[Pt];
00881   ndel = Ids[1 + (Pt - 1) * nsiz];
00882   lastindpos = Ids[2 + (Pt - 1) * nsiz];
00883   C2F(putid)(&Ids[1 + (Pt - 1) * nsiz], &Ids[1 + Pt * nsiz]);
00884   --Pt;
00885   /*     store the updated value */
00886   C2F(stackp)(&Ids[1 + Pt * nsiz], &c__0);
00887   if (C2F(iop).err > 0) {
00888     goto L98;
00889   }
00890   if (C2F(errgst).err1 > 0) {
00891     --Pt;
00892     --Lhs;
00893     goto L98;
00894   }
00895   /*     topk points on the newly saved variable */
00896   topk = C2F(com).fin;
00897   /*     remove variable containing the value if required */
00898   if (lastindpos != Top) {
00899     --Top;
00900   }
00901  L73:
00902   /*     print if required */
00903   /* ---------------------- */
00904   if (Lct[4] < 0 || C2F(com).fin == 0) {
00905     goto L76;
00906   }
00907   if (! ((C2F(com).sym != semi && Lct[3] == 0) || (C2F(com).sym == semi && 
00908          Lct[3] == 1))) {
00909     goto L76;
00910   }
00911  L74:
00912   C2F(print)(&Ids[1 + Pt * nsiz], &topk, &C2F(iop).wte);
00913   if (C2F(iop).err > 0) {
00914     goto L98;
00915   }
00916   if (topk == 0) {
00917     goto L76;
00918   }
00919   /*     overloaded display, call a macro */
00920   if (Eptover(1)) {
00921     goto L98;
00922   }
00923   Rstk[Pt] = 708;
00924   Pstk[Pt] = C2F(com).sym;
00925   Ids[1 + Pt * nsiz] = C2F(com).sym;
00926   Ids[2 + Pt * nsiz] = ndel;
00927   Ids[3 + Pt * nsiz] = Lhs;
00928   if (C2F(com).fun == 0) {
00929     goto L88;
00930   }
00931   goto L85;
00932  L75:
00933   C2F(com).sym = Pstk[Pt];
00934   ndel = Ids[2 + Pt * nsiz];
00935   Lhs =  Ids[3 + Pt * nsiz];
00936   --Pt;
00937   goto L74;
00938 
00939  L76:
00940   --Pt;
00941   --Lhs;
00942   if (Lhs > 0) {
00943     goto L71;
00944   }
00945   Top -= ndel;
00946 
00947   /*     finish statement */
00948   /* --------------------- */
00949  L77:
00950   C2F(com).fin = 0;
00951   p = 0;
00952   r = 0;
00953   if (Pt > 0) p = Pstk[Pt];
00954   if (Pt > 0) r = Rstk[Pt];
00955   if (C2F(iop).ddt == 4) {
00956     sprintf(tmp," finish  pt:%d rstk(pt):%d  pstk(pt):%d lpt(1): %d niv: %d macr:%d, paus:%d",
00957             Pt,r,p, Lpt[1],C2F(recu).niv,C2F(recu).macr,C2F(recu).paus);
00958     C2F(basout)(&io, &C2F(iop).wte,tmp, strlen(tmp));
00959   }
00960   if (C2F(errgst).err1 != 0) {
00961     /* a catched error has occured */
00962     if (r == 808) { 
00963       /* in try instructions */
00964       goto L80;
00965     } else if (Ids[1 + (Pt - 1) * nsiz] != 0) {
00966       /* execution is explicitly required to be stopped */
00967       if (r == 502 && Rstk[Pt - 1] == 903) {
00968         /* in an execstr(...,'errcatch') instruction */
00969         goto L88;
00970       } else if (r == 502 && Rstk[Pt - 1] == 909) {
00971         /* in an exec(function,'errcatch') instruction */
00972         goto L88;
00973       } else if (r == 503 && Rstk[Pt - 1] == 902) {
00974         /* in an exec(file,'errcatch') instruction */
00975         goto L88;
00976       }
00977     }
00978     if (C2F(errgst).err2 == 0) {
00979       C2F(errgst).err2 = C2F(errgst).err1;
00980     }
00981     if (C2F(errgst).errcatch == 1) {
00982       /* running under errcatch(num,....) */
00983       C2F(errgst).err1 = 0;
00984       if (Pt<C2F(errgst).errpt) C2F(errgst).errcatch = 0;
00985     }
00986 
00987     imode = (i__2 = C2F(errgst).errct / 100000, abs(i__2));
00988     if (imode - (imode / 8 << 3) == 2) {
00989       C2F(basbrk).iflag = TRUE_;
00990     }
00991   }
00992   C2F(errgst).toperr = Top;
00993   /*     fin instruction */
00994   if (C2F(com).sym != eol) {
00995     if (C2F(com).sym == cmt){
00996       C2F(parsecomment)();}
00997     else
00998       goto L15;
00999   }
01000 
01001   /*     gestion des points d'arrets dynamiques */
01002   if (C2F(dbg).nmacs != 0) { /* there are breakpoints set */
01003     int kfin=C2F(dbg).wmac-1; /*the stack index of the current function*/
01004     /*  first test if the function has breakpoints   */
01005     int kmac;
01006     for (kmac=0;kmac<C2F(dbg).nmacs;kmac++) { /* loop on table of functions containing breakpoints */
01007       /* does the name of the current funtion fit the registered name*/
01008       if (C2F(eqid)(&(C2F(vstk).idstk[kfin * nsiz]), &(C2F(dbg).macnms[kmac * nsiz]))) {/* yes */
01009         /* test if there is a registered breakpoint at the current line*/
01010         i__2 = Lpt[2] - 1;
01011         C2F(whatln)(&Lpt[1], &i__2, &Lpt[6], &nlc, &l1, &ifin);
01012         i__2 = C2F(dbg).lgptrs[kmac+1] - 1;
01013         for (ibpt = C2F(dbg).lgptrs[kmac]; ibpt <= i__2; ++ibpt) {
01014           if (Lct[8] - nlc == C2F(dbg).bptlg[ibpt - 1]) { /* yes */
01015             /* display a message */
01016             C2F(cvname)(&C2F(dbg).macnms[kmac * nsiz], tmp, &c__1, 24L);
01017             sprintf(C2F(cha1).buf,"%s %5d",tmp, Lct[8] - nlc);
01018             Msgs(32, 0);
01019             /* raise the interruption flag */
01020             C2F(basbrk).iflag = TRUE_;
01021             goto L79;
01022           }
01023         }
01024         break;
01025       }
01026     }
01027   }
01028  L79:
01029 
01030   if (C2F(com).comp[0] != 0) {
01031     C2F(seteol)();
01032   }
01033   /*     EOL */
01034   if (r / 100 != 8) {
01035     goto L10;
01036   }
01037   /*     end of an instruction or a clause */
01038   if (C2F(com).comp[0] != 0) {
01039     k = Lpt[6];
01040     if (Lin[k - 1] == eol && Lin[k] == eol) {
01041       SciError(47);
01042       goto L98;
01043     }
01044   }
01045   if (Lpt[4] == Lpt[6]) {
01046     /*         call getlin(1,0) */
01047     goto L13;
01048   } else {
01049     ++Lpt[4];
01050     C2F(getsym)();
01051   }
01052   goto L15;
01053 
01054   /*     simulate recursion */
01055   /* ----------------------- */
01056  L80:
01057   C2F(recu).icall = 0;
01058   C2F(clause)();
01059   if (C2F(iop).err > 0) {
01060     goto L98;
01061   }
01062   switch ((int)C2F(recu).icall) {
01063   case 1:  goto L81;
01064   case 2:  goto L82;
01065   case 3:  goto L83;
01066   case 4:  goto L91;
01067   case 5:  goto L88;
01068   case 6:  goto L90;
01069   case 7:  goto L15;
01070   case 8:  goto L80;
01071   case 9:  goto L85;
01072   }
01073   if (Pt <= 0) {
01074     goto L15;
01075   }
01076   r = Rstk[Pt] / 100;
01077   switch ((int)r) {
01078   case 1:  goto L81;
01079   case 2:  goto L82;
01080   case 3:  goto L83;
01081   case 4:  goto L91;
01082   case 5:  goto L88;
01083   case 6:  goto L90;
01084   case 7:  goto L92;
01085   case 8:  goto L80;
01086   case 9:  goto L85;
01087   }
01088   goto L99;
01089 
01090  L81:
01091   C2F(recu).icall = 0;
01092   C2F(expr)();
01093   if (C2F(iop).err > 0) {
01094     goto L98;
01095   }
01096   switch ((int)C2F(recu).icall) {
01097   case 1:  goto L81;
01098   case 2:  goto L82;
01099   case 3:  goto L83;
01100   case 4:  goto L91;
01101   case 5:  goto L88;
01102   case 6:  goto L90;
01103   case 7:  goto L15;
01104   case 8:  goto L80;
01105   case 9:  goto L85;
01106   }
01107   r = Rstk[Pt] / 100;
01108   switch ((int)r) {
01109   case 1:  goto L81;
01110   case 2:  goto L82;
01111   case 3:  goto L83;
01112   case 4:  goto L91;
01113   case 5:  goto L88;
01114   case 6:  goto L90;
01115   case 7:  goto L92;
01116   case 8:  goto L80;
01117   case 9:  goto L85;
01118   }
01119   goto L99;
01120 
01121  L82:
01122   C2F(recu).icall = 0;
01123   C2F(terme)();
01124   if (C2F(iop).err > 0) {
01125     goto L98;
01126   }
01127   switch ((int)C2F(recu).icall) {
01128   case 1:  goto L81;
01129   case 2:  goto L82;
01130   case 3:  goto L83;
01131   case 4:  goto L91;
01132   case 5:  goto L88;
01133   case 6:  goto L90;
01134   case 7:  goto L15;
01135   case 8:  goto L80;
01136   case 9:  goto L85;
01137   }
01138   r = Rstk[Pt] / 100;
01139   switch ((int)r) {
01140   case 1:  goto L81;
01141   case 2:  goto L82;
01142   case 3:  goto L83;
01143   case 4:  goto L91;
01144   case 5:  goto L88;
01145   case 6:  goto L90;
01146   case 7:  goto L92;
01147   case 8:  goto L80;
01148   case 9:  goto L85;
01149   }
01150   goto L99;
01151 
01152  L83:
01153   C2F(recu).icall = 0;
01154   C2F(fact)();
01155   if (C2F(iop).err > 0) {
01156     goto L98;
01157   }
01158   switch ((int)C2F(recu).icall) {
01159   case 1:  goto L81;
01160   case 2:  goto L82;
01161   case 3:  goto L83;
01162   case 4:  goto L91;
01163   case 5:  goto L88;
01164   case 6:  goto L90;
01165   case 7:  goto L15;
01166   case 8:  goto L80;
01167   case 9:  goto L85;
01168   }
01169   r = Rstk[Pt] / 100;
01170   switch ((int)r) {
01171   case 1:  goto L81;
01172   case 2:  goto L82;
01173   case 3:  goto L83;
01174   case 4:  goto L91;
01175   case 5:  goto L88;
01176   case 6:  goto L90;
01177   case 7:  goto L92;
01178   case 8:  goto L80;
01179   case 9:  goto L85;
01180   }
01181   goto L99;
01182 
01183  L85:
01184   C2F(recu).icall = 0;
01185   if (C2F(com).fun == C2F(recu).krec) {
01186     if (C2F(com).fun > 0) {
01187       SciError(22);
01188       goto L98;
01189     }
01190   }
01191   if (C2F(errgst).err1 != 0) {
01192     if (Rstk[Pt] / 100 == 9) {
01193       if (Rstk[Pt] >= 901 && Rstk[Pt] <= 909) {
01194         /*              *call* matfns */
01195         return 0;
01196       } else {
01197         --Pt;
01198         goto L86;
01199       }
01200     } else {
01201       goto L86;
01202     }
01203   }
01204   /*     compilation matfns: <100*fun rhs lhs fin> */
01205   if (Compil( C2F(com).fun * 100, &(Rhs), Lhs, C2F(com).fin, 0)) {
01206     if (C2F(iop).err > 0) {
01207       goto L98;
01208     }
01209     goto L86;
01210   } else {
01211     /*     *call* matfns */
01212     return 0;
01213   }
01214  L86:
01215   if (C2F(iop).err > 0) {
01216     goto L98;
01217   }
01218   switch ((int)C2F(recu).icall) {
01219   case 1:  goto L81;
01220   case 2:  goto L82;
01221   case 3:  goto L83;
01222   case 4:  goto L91;
01223   case 5:  goto L88;
01224   case 6:  goto L90;
01225   case 7:  goto L15;
01226   case 8:  goto L80;
01227   case 9:  goto L85;
01228   }
01229   r = Rstk[Pt] / 100;
01230   switch ((int)r) {
01231   case 1:  goto L81;
01232   case 2:  goto L82;
01233   case 3:  goto L83;
01234   case 4:  goto L91;
01235   case 5:  goto L88;
01236   case 6:  goto L90;
01237   case 7:  goto L92;
01238   case 8:  goto L80;
01239   case 9:  goto L85;
01240   }
01241   goto L98;
01242 
01243  L88:
01244   C2F(recu).icall = 0;
01245   C2F(macro)();
01246   if (C2F(iop).err > 0) {
01247     goto L98;
01248   }
01249   switch ((int)C2F(recu).icall) {
01250   case 1:  goto L81;
01251   case 2:  goto L82;
01252   case 3:  goto L83;
01253   case 4:  goto L91;
01254   case 5:  goto L88;
01255   case 6:  goto L90;
01256   case 7:  goto L10;
01257   case 8:  goto L80;
01258   case 9:  goto L85;
01259   }
01260   r = Rstk[Pt] / 100;
01261   switch ((int)r) {
01262   case 1:  goto L81;
01263   case 2:  goto L82;
01264   case 3:  goto L83;
01265   case 4:  goto L91;
01266   case 5:  goto L88;
01267   case 6:  goto L90;
01268   case 7:  goto L92;
01269   case 8:  goto L80;
01270   case 9:  goto L85;
01271   case 10:  goto L89;
01272   }
01273   goto L99;
01274  L89:
01275   C2F(com).fun = 99;
01276   return 0;
01277 
01278  L90:
01279   C2F(recu).icall = 0;
01280   C2F(run)();
01281   if (C2F(iop).err > 0) {
01282     goto L98;
01283   }
01284   if (C2F(com).fun == 99) {
01285     return 0;
01286   }
01287   /*     last label is used to handle return from abort */
01288   switch ((int)C2F(recu).icall) {
01289   case 1:  goto L81;
01290   case 2:  goto L82;
01291   case 3:  goto L83;
01292   case 4:  goto L91;
01293   case 5:  goto L88;
01294   case 6:  goto L90;
01295   case 7:  goto L15;
01296   case 8:  goto L80;
01297   case 9:  goto L85;
01298   case 10:  goto L5;
01299   }
01300   r = Rstk[Pt] / 100;
01301   switch ((int)r) {
01302   case 1:  goto L81;
01303   case 2:  goto L82;
01304   case 3:  goto L83;
01305   case 4:  goto L91;
01306   case 5:  goto L88;
01307   case 6:  goto L90;
01308   case 7:  goto L92;
01309   case 8:  goto L80;
01310   case 9:  goto L85;
01311   case 10:  goto L89;
01312   }
01313   goto L99;
01314 
01315  L91:
01316   C2F(recu).icall = 0;
01317   C2F(allops)();
01318   if (C2F(iop).err > 0) {
01319     goto L98;
01320   }
01321   switch ((int)C2F(recu).icall) {
01322   case 1:  goto L81;
01323   case 2:  goto L82;
01324   case 3:  goto L83;
01325   case 4:  goto L91;
01326   case 5:  goto L88;
01327   case 6:  goto L90;
01328   case 7:  goto L15;
01329   case 8:  goto L80;
01330   case 9:  goto L85;
01331   }
01332   r = Rstk[Pt] / 100;
01333   switch ((int)r) {
01334   case 1:  goto L81;
01335   case 2:  goto L82;
01336   case 3:  goto L83;
01337   case 4:  goto L91;
01338   case 5:  goto L88;
01339   case 6:  goto L90;
01340   case 7:  goto L92;
01341   case 8:  goto L80;
01342   case 9:  goto L85;
01343   }
01344   goto L98;
01345 
01346  L92:
01347   switch ((int)(Rstk[Pt] - 700)) {
01348   case 1:  goto L17;
01349   case 2:  goto L35;
01350   case 3:  goto L65;
01351   case 4:  goto L72;
01352   case 5:  goto L65;
01353   case 6:  goto L97;
01354   case 7:  goto L94;
01355   case 8:  goto L75;
01356   case 9:  goto L99;
01357   case 10:  goto L14;
01358   }
01359   goto L99;
01360 
01361  L93:
01362   /*     command like function and macro call */
01363   /*     store ans as lhs */
01364   if (Eptover(1)) {
01365     goto L98;
01366   }
01367   C2F(putid)(&Ids[1 + Pt * nsiz], ans);
01368   Pstk[Pt] = 0;
01369 
01370   Rstk[Pt] = 707;
01371   if (C2F(com).fun > 0) {
01372     /*        *call* matfns */
01373     goto L85;
01374   } else {
01375     if (C2F(com).comp[0] != 0) {
01376       ++Rhs;
01377       C2F(com).fin = extrac;
01378       /*           *call* allops(extrac) */
01379       goto L91;
01380     } else {
01381       C2F(com).fin = Lstk[C2F(com).fin];
01382       /*           *call* macro */
01383       goto L88;
01384     }
01385   }
01386  L94:
01387   /*     go to store code */
01388   goto L70;
01389 
01390  L96:
01391   /*     asynchronous events handling */
01392   C2F(basbrk).interruptible = C2F(getmen)(C2F(cha1).buf, &lb, &nentry) == 0;
01393   C2F(bexec)(C2F(cha1).buf, &lb, &ierr);
01394   if (ierr != 0) {
01395     goto L15;
01396   }
01397   if (Eptover(1)) {
01398     goto L98;
01399   }
01400   Pstk[Pt] = Top;
01401   Rstk[Pt] = 706;
01402   Ids[1 + Pt * nsiz] = iret;
01403   /*     *call* macro */
01404   goto L88;
01405  L97:
01406   Top = Pstk[Pt] - 1;
01407   C2F(basbrk).interruptible = TRUE_;
01408   iret = Ids[1 + Pt * nsiz];
01409   --Pt;
01410   if (iret == 1) {
01411     goto L15;
01412   } else if (iret == 2) {
01413     if (Lpt[6] == Lpt[1]) {
01414       job = 0;
01415     } else {
01416       /* go ahead with interrupted continuation line */
01417       job = 3;
01418     }
01419     C2F(com).sym = eol;
01420     goto L13;
01421   } else if (iret == 3) {
01422     job = 0;
01423     goto L12;
01424   } else if (iret == 4) {
01425     return 0;
01426   }
01427  L98:
01428   C2F(basbrk).interruptible = TRUE_;
01429   /*     error recovery */
01430   /* ------------------- */
01431   imode = abs(C2F(errgst).errct) / 100000;
01432   imode -= imode / 8 << 3;
01433   if (imode == 3) {
01434     C2F(com).fun = 99;
01435     return 0;
01436   }
01437 
01438   /*     error in an external (niv), during compilation (comp) or in a pause */
01439   if (Pt != 0) {
01440     if (Rstk[Pt] == 503 && C2F(iop).rio == C2F(iop).rte) {
01441       C2F(com).comp[0] = 0;
01442       goto L12;
01443     }
01444     if (C2F(errgst).err1 != 0 && Rstk[Pt] == 502) { /* catched error while compiling */
01445       goto L88;
01446     }
01447   }
01448  
01449   if (C2F(recu).niv > 0) { /*     error in an external */
01450     C2F(com).fun = 99;
01451     return 0;
01452   } 
01453   else if (C2F(recu).paus>0) {/*     error in a  pause */
01454     C2F(com).comp[0] = 0;
01455     goto L5;
01456   }
01457   else if (Err>0) {
01458     Pt=0;
01459     C2F(errgst).errct=-1;
01460     C2F(errgst).errpt=0;
01461     C2F(com).comp[0] = 0;
01462     goto L5;
01463   }
01464   else
01465     {
01466       C2F(com).comp[0] = 0;
01467       goto L5;
01468   }
01469 
01470  L99:
01471   SciError(22);
01472   goto L1;
01473 
01474 } /* C2F(parse) */
01475 
01476 
01477 
01478 void handle_onprompt(int *where)
01479 {
01480   /* Initialized data */
01481 
01482   static int onprompt[6] = { 420943928,420878363,673720349,673720360,
01483                                  673720360,673720360 };
01484   static int *Rstk = C2F(recu).rstk-1;
01485   static int *Pstk = C2F(recu).pstk-1;
01486   static int *Lstk = C2F(vstk).lstk-1;
01487 
01488   *where = 0;
01489   if (Pt > 0) {
01490     /* back from %onprompt */
01491     C2F(errgst).errct = Pstk[Pt];
01492     --Pt;
01493     C2F(errgst).err2 = 0;
01494     Top = 0;
01495     C2F(com).fin = 0;
01496     C2F(com).fun = 0;
01497   } 
01498   else {
01499     /* on prompt implicit execution */
01500     C2F(com).fun = 0;
01501     C2F(funs)(onprompt);
01502     if (C2F(iop).err > 0) return;
01503     if (C2F(com).fun <= 0 && C2F(com).fin == 0) return; 
01504     /* %onprompt function exists */
01505     Rhs = 0;
01506     Lhs = 1;
01507     ++Pt;
01508     Pstk[Pt] = C2F(errgst).errct;
01509     Rstk[Pt] = 710;
01510     /* set error catch with mode continue */
01511     C2F(errgst).errct = -100001;
01512     C2F(errgst).errpt = 1;
01513     if (C2F(com).fun > 0) {
01514       /* %onprompt is a primitive *call* matfns */
01515       *where = 1;
01516     } else {
01517       /* %onprompt is a Scilab function *call*  macro */
01518       C2F(com).fin = Lstk[C2F(com).fin];
01519       *where = 2;
01520     }
01521   }
01522 } /* handleonprompt */
01523 
01524 
01525 int C2F(syncexec)(char *str, int *ns, int *ierr, int *seq, long int str_len)
01526 {
01527 
01528   /* Local variables */
01529   int Pts, Tops;
01530   extern int C2F(iset)();
01531   extern int C2F(callinterf)(), C2F(ref2val)();
01532   static int iflagint;
01533   static int k;
01534   static int ir;
01535 
01536   static int *Ids  = C2F(recu).ids-nsiz-1;
01537   static int *Rstk = C2F(recu).rstk-1;
01538   static int *Lstk = C2F(vstk).lstk-1;
01539   static int *Infstk  = C2F(vstk).infstk-1;
01540 
01541   Pt = max(Pt,0);Pts=Pt;
01542   Top = max(Top,0);Tops=Top;
01543   C2F(basbrk).interruptible = *seq != 0;
01544   C2F(bexec)(str, ns, ierr, (*ns));
01545   if (*ierr != 0) {
01546     goto L9998;
01547   }
01548   /* + */
01549   if (Eptover(1)) {
01550     goto L9998;
01551   }
01552   Ids[1 + Pt * nsiz] = Lhs;
01553   Ids[2 + Pt * nsiz] = Rhs;
01554   Ids[3 + Pt * nsiz] = C2F(com).sym;
01555   Rstk[Pt] = 1002;
01556   ++C2F(recu).niv;
01557   C2F(com).fun = 0;
01558   C2F(recu).icall = 5;
01559 
01560   /* code translated from callinterf.h */
01561  L60:
01562 
01563    C2F(parse)();
01564   if (C2F(iop).err > 0) {
01565     goto L9999;
01566   }
01567 
01568   if (C2F(com).fun == 99) {
01569     C2F(com).fun = 0;
01570     goto L200;
01571   }
01572 
01573   if (Rstk[Pt] / 100 == 9) {
01574     ir = Rstk[Pt] - 900;
01575     if (ir == 1) {
01576       /* back to matsys */
01577       k = 13;
01578     } else if (ir >= 2 && ir <= 9) {
01579       /* back to matio */
01580       k = 5;
01581     } else if (ir == 10) {
01582       /* end of overloaded function */
01583       goto L96;
01584     } else if (ir > 40) {
01585       /* back to gw_user2 */
01586       k = 24;
01587     } else if (ir > 20) {
01588       /* back to gw_user */
01589       k = 14;
01590     } else {
01591       goto L89;
01592     }
01593     iflagint = 0;
01594     goto L95;
01595   }
01596 
01597  L89:
01598   if (Top < Rhs) {
01599     SciError(22);
01600     goto L9999;
01601   }
01602   if (Top - Rhs + Lhs + 1 >= C2F(vstk).bot) {
01603     SciError(18);
01604     goto L9999;
01605   }
01606   goto L91;
01607 
01608  L90:
01609   if (C2F(iop).err > 0) {
01610     goto L9999;
01611   }
01612  L91:
01613   k = C2F(com).fun;
01614   C2F(com).fun = 0;
01615   if (k == C2F(recu).krec) {
01616     C2F(recu).krec = -1;
01617     SciError(22);
01618     goto L9999;
01619   }
01620   C2F(recu).krec = -1;
01621   if (k == 0) {
01622     goto L60;
01623   }
01624  L95:
01625   if (! C2F(allowptr)(&k)) {
01626     C2F(ref2val)();
01627   }
01628   C2F(recu).krec = k;
01629   C2F(callinterf)(&k, &iflagint);
01630   /*      if (k.eq.krec) krec=99999 */
01631   C2F(recu).krec = -1;
01632   if (C2F(com).fun >= 0) {
01633     if (Top - Lhs + 1 > 0) {
01634       C2F(iset)(&Rhs, &c__0, &Infstk[Top - Lhs+1], &c__1);
01635     }
01636     goto L90;
01637   }
01638   /*     called interface ask for a scilab function to perform the function (fun=-1) */
01639   /*     the function name is given in ids(1,pt+1) */
01640   C2F(ref2val)();
01641   C2F(com).fun = 0;
01642   C2F(funs)(&Ids[1 + (Pt + 1) * nsiz]);
01643   if (C2F(iop).err > 0) {
01644     goto L9999;
01645   }
01646   if (C2F(com).fun > 0) {
01647     goto L91;
01648   }
01649   if (C2F(com).fin == 0) {
01650     SciError(246);
01651     if (C2F(iop).err > 0) {
01652       goto L9999;
01653     }
01654     goto L90;
01655   }
01656   ++Pt;
01657   C2F(com).fin = Lstk[C2F(com).fin];
01658   Rstk[Pt] = 910;
01659   C2F(recu).icall = 5;
01660   C2F(com).fun = 0;
01661   /*     *call*  macro */
01662   goto L60;
01663  L96:
01664   --Pt;
01665   goto L90;
01666   /* End of callinterf.h code */
01667 
01668  L200:
01669   Lhs = Ids[1 + Pt * nsiz];
01670   Rhs = Ids[2 + Pt * nsiz];
01671   C2F(com).sym = Ids[3 + Pt * nsiz];
01672   --Pt;
01673   --Top;
01674   /* + */
01675   --C2F(recu).niv;
01676   *ierr = 0;
01677   C2F(recu).icall = 0;
01678   C2F(com).fin = 3;
01679   C2F(basbrk).interruptible = TRUE_;
01680   return 0;
01681  L9998:
01682   *ierr = 1;
01683   Pt=Pts;Top=Tops;
01684   C2F(basbrk).interruptible = TRUE_;
01685 
01686   return 0;
01687  L9999:
01688   /* Err == 9999999 arises if abort has been used to terminate the callback execution */
01689   if (Err != 9999999) *ierr = 1;
01690   --Top;
01691   --C2F(recu).niv;
01692   Pt=Pts;Top=Tops;
01693   C2F(basbrk).interruptible = TRUE_;
01694   return 0;
01695 } /* syncexec */
01696 
01697 
01698 void C2F(parsecomment)()
01699 /*     Copyright INRIA */
01700 
01701 {
01702 
01703   static int *Lstk    = C2F(vstk).lstk-1;
01704   static int *Lin     = C2F(iop).lin-1;
01705   static int *Lpt     = C2F(iop).lpt-1;
01706   static int *Comp    = C2F(com).comp-1;
01707   static int *Istk    = (int *)( C2F(stack).Stk)-1;
01708 
01709 
01710   static integer l, ll, lkp, l0,c1=1;
01711   /* look for eol */
01712   l0=Lpt[4]-1;
01713   if( (Lin[l0]==slash) &&(Lin[l0-1]==slash)&(Lin[l0+1]==eol)) /* Correction Warning */
01714     l0=l0+1;
01715     
01716   l=l0;
01717   while (Lin[l]!=eol) l++;
01718   ll = l - l0;
01719   if (Comp[1] == 0) {
01720     /* ignore all characters up to the end */
01721   } 
01722   else {
01723     /* compilation [30 number-of-char chars-vector] */
01724     lkp = C2F(com).comp[0];
01725     C2F(iop).err = (lkp + 2 + ll) / 2 + 1 - Lstk[C2F(vstk).bot];
01726     if (C2F(iop).err > 0) {
01727       SciError(17);
01728       return ;
01729     }
01730     Istk[lkp] = 31;
01731     Istk[lkp+1] = ll;
01732     C2F(icopy)(&ll, &(Lin[l0]), &c1, &(Istk[lkp+2]), &c1);
01733     Comp[1] = lkp + 2 + ll;
01734   }
01735   Lpt[4] = l;
01736   C2F(com).char1 = eol;
01737   C2F(com).sym = eol;
01738   return ;
01739 } /* parsecomment */
01740 
01741 

Generated on Sun Mar 4 15:03:46 2007 for Scilab [trunk] by  doxygen 1.5.1