scirun.c File Reference

#include "stack-c.h"
#include "scirun.h"

Include dependency graph for scirun.c:

Go to the source code of this file.

Functions

int C2F() allowptr (int *)
int C2F() callinterf (int *, int *)
int C2F() iset (int *, int *, int *, int *)
int C2F() funs (int *)
int C2F() parse (void)
int C2F() error (int *)
int C2F() ref2val (void)
int C2F() isbyref (int *)
static void str_copy_buf (register char *a, register char *b, long int la, long int lb)
int C2F() scirun (char *bu1, long int bu1_len)


Function Documentation

int C2F() allowptr ( int  ) 

Referenced by scibuiltin(), scifunction(), scirun(), and syncexec().

Here is the caller graph for this function:

int C2F() callinterf ( int ,
int  
)

Definition at line 91 of file callinterf.c.

References C2F, controlC_handler(), count, DynInterfStart, Interfaces, jmp_env, sci_sigint_addinter(), sig_ok, and userlk().

Referenced by scibuiltin(), scifunction(), scirun(), and syncexec().

00092 {
00093   int returned_from_longjump ;
00094   static int count = 0;
00095   if ( count == 0) 
00096     {
00097       if (sig_ok) signal(SIGINT,sci_sigint_addinter);
00098       if (( returned_from_longjump = setjmp(jmp_env)) != 0 )
00099         {
00100           if (sig_ok) signal(SIGINT, controlC_handler);
00101           Scierror(999,"SIGSTP: aborting current computation\r\n");
00102           count = 0;
00103           return 0;
00104         }
00105     }
00106   count++;
00107   if (*k > DynInterfStart) 
00108     C2F(userlk)(k);
00109   else
00110     (*(Interfaces[*k-1].fonc))();
00111   count--;
00112   if (count == 0) { 
00113     if (sig_ok) signal(SIGINT, controlC_handler);
00114   }
00115   return 0;
00116 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() error ( int  ) 

int C2F() funs ( int  ) 

int C2F() isbyref ( int  ) 

Referenced by scirun().

Here is the caller graph for this function:

int C2F() iset ( int ,
int ,
int ,
int  
)

Referenced by cossim(), cossimdaskr(), scibuiltin(), scifunction(), scirun(), and syncexec().

Here is the caller graph for this function:

int C2F() parse ( void   ) 

Definition at line 128 of file parse.c.

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) */

int C2F() ref2val ( void   ) 

int C2F() scirun ( char *  bu1,
long int  bu1_len 
)

Run scilab parser with initial instruction

Parameters:
bu1 : character string which contains the initial instruction
bu1_len : length of bu1

Definition at line 19 of file scirun.c.

References allowptr(), Bot, bsiz, C2F, callinterf(), cha1_, cx0, cx1, Err, err1, error, Fin, fun, funs(), ir, isbyref(), iset(), krec, Lhs, Max, niv, parse(), paus, pt, ref2val(), Rhs, rstk, str_copy_buf(), and Top.

Referenced by Initialize(), realmain(), ScilabDoOneEvent(), SendScilabJob(), StartScilab(), TerminateCorePart1(), and VTRun().

00020 {
00021     static int iflagint = 0;
00022         static int k = 0;
00023         static int ir = 0;
00024 
00025         /* set instruction to execute at start-up */
00026 
00027         str_copy_buf(cha1_.buf, bu1, bsiz, bu1_len);
00028     C2F(iop).rio = -1;
00029     C2F(iop).lpt[0] = 1;
00030     C2F(iop).lpt[5] = 0;
00031     C2F(recu).pt = 0;
00032 
00033     C2F(recu).icall = 0;
00034     C2F(recu).krec = 99999;
00035 
00036         /* call instructions parser */
00037 
00038 L60:
00039     C2F(parse)();
00040     if (C2F(com).fun == 99) 
00041         {
00042                 C2F(com).fun = 0;
00043                 return 0;
00044     }
00045     if (Err > 0) 
00046         {
00047                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00048                 goto L60;
00049     }
00050 
00051     if (C2F(recu).rstk[C2F(recu).pt - 1] / 100 == 9) 
00052         {
00053                 ir = C2F(recu).rstk[C2F(recu).pt - 1] - 900;
00054 
00055                 if (ir == 1) 
00056                 {
00057                         /* back to gw_core */
00058                         k = 13;
00059                 } 
00060                 else if (ir >= 2 && ir <= 9) 
00061                 {
00062                         /* back to gw_io */
00063                         k = 5;
00064                 }
00065                 else if (ir == 10) 
00066                 {
00067                         /* end of overloaded function */
00068                         --C2F(recu).pt;
00069                         goto L90;
00070                 }
00071                 else if (ir > 40) 
00072                 {
00073                         /* back to gw_user2 */
00074                         k = 24;
00075                 }
00076                 else if (ir > 20) 
00077                 {
00078                         /* back to gw_user */
00079                         k = 14;
00080                 }
00081                 else
00082                 {
00083                         goto L89;
00084                 }
00085                 iflagint = 0;
00086                 goto L95;
00087     }
00088 
00089 L89:
00090     if (Top < Rhs) 
00091         {
00092                 int code_error=22;
00093                 C2F(error)(&code_error);
00094                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00095                 goto L60;
00096     }
00097     if (Top - Rhs + Lhs + 1 >= Bot) 
00098         {
00099                 int code_error=18;
00100                 C2F(error)(&code_error);
00101                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00102                 goto L60;
00103     }
00104     C2F(errgst).toperr = Top - Max(0,Rhs);
00105     goto L91;
00106 
00107 L90:
00108     if (Err > 0) 
00109         {
00110                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00111                 goto L60;
00112     }
00113 L91:
00114     k = C2F(com).fun;
00115     C2F(com).fun = 0;
00116     if (k == C2F(recu).krec) 
00117         {
00118                 int code_error=22;
00119                 C2F(recu).krec = -1;
00120                 C2F(error)(&code_error);
00121                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00122                 goto L60;
00123     }
00124     C2F(recu).krec = -1;
00125     if (k == 0) goto L60;
00126     
00127 L95:
00128     if (! C2F(allowptr)(&k)) 
00129         {
00130                 C2F(ref2val)();
00131     }
00132     C2F(recu).krec = k;
00133     C2F(callinterf)(&k, &iflagint);
00134     C2F(recu).krec = -1;
00135     if (C2F(com).fun >= 0) 
00136         {
00137                 if (Top - Lhs + 1 > 0) 
00138                 {
00139                         int cx0=0;
00140                         int cx1=0;
00141                         C2F(iset)(&Rhs, &cx0, &C2F(vstk).infstk[Top - Lhs], &cx1);
00142                 }
00143                 if (C2F(recu).paus > 0) 
00144                 {
00145                         goto L91;
00146                 }
00147                 if (C2F(errgst).err1 > 0) 
00148                 {
00149                         Top = C2F(errgst).toperr;
00150                 }
00151                 goto L90;
00152         }
00153 
00154         /*
00155         called interface ask for a scilab function to perform the function (fun=-1)
00156         the function name is given in ids(1,pt+1)
00157         call ref2val removed here because if forces overloading function to
00158         be called by value
00159         call ref2val
00160         */
00161     C2F(com).fun = 0;
00162     C2F(funs)(&C2F(recu).ids[(C2F(recu).pt + 1) * 6 - 6]);
00163     if (C2F(iop).err > 0) 
00164         {
00165                 if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00166                 goto L60;
00167     }
00168     if (C2F(com).fun > 0) 
00169         {
00170                 if (C2F(isbyref)(&C2F(com).fun) == 0) 
00171                 {
00172             C2F(ref2val)();
00173                 }
00174                 goto L91;
00175     }
00176 
00177     if (Fin == 0) 
00178         {
00179                 int code_error=246;
00180                 C2F(error)(&code_error);
00181                 if (Err > 0) 
00182                 {
00183                         if (C2F(recu).niv > 0 && C2F(recu).paus > 0) C2F(com).fun = 0;
00184                         goto L60;
00185                 }
00186                 goto L90;
00187     }
00188     ++C2F(recu).pt;
00189     Fin = C2F(vstk).lstk[Fin - 1];
00190     C2F(recu).rstk[C2F(recu).pt - 1] = 910;
00191     C2F(recu).icall = 5;
00192     C2F(com).fun = 0;
00193         /* *call*  macro */
00194     goto L60;
00195 
00196     return 0;
00197 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void str_copy_buf ( register char *  a,
register char *  b,
long int  la,
long int  lb 
) [static]

Definition at line 199 of file scirun.c.

References i.

Referenced by scirun().

00200 {
00201         if (lb>la) strncpy(a,b,la);
00202         else 
00203         {
00204                 int i=0;
00205                 strncpy(a,b,lb);
00206                 for (i=lb;i<la;i++) a[i]= ' ';
00207         }
00208 }

Here is the caller graph for this function:


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