intmacr2tree.h File Reference

#include <string.h>
#include <stdio.h>
#include <math.h>
#include "machine.h"
#include "stack-c.h"
#include "Funtab.h"

Include dependency graph for intmacr2tree.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define idstk(x, y)   (C2F(vstk).idstk+(x-1)+(y-1)*nsiz)
#define CvNameL(id, str, jobptr, str_len)   C2F(cvnamel)(id,str,jobptr,str_len);
#define CvStr(n, line, str, jobptr, str_len)   C2F(cvstr)(n,line,str,jobptr,str_len);

Functions

void str2sci (char **x, int n, int m)
void C2F() itosci (int *intptr, int *nbrows, int *nbcols)
void C2F() dtosci (double *dbleptr, int *nbrows, int *nbcols)
int C2F() cvnamel (int *id, char *str, int *jobptr, int *str_len)
int C2F() mklist (int *nbitems)
int C2F() mktlist (int *nbitems)
int C2F (macr2tree) _PARAMS((char *fname
static int CreateVariableTList (char **varname)
static int CreateEOLList (void)
static int AddVar (char *name)
static int IsDefinedVar (char *name)
static int GetInstruction (int *data, int *index, int *nblines, int *addinstr)
static int GetControlInstruction (int *data, int *index, int *nblines)
static int CreateCsteTList (char *type, int *data, int *index)
static int CreateOperationTList (int *data, int *index)
static int CreateFuncallTList (char *fromwhat, int *data, int *index)
static int CreateEqualTList (char *fromwhat, int *data, int *index)
static int CreateCommentTList (int *data, int *index)
static int CreateRecursiveIndexList (int *data, int *index)
static int VCopyObj (char *fname, int *orig, int *dest, unsigned long fname_length)
int complexity (int *data, int *index, int *lgth)

Variables

int unsigned long fname_len


Define Documentation

#define CvNameL ( id,
str,
jobptr,
str_len   )     C2F(cvnamel)(id,str,jobptr,str_len);

Definition at line 40 of file intmacr2tree.h.

Referenced by C2F(), CreateCsteTList(), CreateEqualTList(), CreateFuncallTList(), GetControlInstruction(), and GetInstruction().

#define CvStr ( n,
line,
str,
jobptr,
str_len   )     C2F(cvstr)(n,line,str,jobptr,str_len);

Definition at line 41 of file intmacr2tree.h.

Referenced by CreateCommentTList(), and CreateCsteTList().

#define idstk ( x,
y   )     (C2F(vstk).idstk+(x-1)+(y-1)*nsiz)

Definition at line 39 of file intmacr2tree.h.

Referenced by C2F(), parse(), and run().


Function Documentation

static int AddVar ( char *  name  )  [static]

Referenced by CreateVariableTList().

Here is the caller graph for this function:

int C2F ( macr2tree   ) 

int complexity ( int data,
int index,
int lgth 
)

Definition at line 1802 of file intmacr2tree.c.

References count, nsiz, and sciprint().

Referenced by C2F().

01803 {
01804   int count = 0;
01805   
01806   int cur_ind = *index2+1;
01807 
01808   int last_eol=0;
01809 
01810   int nbop = 0; /* Number of value stored on stack */
01811 
01812   while(cur_ind<=*lgth+*index2)
01813     {
01814       switch(data[cur_ind])
01815         {
01816         case 0: /* Deleted operation */
01817           cur_ind = cur_ind + data[cur_ind+1] + 1;
01818           break;
01819         case 1: /* Stack put (Obsolete) */
01820           cur_ind = cur_ind + nsiz + 1;
01821           count++;
01822           break;
01823         case 2: /* Stack get */
01824           cur_ind = cur_ind + nsiz + 3;
01825           nbop++;
01826           break;
01827         case 3: /* String */
01828           cur_ind = cur_ind + 2 + data[cur_ind+1];
01829           nbop++;
01830           break;
01831         case 4: /* Empty matrix */
01832           cur_ind++;
01833           nbop++;
01834           break;
01835         case 5: /* Operations */
01836           if( (data[cur_ind+1]==4) && (last_eol==nbop-2) ) /* rc with a EOL */
01837             {
01838               nbop--;
01839               count--;
01840             }
01841           nbop = nbop - data[cur_ind+2];
01842           cur_ind = cur_ind + 4;
01843           nbop++;
01844           break;
01845         case 6: /* Number */
01846           cur_ind = cur_ind + 3;
01847           nbop++;
01848           break;
01849         case 7: /* 'for' control instruction */
01850           cur_ind = cur_ind + data[cur_ind+1] + 2;
01851           cur_ind = cur_ind + 1 + nsiz + data[cur_ind];
01852           count++;
01853           break;
01854         case 8: /* 'if-then-else' control instruction */
01855           if(data[cur_ind+1]>0)
01856             {
01857               cur_ind = cur_ind + 2;
01858               cur_ind = cur_ind + 3 + data[cur_ind] + data[cur_ind+1] + data[cur_ind+2];
01859             }
01860           else
01861             {
01862               cur_ind = cur_ind - data[cur_ind+1];
01863             }
01864           count++;
01865           break;
01866         case 9: /* 'while' control instruction */
01867           if(data[cur_ind+1]>0)
01868             {
01869               cur_ind = cur_ind + 2;
01870               cur_ind = cur_ind + 3 + data[cur_ind] + data[cur_ind+1] + data[cur_ind+2];
01871             }
01872           else
01873             {
01874               cur_ind = cur_ind - data[cur_ind+1];
01875             }
01876           count++;
01877           break;
01878         case 10: /* 'select-case' control instruction */
01879           cur_ind = cur_ind + data[cur_ind+1];
01880           count++;
01881           break;
01882         case 11: /* 'try-catch' control instruction */
01883           cur_ind = cur_ind + data[cur_ind+1] + data[cur_ind+2] + 3;
01884           count++;
01885           break;
01886         case 12: /* pause */
01887           cur_ind++;
01888           count++;
01889           break;
01890         case 13: /* break */
01891           cur_ind++;
01892           count++;
01893           break;
01894         case 14: /* abort */
01895           cur_ind++;
01896           count++;
01897           break;
01898         case 15: /* EOL */
01899           cur_ind++;
01900           last_eol = nbop;
01901           nbop++;
01902           count++;
01903           break;
01904         case 16: /* Set line number */
01905           cur_ind = cur_ind + 2;
01906           break;
01907         case 17: /* quit (Should never append) */
01908           cur_ind++;
01909           count++;
01910           break;
01911         case 18: /* Mark named variable */
01912           cur_ind = cur_ind + 1 + nsiz;
01913           break;
01914         case 19: /* Form recursive index2 list */
01915           nbop = nbop - data[cur_ind+1] + 1;
01916           cur_ind = cur_ind + 3;
01917           break;
01918         case 20: /* exit */
01919           cur_ind++;
01920           count++;
01921           break;
01922         case 21: /* Beginning of rhs */
01923           cur_ind = cur_ind + 1;
01924           break;
01925         case 22: /* Set print mode (ignored ?) */
01926           cur_ind = cur_ind + 2;
01927           break;
01928         case 23: /* Create variable from name */
01929           cur_ind = cur_ind + 1 + nsiz;
01930           nbop++;
01931           break;
01932         case 24: /* Create an object with type 0 */
01933           cur_ind = cur_ind + 1;
01934           break;
01935         case 25: /* Compute profiling data */
01936           cur_ind = cur_ind + 3;
01937           break;
01938         case 26: /* Vector of strings */
01939           cur_ind = cur_ind + 5 + data[cur_ind+1]*data[cur_ind+2] + data[cur_ind+4+data[cur_ind+1]*data[cur_ind+2]] - 1;
01940           break;
01941         case 27: /* varfunptr ??? */
01942           cur_ind = cur_ind + 3 + nsiz;
01943           break;
01944         case 28: /* continue */
01945           cur_ind++;
01946           count++;
01947           break;
01948         case 29: /* Affectation */
01949           nbop = 0;
01950           cur_ind = cur_ind + 2 + (data[cur_ind+1])*(nsiz+1) + 1;
01951           count++;
01952           break;
01953         case 30: /* Expression evaluation short circuiting */
01954           /* This code is ignored */
01955           cur_ind = cur_ind + 3;
01956           break;
01957         case 31: /* comment */
01958           cur_ind = cur_ind + 2 + data[cur_ind+1];
01959           count++;
01960           break;
01961         case 99: /* return */
01962           cur_ind++;
01963           count++;
01964           break;
01965         default:
01966           if(data[cur_ind]/100*100==data[cur_ind])
01967             {
01968               cur_ind = cur_ind + 4;
01969             }
01970           else
01971             {
01972               sciprint("complexity: wrong code %d\r\n",data[cur_ind]);
01973               return -1;
01974             }
01975           break;
01976         }
01977     }
01978   return count;
01979   
01980 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int CreateCommentTList ( int data,
int index 
) [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int CreateCsteTList ( char *  type,
int data,
int index 
) [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int CreateEOLList ( void   )  [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int CreateEqualTList ( char *  fromwhat,
int data,
int index 
) [static]

Referenced by GetControlInstruction(), and GetInstruction().

Here is the caller graph for this function:

static int CreateFuncallTList ( char *  fromwhat,
int data,
int index 
) [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int CreateOperationTList ( int data,
int index 
) [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int CreateRecursiveIndexList ( int data,
int index 
) [static]

static int CreateVariableTList ( char **  varname  )  [static]

Referenced by C2F(), CreateEqualTList(), GetControlInstruction(), and GetInstruction().

Here is the caller graph for this function:

int C2F() cvnamel ( int id,
char *  str,
int jobptr,
int str_len 
)

void C2F() dtosci ( double *  dbleptr,
int nbrows,
int nbcols 
)

Referenced by CreateCsteTList(), CreateFuncallTList(), sciblk2(), and sciblk2i().

Here is the caller graph for this function:

static int GetControlInstruction ( int data,
int index,
int nblines 
) [static]

Referenced by GetInstruction().

Here is the caller graph for this function:

static int GetInstruction ( int data,
int index,
int nblines,
int addinstr 
) [static]

Referenced by C2F(), and GetControlInstruction().

Here is the caller graph for this function:

static int IsDefinedVar ( char *  name  )  [static]

Referenced by AddVar(), and GetInstruction().

Here is the caller graph for this function:

void C2F() itosci ( int intptr,
int nbrows,
int nbcols 
)

Referenced by C2F(), sciblk2(), and sciblk2i().

Here is the caller graph for this function:

int C2F() mklist ( int nbitems  ) 

int C2F() mktlist ( int nbitems  ) 

Referenced by C2F(), createblklist(), CreateCommentTList(), CreateCsteTList(), CreateEqualTList(), CreateFuncallTList(), CreateOperationTList(), CreateVariableTList(), GetControlInstruction(), and intgetscicosvarsc().

Here is the caller graph for this function:

void str2sci ( char **  x,
int  n,
int  m 
)

Definition at line 6 of file str2sci.c.

Referenced by C2F(), createblklist(), CreateCommentTList(), CreateCsteTList(), CreateEOLList(), CreateEqualTList(), CreateFuncallTList(), CreateOperationTList(), CreateVariableTList(), GetControlInstruction(), and intgetscicosvarsc().

00007 {
00008       
00009   int l=0,il=0,zero=0,err,n1,i,m1=0;
00010       
00011   if (Top >= Bot) {
00012     i=18;
00013     C2F(error)(&i);
00014   } else {
00015     Top = Top + 1;
00016     il = iadr(*Lstk(Top));
00017     l = sadr(il+6);
00018   }
00019   
00020   err = l + n*m - *Lstk(Bot);
00021   if (err > 0) {
00022     i=17;
00023     C2F(error)(&i);
00024     return;
00025   }
00026   *istk(il) = 10;
00027   *istk(il+1) = n;
00028   *istk(il+2) = m;
00029   *istk(il+3) = 0;
00030   *istk(il+4) = 1;
00031   for (i = 1; i <= n*m; i++){
00032           n1=strlen(x[i-1]);
00033           *istk(il+4+i) =  *istk(il+4+i-1)+n1;
00034           if (n1 > 0) 
00035                   C2F(cvstr)(&n1,istk(il+m*n+5 -1 + *istk(il+3+i)),x[i-1],&zero,(unsigned long) n1);
00036           m1=m1+n1;
00037   }
00038   *Lstk(Top+1) = l + m1;      
00039                 
00040 } 

Here is the caller graph for this function:

static int VCopyObj ( char *  fname,
int orig,
int dest,
unsigned long  fname_length 
) [static]

Referenced by CreateEqualTList(), CreateFuncallTList(), and CreateOperationTList().

Here is the caller graph for this function:


Variable Documentation

int unsigned long fname_len

Definition at line 69 of file intmacr2tree.h.


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