stack2.c File Reference

#include <string.h>
#include <stdio.h>
#include "MALLOC.h"
#include "stack-c.h"
#include "sciprint.h"
#include "stack2.h"
#include "../../../string/includes/men_Sutils.h"

Include dependency graph for stack2.c:

Go to the source code of this file.

Data Structures

struct  inter_s_
struct  inter_l

Typedefs

typedef inter_s_ intersci_state
typedef inter_l intersci_list

Functions

static char *Get_Iname __PARAMS ((void))
static int C2F (mvfromto)
int C2F() checklhs (char *fname, integer *iMin, integer *iMax, unsigned long fname_len)
int C2F() isopt (integer *k, char *namex, unsigned long name_len)
int C2F() isoptlw (integer *topk, integer *lw, char *namex, unsigned long name_len)
integer C2F() firstopt ()
int C2F() findopt (char *str, rhs_opts opts[])
integer C2F() numopt ()
integer C2F() vartype (integer *number)
integer C2F() gettype (integer *lw)
integer C2F() overloadtype (integer *lw, char *fname, char *typ)
integer C2F() overload (integer *lw, char *fname, unsigned long l)
integer C2F() ogettype (integer *lw)
int get_optionals (char *fname, rhs_opts opts[])
int rhs_opt_find (char *name, rhs_opts opts[])
void rhs_opt_print_names (rhs_opts opts[])
int IsRef (int number)
int C2F() isref (integer *number)
int C2F() createvar (integer *lw, char *typex, integer *m, integer *n, integer *lr, unsigned long type_len)
int C2F() createcvar (integer *lw, char *typex, integer *it, integer *m, integer *n, integer *lr, integer *lc, unsigned long type_len)
int C2F() createlist (integer *lw, integer *nel)
int C2F() createvarfrom (integer *lw, char *typex, integer *m, integer *n, integer *lr, integer *lar, unsigned long type_len)
int C2F() createcvarfrom (integer *lw, char *typex, integer *it, integer *m, integer *n, integer *lr, integer *lc, integer *lar, integer *lac, unsigned long type_len)
int C2F() createlistvarfrom (integer *lnumber, integer *number, char *typex, integer *m, integer *n, integer *lr, integer *lar, unsigned long type_len)
int C2F() createlistcvarfrom (integer *lnumber, integer *number, char *typex, integer *it, integer *m, integer *n, integer *lr, integer *lc, integer *lar, integer *lac, unsigned long type_len)
int C2F() createlistvarfromptr (integer *lnumber, integer *number, char *typex, integer *m, integer *n, void *iptr, unsigned long type_len)
int C2F() createlistcvarfromptr (integer *lnumber, integer *number, char *typex, integer *it, integer *m, integer *n, void *iptr, void *iptc, unsigned long type_len)
int C2F() creatework (integer *number, integer *m, integer *lr)
int C2F() setworksize (integer *number, integer *size)
int C2F() getmatdims (integer *number, integer *m, integer *n)
int C2F() getrhsvar (integer *number, char *typex, integer *m, integer *n, integer *lr, unsigned long type_len)
int C2F() getrhscvar (integer *number, char *typex, integer *it, integer *m, integer *n, integer *lr, integer *lc, unsigned long type_len)
int C2F() elementtype (integer *lnumber, integer *number)
int C2F() getlistrhsvar (integer *lnumber, integer *number, char *typex, integer *m, integer *n, integer *lr, unsigned long type_len)
int C2F() getlistrhscvar (integer *lnumber, integer *number, char *typex, integer *it, integer *m, integer *n, integer *lr, integer *lc, unsigned long type_len)
int C2F() createvarfromptr (integer *number, char *typex, integer *m, integer *n, void *iptr, unsigned long type_len)
int C2F() createcvarfromptr (integer *number, char *typex, integer *it, integer *m, integer *n, double *iptr, double *iptc, unsigned long type_len)
int C2F() mklistfromvars (integer *pos, integer *n)
int C2F() mktlistfromvars (integer *pos, integer *n)
int C2F() mkmlistfromvars (integer *pos, integer *n)
int C2F() callscifun (char *string, unsigned long string_len)
int C2F() scifunction (integer *number, integer *ptr, integer *mlhs, integer *mrhs)
int C2F() scistring (integer *ifirst, char *thestring, integer *mlhs, integer *mrhs, unsigned long thestring_len)
integer C2F() getopcode (char *string, unsigned long string_len)
int C2F() scibuiltin (integer *number, integer *ifun, integer *ifin, integer *mlhs, integer *mrhs)
int C2F() sciops (integer *number, integer *op, integer *mlhs, integer *mrhs)
int C2F() getrhssys (integer *lw, integer *n, integer *m, integer *p, integer *ptra, integer *ptrb, integer *ptrc, integer *ptrd, integer *ptrx0, double *hx)
int C2F() errorinfo (char *fname, integer *info, unsigned long fname_len)
integer C2F() maxvol (integer *lw, char *lw_type, unsigned long type_len)
static int Check_references ()
int C2F() putlhsvar ()
static int C2F() mvfromto (integer *itopl, integer *ix)
int Ref2val (int from, int to)
int C2F() convert2sci (integer *ix)
void strcpy_tws (char *str1, char *str2, int len)
int C2F() in2str (integer *n, integer *line, char *str, unsigned long str_len)
static char * Get_Iname ()
char * ArgPosition (int i)
char * ArgsPosition (int i, int j)
void ConvertData (char *type, int size, int l)
static int check_prop (char *mes, int posi, int m)
int check_square (int posi, int m, int n)
int check_vector (int posi, int m, int n)
int check_row (int posi, int m, int n)
int check_col (int posi, int m, int n)
int check_scalar (int posi, int m, int n)
int check_dims (int posi, int m, int n, int m1, int n1)
int check_one_dim (int posi, int dim, int val, int valref)
int check_length (int posi, int m, int m1)
int check_same_dims (int i, int j, int m1, int n1, int m2, int n2)
int check_dim_prop (int i, int j, int flag)
static int check_list_prop (char *mes, int lpos, int posi, int m)
int check_list_square __PARAMS ((int lpos, int posi, int m, int n))
int check_list_vector (int lpos, int posi, int m, int n)
int check_list_row (int lpos, int posi, int m, int n)
int check_list_col (int lpos, int posi, int m, int n)
int check_list_scalar (int lpos, int posi, int m, int n)
int check_list_one_dim (int lpos, int posi, int dim, int val, int valref)
int C2F() createdata (integer *lw, integer n)
int C2F() copyvarfromsciptr (integer lw, integer n, integer l)
void * GetData (int lw)
int GetDataSize (int lw)
void * GetRawData (int lw)
void * GetDataFromName (char *name)
int C2F() createreference (int number, int pointed)
int C2F() changetoref (int number, int pointed)
int C2F() createreffromname (int number, char *name)
static int intersci_push (void)
static void intersci_pop (void)

Variables

static integer cx1 = 1
static integer cx0 = 0
static char Fname [nlgh+1]
static char * pos [] = {"first","second","third","fourth"}
static char arg_position [56]
static intersci_listL_intersci


Typedef Documentation

typedef struct inter_l intersci_list

typedef struct inter_s_ intersci_state


Function Documentation

int check_list_square __PARAMS ( (int lpos, int posi, int m, int n  ) 

Definition at line 2998 of file stack2.c.

References check_list_prop().

02999 {
03000   return check_list_prop("square",lpos,posi, (m != n));
03001 }

Here is the call graph for this function:

static char* Get_Iname __PARAMS ( (void)   )  [static]

char* ArgPosition ( int  i  ) 

Definition at line 2810 of file stack2.c.

Referenced by check_dims(), check_length(), check_list_prop(), check_one_dim(), and check_prop().

02811 {
02812   if ( i > 0 && i <= 4 ) 
02813     sprintf(arg_position,"%s argument",pos[i-1]);
02814   else 
02815     sprintf(arg_position,"argument number %d",i);
02816   return arg_position;
02817 }

Here is the caller graph for this function:

char* ArgsPosition ( int  i,
int  j 
)

Definition at line 2819 of file stack2.c.

Referenced by check_dim_prop(), and check_same_dims().

02820 {
02821   if ( i > 0 && i <= 4 ) 
02822     {
02823       if ( j > 0 && j <= 4 ) 
02824         sprintf(arg_position,"%s and %s arguments",pos[i-1],pos[j-1]);
02825       else 
02826         sprintf(arg_position,"%s argument and argument %d",pos[i-1],j);
02827     }
02828   else 
02829     {
02830       if ( j > 0 && j <= 4 ) 
02831         sprintf(arg_position,"%s argument and argument %d",pos[j-1],i);
02832       else 
02833         sprintf(arg_position,"arguments %d and %d",i,j);
02834     }
02835   return arg_position;
02836 }

Here is the caller graph for this function:

static int C2F ( mvfromto   )  [static]

Definition at line 30 of file stack2.c.

References C2F, cvname(), cx0, FALSE_, get_fname(), nsiz, and TRUE_.

00043            : checks right hand side arguments 
00044  *-----------------------------------------------*/
00045 
00046 int C2F(checkrhs)(char *fname, integer *iMin, integer *iMax, unsigned long  fname_len)
00047 {
00048   /*
00049    * store the name in recu array, fname can be a non null terminated char array  
00050    * Get_Iname() can be used in other function to get the interface name 
00051    */
00052 
00053   C2F(cvname)(&C2F(recu).ids[(C2F(recu).pt + 1) * nsiz - nsiz], fname, &cx0, fname_len);
00054   
00055   if ( Rhs < *iMin || Rhs > *iMax) 
00056     {
00057       Scierror(77,"%s: wrong number of rhs arguments\r\n",get_fname(fname,fname_len));
00058       return FALSE_; 
00059     }
00060   return TRUE_;
00061 } 

Here is the call graph for this function:

int C2F() callscifun ( char *  string,
unsigned long  string_len 
)

Definition at line 1836 of file stack2.c.

References C2F, cvname(), cx0, id, nsiz, putid(), and string_len.

Referenced by sci_xload(), and sci_xsave().

01837 {
01838   integer id[nsiz];
01839   C2F(cvname)(id, string, &cx0, string_len);
01840   C2F(putid)(&C2F(recu).ids[(C2F(recu).pt + 1) * nsiz - nsiz], id);
01841   C2F(com).fun = -1;
01842   return 0;
01843 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() changetoref ( int  number,
int  pointed 
)

Definition at line 3156 of file stack2.c.

References C2F, GetRawData(), iadr, istk, Lstk, offset, pointed, Rhs, and Top.

03158 {
03159   int offset; int point_ed; int *header;
03160   header =  GetRawData(number);
03161   offset = Top - Rhs;
03162   point_ed = offset + pointed;
03163   header[0]= - *istk( iadr(*Lstk( point_ed )) );  /* reference : 1st entry (type) is opposite */
03164   header[1]= *Lstk(point_ed);  /* pointed adress */
03165   header[2]= pointed; /* pointed variable */
03166   header[3]= *Lstk(point_ed + 1) - *Lstk(point_ed);  /* size of pointed variable */
03167   C2F(intersci).ntypes[number-1]= '-';
03168   return 1;
03169 }

Here is the call graph for this function:

int check_col ( int  posi,
int  m,
int  n 
)

Definition at line 2911 of file stack2.c.

References check_prop().

02912 {
02913   return check_prop("should be a column vector",posi, n != 1);
02914 }

Here is the call graph for this function:

int check_dim_prop ( int  i,
int  j,
int  flag 
)

Definition at line 2972 of file stack2.c.

References ArgsPosition(), FALSE_, Get_Iname(), and TRUE_.

02973 {
02974   if ( flag ) 
02975     {
02976       Scierror(999,"%s: %s have incompatible dimensions\r\n",
02977                Get_Iname(),
02978                ArgsPosition(i,j));
02979       return FALSE_;
02980     }
02981   return TRUE_;
02982 }

Here is the call graph for this function:

int check_dims ( int  posi,
int  m,
int  n,
int  m1,
int  n1 
)

Definition at line 2921 of file stack2.c.

References ArgPosition(), FALSE_, Get_Iname(), and TRUE_.

02922 {
02923   if ( m != m1 ||  n != n1 ) 
02924     { 
02925       Scierror(999,"%s: %s has wrong dimensions (%d,%d), expecting (%d,%d)\r\n",
02926                Get_Iname(),
02927                ArgPosition(posi),
02928                m,n,
02929                m1,n1);
02930       return FALSE_;
02931     }
02932   return TRUE_;
02933 }

Here is the call graph for this function:

int check_length ( int  posi,
int  m,
int  m1 
)

Definition at line 2949 of file stack2.c.

References ArgPosition(), FALSE_, Get_Iname(), and TRUE_.

02950 {
02951   if ( m != m1 )
02952     { 
02953       Scierror(999,"%s: %s has wrong length %d, expecting (%d)\r\n",
02954                Get_Iname(),
02955                ArgPosition(posi),
02956                m, m1);
02957       return FALSE_;
02958     }
02959   return TRUE_;
02960 }

Here is the call graph for this function:

int check_list_col ( int  lpos,
int  posi,
int  m,
int  n 
)

Definition at line 3013 of file stack2.c.

References check_list_prop().

03014 {
03015   return check_list_prop("a column vector",lpos,posi, n != 1);
03016 }

Here is the call graph for this function:

int check_list_one_dim ( int  lpos,
int  posi,
int  dim,
int  val,
int  valref 
)

Definition at line 3023 of file stack2.c.

References FALSE_, Get_Iname(), and TRUE_.

03024 {
03025   if ( val != valref) 
03026     { 
03027       Scierror(999,"%s: argument %d(%d) has wrong %s dimension (%d), expecting (%d)\r\n",
03028                Get_Iname(),lpos,posi,
03029                ( dim == 1 ) ? "first" : "second" ,
03030                val,valref);
03031       return FALSE_;
03032     }
03033   return TRUE_;
03034 }

Here is the call graph for this function:

static int check_list_prop ( char *  mes,
int  lpos,
int  posi,
int  m 
) [static]

Definition at line 2985 of file stack2.c.

References ArgPosition(), FALSE_, Get_Iname(), and TRUE_.

Referenced by __PARAMS(), check_list_col(), check_list_row(), check_list_scalar(), and check_list_vector().

02986 {
02987   if ( m ) 
02988     { 
02989       Scierror(999,"%s: %s should be a list with %d-element being %s \r\n",
02990                Get_Iname(),
02991                ArgPosition(posi),
02992                posi,mes);
02993       return FALSE_;
02994     }
02995   return TRUE_;
02996 }

Here is the call graph for this function:

Here is the caller graph for this function:

int check_list_row ( int  lpos,
int  posi,
int  m,
int  n 
)

Definition at line 3008 of file stack2.c.

References check_list_prop().

03009 {
03010   return check_list_prop("a row vector",lpos,posi, m != 1);
03011 }

Here is the call graph for this function:

int check_list_scalar ( int  lpos,
int  posi,
int  m,
int  n 
)

Definition at line 3018 of file stack2.c.

References check_list_prop().

03019 {
03020   return check_list_prop("a scalar",lpos, posi, n != 1 || m != 1);
03021 }

Here is the call graph for this function:

int check_list_vector ( int  lpos,
int  posi,
int  m,
int  n 
)

Definition at line 3003 of file stack2.c.

References check_list_prop().

03004 {
03005   return check_list_prop("a vector",lpos,posi, m != 1 && n != 1);
03006 }

Here is the call graph for this function:

int check_one_dim ( int  posi,
int  dim,
int  val,
int  valref 
)

Definition at line 2935 of file stack2.c.

References ArgPosition(), FALSE_, Get_Iname(), and TRUE_.

02936 {
02937   if ( val != valref) 
02938     { 
02939       Scierror(999,"%s: %s has wrong %s dimension (%d), expecting (%d)\r\n",
02940                Get_Iname(),
02941                ArgPosition(posi),
02942                ( dim == 1 ) ? "first" : "second" ,
02943                val,valref);
02944       return FALSE_;
02945     }
02946   return TRUE_;
02947 }

Here is the call graph for this function:

static int check_prop ( char *  mes,
int  posi,
int  m 
) [static]

Definition at line 2882 of file stack2.c.

References ArgPosition(), FALSE_, Get_Iname(), and TRUE_.

Referenced by check_col(), check_row(), check_scalar(), check_square(), and check_vector().

02883 {
02884   if ( m ) 
02885     { 
02886       /* XXXX moduler 999 en fn des messages */
02887       Scierror(999,"%s: %s %s\r\n",
02888                Get_Iname(),
02889                ArgPosition(posi),
02890                mes);
02891       return FALSE_;
02892     }
02893   return TRUE_;
02894 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int Check_references (  )  [static]

Definition at line 2418 of file stack2.c.

References C2F, ConvertData(), FALSE_, iadr, istk, lad, Lstk, ntypes, Rhs, size, Top, and TRUE_.

Referenced by putlhsvar().

02419 {
02420         int ivar ; 
02421         for (ivar = 1; ivar <= Rhs ; ++ivar) 
02422                 {
02423                         unsigned char Type = (unsigned char)C2F(intersci).ntypes[ivar - 1];
02424                         if ( Type != '$') 
02425                                 {
02426                                         int lw = ivar + Top - Rhs;
02427                                         int il = iadr(*Lstk(lw));
02428                                         if ( *istk(il) < 0) 
02429                                                 {
02430                                                         int m,n,it,size;
02431                                                         /* back conversion if necessary of a reference */ 
02432                                                         /* sciprint("%d: is a reference\r\n",ivar);  */
02433                                                         if ( *istk(il) < 0)  il = iadr(*istk(il +1));
02434                                                         m =*istk(il +1);
02435                                                         n =*istk(il +2);
02436                                                         it = *istk(il +3);
02437                                                         switch ( Type ) {
02438                                                                 case 'i' : 
02439                                                                 case 'r' : 
02440                                                                 case 'd' :
02441                                                                         size  = m * n * (it + 1); break; 
02442                                                                 case 'z' :
02443                                                                         size  = 0;break; /* size is unsued for 'z' in ConvertData;*/
02444                                                                 case 'c' : 
02445                                                                         size =*istk(il + 4  +1) - *istk(il + 4 ); break;
02446                                                                 case 'b' :
02447                                                                         size = m*n ; break;
02448                                                                 default:
02449                                                                         return FALSE_; 
02450                                                         }
02451                                                         ConvertData(&Type,size,C2F(intersci).lad[ivar - 1]);
02452                                                         C2F(intersci).ntypes[ivar - 1] = '$';
02453                                                 }
02454                                 }
02455                         else 
02456                                 {
02457                                         /* sciprint("%d: is of type $ \n",ivar);  */
02458                                 }
02459                 }
02460         return TRUE_; 
02461 }

Here is the call graph for this function:

Here is the caller graph for this function:

int check_row ( int  posi,
int  m,
int  n 
)

Definition at line 2906 of file stack2.c.

References check_prop().

02907 {
02908   return check_prop("should be a row vector",posi, m != 1);
02909 }

Here is the call graph for this function:

int check_same_dims ( int  i,
int  j,
int  m1,
int  n1,
int  m2,
int  n2 
)

Definition at line 2962 of file stack2.c.

References ArgsPosition(), FALSE_, Get_Iname(), and TRUE_.

02963 {
02964   if ( m1 == m2 && n1 == n2 ) return TRUE_ ;
02965   Scierror(999,"%s: %s have incompatible dimensions (%dx%d) # (%dx%d)\r\n",
02966            Get_Iname(),
02967            ArgsPosition(i,j),
02968            m1,n1,m2,n2);
02969   return FALSE_;
02970 }

Here is the call graph for this function:

int check_scalar ( int  posi,
int  m,
int  n 
)

Definition at line 2916 of file stack2.c.

References check_prop().

02917 {
02918   return check_prop("should be a scalar",posi, n != 1 || m != 1);
02919 }

Here is the call graph for this function:

int check_square ( int  posi,
int  m,
int  n 
)

Definition at line 2896 of file stack2.c.

References check_prop().

02897 {
02898   return check_prop("should be square",posi, m != n);
02899 }

Here is the call graph for this function:

int check_vector ( int  posi,
int  m,
int  n 
)

Definition at line 2901 of file stack2.c.

References check_prop().

02902 {
02903   return check_prop("should be a vector",posi, m != 1 && n != 1);
02904 }

Here is the call graph for this function:

int C2F() checklhs ( char *  fname,
integer iMin,
integer iMax,
unsigned long  fname_len 
)

Definition at line 67 of file stack2.c.

References FALSE_, fname_len, get_fname(), and TRUE_.

00068 {
00069   if ( Lhs < *iMin || Lhs > *iMax) 
00070     {
00071       Scierror(78,"%s: wrong number of lhs arguments\r\n",get_fname(fname,fname_len));
00072       return FALSE_;
00073     }
00074   return TRUE_;
00075 } 

Here is the call graph for this function:

int C2F() convert2sci ( integer ix  ) 

Definition at line 2749 of file stack2.c.

References C2F, FALSE_, ix, mvfromto(), Rhs, Top, and TRUE_.

Referenced by mklistfromvars(), mkmlistfromvars(), and mktlistfromvars().

02750 {
02751   integer ix1 = Top - Rhs + *ix;
02752   if (! C2F(mvfromto)(&ix1, ix)) return FALSE_;
02753   C2F(intersci).ntypes[*ix - 1] = '$';
02754   return TRUE_;
02755 } 

Here is the call graph for this function:

Here is the caller graph for this function:

void ConvertData ( char *  type,
int  size,
int  l 
)

Definition at line 2844 of file stack2.c.

References C2F, cstk, cvstr1(), F77ToSci(), iadr, int2db(), istk, sstk, stk, z2double(), and zstk.

Referenced by Check_references().

02845 {
02846   int zero=0,mu=-1; int laddr; int prov,m,n,it;
02847   double wsave;
02848   switch (type[0]) {
02849   case 'c' :
02850     C2F(cvstr1)(&size,(int *) cstk(l),cstk(l),&zero,size);
02851     break;
02852   case 'r'  :
02853     C2F(rea2db)(&size,sstk(l),&mu,(double *)sstk(l),&mu);
02854     break;
02855   case 'i' :
02856     C2F(int2db)(&size,istk(l),&mu,(double *)istk(l),&mu);
02857     break;
02858   case 'z' :
02859     if (*istk( iadr(iadr(l))-2 ) == 133 ){  /* values @ even adress */
02860       prov=*istk( iadr(iadr(l))-1 );
02861       m=*istk(prov);n=*istk(prov+1);it=1;
02862       laddr=iadr(l);       wsave=*stk(laddr);   
02863       /* make header */
02864       *istk( iadr(iadr(l))-2 ) = 1;
02865       *istk( iadr(iadr(l))-1 ) = m;
02866       *istk( iadr(iadr(l)) ) = n;
02867       *istk( iadr(iadr(l))+1 ) = it;
02868       /* convert values */
02869       z2double(stk(laddr),stk(laddr+1),m*n, m*n);
02870       *stk(laddr+1)=wsave;
02871     } else
02872       {
02873         F77ToSci((double *) zstk(l), size, size);
02874       }
02875   }
02876 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() copyvarfromsciptr ( integer  lw,
integer  n,
integer  l 
)

Definition at line 3072 of file stack2.c.

References C2F, createdata(), FALSE_, l, Lstk, Rhs, stk, Top, TRUE_, and unsfdcopy().

03073 {
03074   int ret,un=1;
03075   if ((ret=C2F(createdata)(&lw, n))==FALSE_) return ret;
03076   C2F(unsfdcopy)(&n,stk(l),&un,stk(*Lstk(lw + Top - Rhs)),&un);
03077   return TRUE_; 
03078 }

Here is the call graph for this function:

int C2F() createcvar ( integer lw,
char *  typex,
integer it,
integer m,
integer n,
integer lr,
integer lc,
unsigned long  type_len 
)

Definition at line 522 of file stack2.c.

References C2F, cremat(), FALSE_, Get_Iname(), iadr, intersiz, Lstk, Max, Nbvars, nlgh, Rhs, Top, and TRUE_.

Referenced by __PARAMS(), and createptr().

00523 {
00524   unsigned char Type = *typex ;
00525   integer lw1;
00526   char *fname = Get_Iname();
00527   if (*lw > intersiz) {
00528     Scierror(999,"%s: (createcvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00529              fname);
00530     return FALSE_;
00531   }
00532   Nbvars = Max(*lw,Nbvars);
00533   lw1 = *lw + Top - Rhs;
00534   if (*lw < 0) {
00535     Scierror(999,"%s: bad call to createcvar! (1rst argument)\r\n",
00536              fname);
00537     return FALSE_;
00538   }
00539   switch ( Type )  {
00540   case 'd' : 
00541     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, lc, nlgh))  return FALSE_;
00542     C2F(intersci).ntypes[*lw - 1] = Type;
00543     C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00544     C2F(intersci).lad[*lw - 1] = *lr;
00545     break;
00546   case 'r' : 
00547     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, lc, nlgh))  return FALSE_;
00548     *lr = iadr(*lr);
00549     *lc = *lr + *m * *n;
00550     C2F(intersci).ntypes[*lw - 1] = Type;
00551     C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00552     C2F(intersci).lad[*lw - 1] = *lr;
00553     break;
00554   case 'i' : 
00555     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, lc, nlgh))  return FALSE_;
00556     *lr = iadr(*lr);
00557     *lc = *lr + *m * *n;
00558     C2F(intersci).ntypes[*lw - 1] = Type;
00559     C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00560     C2F(intersci).lad[*lw - 1] = *lr;
00561     break;
00562   }
00563   return TRUE_;
00564 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() createcvarfrom ( integer lw,
char *  typex,
integer it,
integer m,
integer n,
integer lr,
integer lc,
integer lar,
integer lac,
unsigned long  type_len 
)

Definition at line 688 of file stack2.c.

References C2F, cremat(), cx1, dcopy(), FALSE_, Get_Iname(), iadr, int2db(), intersiz, istk, lcs, Lstk, Max, Nbvars, nlgh, Rhs, sstk, stk, Top, and TRUE_.

00689 {
00690   unsigned char Type = *typex;
00691   int MN;
00692   integer lw1, lcs;
00693   char *fname =     Get_Iname();
00694   if (*lw > intersiz) {
00695     Scierror(999,"%s: (createcvarfrom) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00696              fname);
00697     return FALSE_;
00698   }
00699   Nbvars = Max(*lw,Nbvars);
00700   lw1 = *lw + Top - Rhs;
00701   MN = (*m)*(*n);
00702   if (*lw < 0) {
00703     Scierror(999,"%s: bad call to createcvarfrom! (1rst argument)\r\n",
00704              fname);
00705     return FALSE_;
00706   }
00707   switch ( Type ) {
00708   case 'd' : 
00709     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, lc, nlgh)) return FALSE_;
00710     if (*lar != -1) C2F(dcopy)(&MN, stk(*lar), &cx1,stk(*lr) , &cx1);
00711     if (*lac != -1 && *it == 1) C2F(dcopy)(&MN, stk(*lac), &cx1,stk(*lc) , &cx1);
00712     *lar = *lr;
00713     *lac = *lc;
00714     break;
00715   case 'r' :
00716     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, lc, nlgh)) return FALSE_;
00717     if (*lar != -1) C2F(rea2db)(&MN, sstk(*lar), &cx1, stk(*lr), &cx1);
00718     if (*lac != -1 && *it==1) C2F(rea2db)(&MN, sstk(*lac), &cx1, stk(*lc), &cx1);
00719     *lar = *lr;
00720     *lac = *lc;
00721     *lr = iadr(*lr);
00722     *lc = *lr + *m * *n;
00723     break ;
00724   case 'i' :
00725     if (! C2F(cremat)(fname, &lw1, it, m, n, lr, &lcs, nlgh)) return FALSE_;
00726     if (*lar != -1) C2F(int2db)(&MN, istk(*lar), &cx1, stk(*lr), & cx1);
00727     if (*lac != -1 && (*it==1)) C2F(int2db)(&MN, istk(*lac), &cx1, stk(*lc), &cx1);
00728     *lar = *lr;
00729     *lac = *lc;
00730     *lr = iadr(*lr);
00731     *lc = *lr + *m * *n;
00732     break;
00733   }
00734   C2F(intersci).ntypes[*lw - 1] = '$';
00735   C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00736   C2F(intersci).lad[*lw - 1] = *lr;
00737   return TRUE_;
00738 }

Here is the call graph for this function:

int C2F() createcvarfromptr ( integer number,
char *  typex,
integer it,
integer m,
integer n,
double *  iptr,
double *  iptc,
unsigned long  type_len 
)

Definition at line 1737 of file stack2.c.

References C2F, cdouble(), cint(), cremat(), FALSE_, Get_Iname(), intersiz, lcs, lrs, Max, Nbvars, nlgh, Rhs, stk, Top, and TRUE_.

01738 {
01739   unsigned char Type = *typex;
01740   char *fname = Get_Iname();
01741   integer lw1, lcs, lrs, ix1;
01742 
01743   Nbvars = Max(Nbvars,*number);
01744   if (*number > intersiz) {
01745     Scierror(999,"%s: createcvarfromptr: too many arguments on the stack, enlarge intersiz\r\n",
01746              fname);
01747     return FALSE_;
01748   }
01749   lw1 = *number + Top - Rhs;
01750   switch ( Type ) {
01751   case 'd' : 
01752     if (! C2F(cremat)(fname, &lw1, it, m, n, &lrs, &lcs, nlgh)) 
01753       return FALSE_;
01754     ix1 = *m * *n;
01755     C2F(cdouble)(&ix1, (double **) iptr, stk(lrs));
01756     if (*it == 1) {
01757       ix1 = *m * *n;
01758       C2F(cdouble)(&ix1,(double **) iptc, stk(lcs));
01759     }
01760     break;
01761   case 'i' :
01762     if (! C2F(cremat)(fname, &lw1, it, m, n, &lrs, &lcs, nlgh)) 
01763       return FALSE_;
01764     ix1 = *m * *n;
01765     C2F(cint)(&ix1, (int **) iptr, stk(lrs));
01766     if (*it == 1) {
01767       ix1 = *m * *n;
01768       C2F(cint)(&ix1,(int **) iptc, stk(lcs));
01769     }
01770     break;
01771   default :
01772     Scierror(999,"%s: createcvarfromptr was called with bad second argument!\r\n",fname);
01773     return FALSE_;
01774   }
01775   /*     this object will be copied with a vcopyobj in putlhsvar */
01776   C2F(intersci).ntypes[*number - 1] = '$';
01777   return  TRUE_;
01778 } 

Here is the call graph for this function:

int C2F() createdata ( integer lw,
integer  n 
)

Definition at line 3042 of file stack2.c.

References C2F, credata(), FALSE_, Get_Iname(), intersiz, Lstk, Max, Nbvars, nlgh, Rhs, Top, and TRUE_.

Referenced by CopyVarFromlistentry(), and copyvarfromsciptr().

03043 {
03044   integer lw1;
03045   char *fname = Get_Iname();
03046   if (*lw > intersiz) {
03047     Scierror(999,"%s: (createdata) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
03048              fname);
03049     return FALSE_ ;
03050   }
03051   Nbvars = Max(*lw,Nbvars);
03052   lw1 = *lw + Top - Rhs;
03053   if (*lw < 0) {
03054     Scierror(999,"%s: bad call to createdata! (1rst argument)\r\n",
03055              fname);
03056     return FALSE_ ;
03057   }
03058   if (! C2F(credata)(fname, &lw1, n, nlgh))    return FALSE_;
03059   C2F(intersci).ntypes[*lw - 1] = '$';
03060   C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
03061   C2F(intersci).lad[*lw - 1] = *Lstk(lw1);
03062   return TRUE_; 
03063 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() createlist ( integer lw,
integer nel 
)

Definition at line 571 of file stack2.c.

References C2F, crelist(), FALSE_, Get_Iname(), intersiz, Lstk, Max, Nbvars, nel, Rhs, Top, and TRUE_.

00572 {
00573   char *fname = Get_Iname();
00574   integer lr, lw1;
00575   if (*lw > intersiz) {
00576     Scierror(999,"%s: (createlist) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00577              fname);
00578     return FALSE_;
00579   }
00580   Nbvars = Max(*lw,Nbvars);
00581   lw1 = *lw + Top - Rhs;
00582   if (*lw < 0) {
00583     Scierror(999,"%s: bad call to createlist! (1rst argument)\r\n",fname);
00584     return FALSE_;
00585   }
00586   C2F(crelist)(&lw1, nel, &lr);
00587   C2F(intersci).ntypes[*lw - 1] = '$';
00588   C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00589   C2F(intersci).lad[*lw - 1] = lr;
00590   return TRUE_;
00591 } 

Here is the call graph for this function:

int C2F() createlistcvarfrom ( integer lnumber,
integer number,
char *  typex,
integer it,
integer m,
integer n,
integer lr,
integer lc,
integer lar,
integer lac,
unsigned long  type_len 
)

Definition at line 860 of file stack2.c.

References C2F, cx1, dcopy(), FALSE_, Get_Iname(), iadr, int2db(), intersiz, istk, lad, listcremat(), nlgh, Rhs, sstk, stk, Top, and TRUE_.

00861 {
00862   integer ix1;
00863   int mn = (*m)*(*n);
00864   unsigned char Type = *typex;
00865   char *fname = Get_Iname();
00866 
00867   if (*lnumber > intersiz) {
00868     Scierror(999,"%s: (createlistcvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00869              fname) ;
00870     return FALSE_;
00871   }
00872 
00873   switch ( Type ) { 
00874   case 'd' :
00875     ix1 = *lnumber + Top - Rhs;
00876     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],it, m, n, lr, lc, nlgh)) 
00877       return FALSE_;
00878     if (*lar != -1) C2F(dcopy)(&mn,  stk(*lar), &cx1, stk(*lr), &cx1);
00879     if (*lac != -1 && *it==1) C2F(dcopy)(&mn, stk(*lac), &cx1,stk(*lc) , &cx1);
00880     *lar = *lr;
00881     *lac = *lc;
00882     break;
00883   case 'r' :
00884     ix1 = *lnumber + Top - Rhs;
00885     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00886                           it, m, n, lr, lc, nlgh)) 
00887       return FALSE_;
00888     if (*lar != -1) C2F(rea2db)(&mn, sstk(*lar), &cx1, stk(*lr), &cx1);
00889     if (*lac != -1 && *it==1) C2F(rea2db)(&mn, sstk(*lac), &cx1, stk(*lc), & cx1);
00890     *lar = *lr;
00891     *lac = *lc;
00892     *lr = iadr(*lr);
00893     *lc = *lr + *m * *n;
00894     break; 
00895   case 'i' :
00896     ix1 = *lnumber + Top - Rhs;
00897     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00898                           it, m, n, lr, lc, nlgh)) 
00899       return FALSE_;
00900     if (*lar != -1) C2F(int2db)(&mn,istk(*lar), &cx1, stk(*lr), &cx1);
00901     if (*lac != -1 && *it==1) C2F(int2db)(&mn, istk(*lac), &cx1, stk(*lc), &cx1);
00902     *lar = *lr;
00903     *lac = *lc;
00904     *lr = iadr(*lr);
00905     *lc = *lr + *m * *n;
00906     break;
00907   default :
00908     Scierror(999,"%s:  createlistcvar called with bad third argument!\r\n",fname);
00909     return FALSE_;
00910   }
00911   return TRUE_;
00912 }

Here is the call graph for this function:

int C2F() createlistcvarfromptr ( integer lnumber,
integer number,
char *  typex,
integer it,
integer m,
integer n,
void *  iptr,
void *  iptc,
unsigned long  type_len 
)

Definition at line 1039 of file stack2.c.

References C2F, cdouble(), cfloat(), cint(), FALSE_, Get_Iname(), intersiz, lad, listcremat(), nlgh, Rhs, stk, Top, and TRUE_.

01040 {
01041   unsigned Type = *typex;
01042   integer lr,lc, ix1;
01043   char *fname = Get_Iname();
01044   if (*lnumber > intersiz) {
01045     Scierror(999,"%s: (createlistvarfromptr) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01046              fname);
01047     return FALSE_;
01048   }
01049   switch ( Type ) {
01050   case 'd' :
01051     ix1 = *lnumber + Top - Rhs;
01052     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
01053                           it, m, n, &lr, &lc, nlgh)) {
01054       return FALSE_;
01055     }
01056     ix1= (*m)*(*n);
01057     C2F(cdouble) (&ix1,(double **) iptr, stk(lr));
01058     if ( *it == 1) C2F(cdouble) (&ix1,(double **) iptc, stk(lc));
01059     break;
01060   case 'r' :
01061     ix1 = *lnumber + Top - Rhs;
01062     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
01063                           it, m, n, &lr, &lc, nlgh)) {
01064       return FALSE_;
01065     }
01066     ix1= (*m)*(*n);
01067     C2F(cfloat) (&ix1,(float **) iptr, stk(lr));
01068     if ( *it == 1)     C2F(cfloat) (&ix1,(float **) iptc, stk(lc));
01069     break;
01070   case 'i' :
01071     ix1 = *lnumber + Top - Rhs;
01072     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
01073                           it, m, n, &lr, &lc, nlgh)) {
01074       return FALSE_;
01075     }
01076     ix1 = *m * *n;
01077     C2F(cint)(&ix1,(int **) iptr, stk(lr));
01078     if ( *it == 1)     C2F(cint)(&ix1,(int **) iptc, stk(lc));
01079     break;
01080   default :
01081     Scierror(999,"%s: (createlistcvarfromptr) bad third argument!\r\n",fname);
01082     return FALSE_;
01083     break;
01084   }
01085   return TRUE_;
01086 }

Here is the call graph for this function:

int C2F() createlistvarfrom ( integer lnumber,
integer number,
char *  typex,
integer m,
integer n,
integer lr,
integer lar,
unsigned long  type_len 
)

Definition at line 757 of file stack2.c.

References C2F, cadr, cstk, cvstr1(), cx0, cx1, dcopy(), FALSE_, Get_Iname(), iadr, icopy(), int2db(), intersiz, istk, lad, listcrebmat(), listcrehmat(), listcreimat(), listcremat(), listcrepointer(), listcrestring(), nlgh, Rhs, sstk, stk, Top, tpconv(), and TRUE_.

00758 {
00759   unsigned Type = *typex;
00760   integer lc, ix1, it = 0, mn = (*m)*(*n),inc=1;
00761   char *fname = Get_Iname();
00762   if (*lnumber > intersiz) {
00763     Scierror(999,"%s: (createlistvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00764              fname);
00765     return FALSE_;
00766   }
00767   switch ( Type ) {
00768   case 'c' :
00769     *n = 1;
00770     ix1 = *lnumber + Top - Rhs;
00771     if (! C2F(listcrestring)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1], m, lr, nlgh)) {
00772       return FALSE_;
00773     }
00774     if (*lar != -1) C2F(cvstr1)(m, istk(*lr), cstk(*lar), &cx0,  *m * *n + 1);
00775     *lar = *lr;
00776     *lr = cadr( *lr);
00777     break;
00778   case 'd' :
00779     ix1 = *lnumber + Top - Rhs;
00780     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00781                           &it, m, n, lr, &lc, nlgh)) {
00782       return FALSE_;
00783     }
00784     if (*lar != -1) C2F(dcopy)(&mn, stk(*lar), &cx1,stk(*lr) , &cx1);
00785     *lar = *lr;
00786     break;
00787   case 'r' :
00788     ix1 = *lnumber + Top - Rhs;
00789     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00790                           &it, m, n, lr, &lc, nlgh)) {
00791       return FALSE_;
00792     }
00793     if (*lar != -1)     C2F(rea2db)(&mn, sstk(*lar), &cx1, stk(*lr), &cx1);
00794     *lar = *lr;
00795     *lr = iadr(*lr);
00796     break;
00797   case 'i' :
00798     ix1 = *lnumber + Top - Rhs;
00799     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00800                           &it, m, n, lr, &lc, nlgh)) {
00801       return FALSE_;
00802     }
00803     if (*lar != -1)     C2F(int2db)(&mn, istk(*lar), &cx1, stk(*lr), &cx1);
00804     *lar = *lr;
00805     *lr = iadr(*lr);
00806     break;
00807   case 'b' :
00808     ix1 = *lnumber + Top - Rhs;
00809     if (! C2F(listcrebmat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1]
00810                            , m, n, lr, nlgh)) {
00811       return FALSE_;
00812     }
00813     if (*lar != -1) C2F(icopy)(&mn, istk(*lar), &cx1, istk(*lr), &cx1);
00814     *lar = *lr;
00815     break;
00816   case 'I' : 
00817     it = *lr ; /* it gives the type on entry */
00818     ix1 = *lnumber + Top - Rhs;
00819     if (! C2F(listcreimat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00820                           &it, m, n, lr, nlgh)) {
00821       return FALSE_;
00822     }
00823     if (*lar != -1) 
00824       C2F(tpconv)(&it,&it,&mn,istk(*lar), &inc,istk(*lr), &inc);
00825     *lar = *lr;
00826     break;
00827   case 'p' :
00828     ix1 = *lnumber + Top - Rhs;
00829     if (! C2F(listcrepointer)(fname, &ix1, number, 
00830                               &C2F(intersci).lad[*lnumber - 1], lr, nlgh)) 
00831       {
00832         return FALSE_;
00833       }
00834     if (*lar != -1) *stk(*lr)= *stk(*lar);
00835     *lar = *lr;
00836     break;
00837   case 'h' :
00838     ix1 = *lnumber + Top - Rhs;
00839     if (! C2F(listcrehmat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00840                            m, n, lr, nlgh)) {
00841       return FALSE_;
00842     }
00843     if (*lar != -1) C2F(dcopy)(&mn, stk(*lar), &cx1,stk(*lr) , &cx1);
00844     *lar = *lr;
00845     break;
00846   default :
00847     Scierror(999,"%s: (createlistvar) bad third argument!\r\n",fname);
00848     return FALSE_;
00849     break;
00850   }
00851   return TRUE_;
00852 }

Here is the call graph for this function:

int C2F() createlistvarfromptr ( integer lnumber,
integer number,
char *  typex,
integer m,
integer n,
void *  iptr,
unsigned long  type_len 
)

Definition at line 933 of file stack2.c.

References C2F, cbool(), cdouble(), cfloat(), cint(), cre_listsmat_from_str(), cre_listsparse_from_ptr(), FALSE_, Get_Iname(), intersiz, iptr, istk, lad, listcrebmat(), listcreimat(), listcremat(), listcrepointer(), listcrestring(), nlgh, Rhs, stk, Top, tpconv(), and TRUE_.

00934 {
00935   unsigned Type = *typex;
00936   integer lc, ix1, it = 0, lr,inc=1;
00937   char *fname = Get_Iname();
00938   if (*lnumber > intersiz) {
00939     Scierror(999,"%s: (createlistvarfromptr) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00940              fname);
00941     return FALSE_;
00942   }
00943 
00944   ix1 = *lnumber + Top - Rhs;  /* factorization of this term (Bruno 9 march 2005, bugfix ) */
00945   switch ( Type ) {
00946   case 'c' :
00947     *n = 1;
00948     if (! C2F(listcrestring)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1], m, &lr, nlgh)) {
00949       return FALSE_;
00950     }
00951     C2F(cchar)(m,(char **) iptr, istk(lr));
00952     break;
00953   case 'd' :
00954     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00955                           &it, m, n, &lr, &lc, nlgh)) {
00956       return FALSE_;
00957     }
00958     ix1= (*m)*(*n);
00959     C2F(cdouble) (&ix1,(double **) iptr, stk(lr));
00960     break;
00961   case 'r' :
00962     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00963                           &it, m, n, &lr, &lc, nlgh)) {
00964       return FALSE_;
00965     }
00966     ix1= (*m)*(*n);
00967     C2F(cfloat) (&ix1,(float **) iptr, stk(lr));
00968     break;
00969   case 'i' :
00970     if (! C2F(listcremat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00971                           &it, m, n, &lr, &lc, nlgh)) {
00972       return FALSE_;
00973     }
00974     ix1 = *m * *n;
00975     C2F(cint)(&ix1,(int **) iptr, stk(lr));
00976     break;
00977   case 'b' :
00978     if (! C2F(listcrebmat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1]
00979                            , m, n, &lr, nlgh)) {
00980       return FALSE_;
00981     }
00982     ix1 = *m * *n;
00983     C2F(cbool)(&ix1,(int **) iptr, istk(lr));
00984     break;
00985   case 'S' : 
00986     if ( !cre_listsmat_from_str(fname,&ix1, number, &C2F(intersci).lad[*lnumber - 1]
00987                                 , m, n, (char **) iptr, nlgh)) /* XXX */
00988       return FALSE_;
00989     break;
00990   case 's' :
00991     if ( !cre_listsparse_from_ptr(fname,&ix1,number,
00992                               &C2F(intersci).lad[*lnumber - 1]
00993                               , m, n, (SciSparse *) iptr, nlgh))
00994       return FALSE_;
00995     break;
00996   case 'I' :
00997     it = ((SciIntMat *) iptr)->it;
00998     if (! C2F(listcreimat)(fname, &ix1, number, &C2F(intersci).lad[*lnumber - 1],
00999                           &it, m, n, &lr, nlgh)) {
01000       return FALSE_;
01001     }
01002     ix1= (*m)*(*n);
01003     C2F(tpconv)(&it,&it,&ix1,((SciIntMat *) iptr)->D, &inc,istk(lr), &inc);
01004     break;
01005   case 'p' :
01006     if (! C2F(listcrepointer)(fname, &ix1, number, 
01007                               &C2F(intersci).lad[*lnumber - 1],&lr,nlgh)) 
01008       {
01009         return FALSE_;
01010       }
01011     *stk(lr) = (double) ((unsigned long int) iptr);
01012     break;
01013   default :
01014     Scierror(999,"%s: (createlistvarfromptr) bad third argument!\r\n",fname);
01015     return FALSE_;
01016     break;
01017   }
01018   return TRUE_;
01019 }

Here is the call graph for this function:

int C2F() createreference ( int  number,
int  pointed 
)

Definition at line 3140 of file stack2.c.

References C2F, CreateData, GetRawData(), iadr, istk, Lstk, offset, pointed, Rhs, and Top.

03142 {
03143   int offset; int point_ed; int *header;
03144   CreateData( number, 4*sizeof(int) );
03145   header =  GetRawData(number);
03146   offset = Top -Rhs;
03147   point_ed = offset + pointed;
03148   header[0]= - *istk( iadr(*Lstk( point_ed )) );  /* reference : 1st entry (type) is opposite */
03149   header[1]= *Lstk(point_ed);  /* pointed adress */
03150   header[2]= point_ed; /* pointed variable */
03151   header[3]= *Lstk(point_ed + 1)- *Lstk(point_ed);  /* size of pointed variable */
03152   C2F(intersci).ntypes[number-1]= '-';
03153   return 1;
03154 }

Here is the call graph for this function:

int C2F() createreffromname ( int  number,
char *  name 
)

Definition at line 3171 of file stack2.c.

References C2F, CreateData, fin, GetData(), iadr, istk, Lstk, name, and objptr().

03174 {
03175   int *header; int lw; int fin;
03176   CreateData(number, 4*sizeof(int));
03177   header = (int *) GetData(number);
03178   if (C2F(objptr)(name,&lw,&fin,strlen(name))) {
03179     header[0]= - *istk( iadr(*Lstk(fin))); /* type of reference = - type of pointed variable */
03180     header[1]= lw; /* pointed adress */
03181     header[2]= fin; /* pointed variable */
03182     header[3]= *Lstk(fin+1)- *Lstk(fin);  /*size of pointed variable */
03183     return 1;
03184   }
03185   else
03186     {  
03187       Scierror(999,"CreateRefFromName: variable %s not found\r\n",name);
03188       return 0;
03189     }
03190 }

Here is the call graph for this function:

int C2F() createvar ( integer lw,
char *  typex,
integer m,
integer n,
integer lr,
unsigned long  type_len 
)

Definition at line 406 of file stack2.c.

References C2F, cadr, crebmat(), crehmat(), creimat(), crelist(), cremat(), cremlist(), crepointer(), cresmat2(), cretlist(), cstk, FALSE_, Get_Iname(), iadr, intersiz, it, ix, lcs, Lstk, Max, Nbvars, nlgh, Rhs, sadr, Top, and TRUE_.

Referenced by createstkptr(), createvarfromptr(), lasterror(), and mxCreateData().

00407 {
00408   integer ix1, ix, it=0, lw1, lcs, IT;
00409   unsigned char Type = *typex;
00410   char *fname = Get_Iname();
00411   if (*lw > intersiz) {
00412     Scierror(999,"%s: (createvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00413              fname);
00414     return FALSE_ ;
00415   }
00416   Nbvars = Max(*lw,Nbvars);
00417   lw1 = *lw + Top - Rhs;
00418   if (*lw < 0) {
00419     Scierror(999,"%s: bad call to createvar! (1rst argument)\r\n",
00420              fname);
00421     return FALSE_ ;
00422   }
00423   switch (Type ) 
00424     {
00425     case 'c' : 
00426       ix1 = *m * *n;
00427       if (! C2F(cresmat2)(fname, &lw1, &ix1, lr, nlgh)) return FALSE_; 
00428       *lr = cadr(*lr);
00429       for (ix = 0; ix < (*m)*(*n) ; ++ix) *cstk(*lr+ix)= ' ';
00430       *cstk(*lr+ (*m)*(*n) )= '\0';
00431       C2F(intersci).ntypes[*lw - 1] = Type;
00432       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00433       C2F(intersci).lad[*lw - 1] = *lr;
00434       break;
00435     case 'd' : 
00436       if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh))    return FALSE_;
00437       C2F(intersci).ntypes[*lw - 1] = Type;
00438       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00439       C2F(intersci).lad[*lw - 1] = *lr;
00440       break;
00441     case 'z' : 
00442       IT = 1;
00443       if (!(*Lstk(lw1) % 2) ) *Lstk(lw1) = *Lstk(lw1)+1;
00444       if (! C2F(cremat)(fname, &lw1, &IT, m, n, lr, &lcs, nlgh))    return FALSE_;
00445       C2F(intersci).ntypes[*lw - 1] = Type;
00446       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00447       C2F(intersci).lad[*lw - 1] = *lr;
00448       *lr = sadr(*lr);
00449       break;
00450     case 'l' : 
00451       C2F(crelist)(&lw1, m, lr);
00452       C2F(intersci).ntypes[*lw - 1] = '$';
00453       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00454       C2F(intersci).lad[*lw - 1] = *lr;
00455       break;
00456     case 't' : 
00457       C2F(cretlist)(&lw1, m, lr);
00458       C2F(intersci).ntypes[*lw - 1] = '$';
00459       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00460       C2F(intersci).lad[*lw - 1] = *lr;
00461       break;
00462     case 'm' : 
00463       C2F(cremlist)(&lw1, m, lr);
00464       C2F(intersci).ntypes[*lw - 1] = '$';
00465       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00466       C2F(intersci).lad[*lw - 1] = *lr;
00467       break;
00468     case 'r' : 
00469       if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh)) return FALSE_;
00470       *lr = iadr(*lr);
00471       C2F(intersci).ntypes[*lw - 1] = Type;
00472       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00473       C2F(intersci).lad[*lw - 1] = *lr;
00474       break ;
00475     case 'i' :
00476       if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh)) return FALSE_;
00477       *lr = iadr(*lr) ;
00478       C2F(intersci).ntypes[*lw - 1] = Type;
00479       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00480       C2F(intersci).lad[*lw - 1] = *lr;
00481       break ;
00482     case 'b' :
00483       if (! C2F(crebmat)(fname, &lw1, m, n, lr, nlgh))  return FALSE_; 
00484       C2F(intersci).ntypes[*lw - 1] = Type;
00485       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00486       C2F(intersci).lad[*lw - 1] = *lr;
00487       break;
00488     case 'p' : 
00489       if (! C2F(crepointer)(fname, &lw1, lr, nlgh))    return FALSE_;
00490       C2F(intersci).ntypes[*lw - 1] = '$';
00491       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00492       C2F(intersci).lad[*lw - 1] = *lr;
00493       break;
00494     case 'I' : 
00495       it = *lr ; /* on entry lr gives the int type */ 
00496       if (! C2F(creimat)(fname, &lw1, &it, m, n, lr, nlgh))    return FALSE_;
00497       C2F(intersci).ntypes[*lw - 1] = '$';
00498       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00499       C2F(intersci).lad[*lw - 1] = *lr;
00500       break;
00501     case 'h' : 
00502       if (! C2F(crehmat)(fname, &lw1, m, n, lr, nlgh))    return FALSE_;
00503       C2F(intersci).ntypes[*lw - 1] = Type;
00504       C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00505       C2F(intersci).lad[*lw - 1] = *lr;
00506       break;
00507     }
00508   return TRUE_; 
00509 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() createvarfrom ( integer lw,
char *  typex,
integer m,
integer n,
integer lr,
integer lar,
unsigned long  type_len 
)

Definition at line 602 of file stack2.c.

References C2F, cadr, crebmat(), crehmat(), creimat(), cremat(), crepointer(), cresmat2(), cstk, cvstr1(), cx0, cx1, dcopy(), FALSE_, Get_Iname(), iadr, icopy(), int2db(), intersiz, istk, lcs, Lstk, M, Max, N, Nbvars, nlgh, Rhs, sstk, stk, Top, tpconv(), and TRUE_.

00603 {
00604   int M=*m,N=*n,MN=M*N;
00605   unsigned char Type = *typex;
00606   integer inc=1;
00607   integer it=0, lw1, lcs;
00608   char *fname = Get_Iname();
00609   if (*lw > intersiz) {
00610     Scierror(999,"%s: (createvarfrom) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
00611              fname);
00612     return FALSE_;
00613   }
00614   Nbvars = Max(*lw,Nbvars);
00615   lw1 = *lw + Top - Rhs;
00616   if (*lw < 0) {
00617     Scierror(999,"%s: bad call to createvarfrom! (1rst argument)\r\n",
00618              fname);
00619     return FALSE_;
00620   }
00621   switch ( Type ) {
00622   case 'c' :
00623     if (! C2F(cresmat2)(fname, &lw1, &MN, lr, nlgh)) return FALSE_;
00624     if (*lar != -1)  C2F(cvstr1)(&MN, istk(*lr), cstk(*lar), &cx0,  MN + 1);
00625     *lar = *lr;
00626     *lr = cadr(*lr);
00627     M=MN; N= 1;
00628     break;
00629   case 'd' :
00630     if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh))  return FALSE_;
00631     if (*lar != -1)  C2F(dcopy)(&MN, stk(*lar), &cx1, stk(*lr), &cx1);
00632     *lar = *lr;
00633     break;
00634   case 'r' :
00635     if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh)) return FALSE_;
00636     if (*lar != -1)   C2F(rea2db)(&MN, sstk(*lar), &cx1, stk(*lr), & cx1);
00637     *lar = *lr;
00638     *lr = iadr(*lr);
00639     break;
00640   case 'i' :
00641     if (! C2F(cremat)(fname, &lw1, &it, m, n, lr, &lcs, nlgh)) return FALSE_;
00642     if (*lar != -1) C2F(int2db)(&MN,istk(*lar), &cx1, stk(*lr), &cx1);
00643     *lar = *lr;
00644     *lr = iadr(*lr);
00645     break;
00646   case 'b' :
00647     if (! C2F(crebmat)(fname, &lw1, m, n, lr, nlgh)) return FALSE_;
00648     if (*lar != -1) C2F(icopy)(&MN, istk(*lar), &cx1, istk(*lr), &cx1);
00649     *lar = *lr;
00650     break;
00651   case 'I' :
00652     it = *lr;
00653     if (! C2F(creimat)(fname, &lw1, &it, m, n, lr,  nlgh))  return FALSE_;
00654     if (*lar != -1) 
00655       C2F(tpconv)(&it,&it,&MN,istk(*lar), &inc,istk(*lr), &inc);
00656     *lar = *lr;
00657     break;
00658   case 'p' :
00659     MN=1;
00660     if (! C2F(crepointer)(fname, &lw1, lr, nlgh))    return FALSE_;
00661     if (*lar != -1)  C2F(dcopy)(&MN, stk(*lar), &cx1, stk(*lr), &cx1);
00662     *lar = *lr;
00663     break;
00664   case 'h' :
00665     if (! C2F(crehmat)(fname, &lw1, m, n, lr, nlgh))  return FALSE_;
00666     if (*lar != -1)  C2F(dcopy)(&MN, stk(*lar), &cx1, stk(*lr), &cx1);
00667     *lar = *lr;
00668     break;
00669   }
00670   C2F(intersci).ntypes[*lw - 1] = '$';
00671   C2F(intersci).iwhere[*lw - 1] = *Lstk(lw1);
00672   C2F(intersci).lad[*lw - 1] = *lr;
00673   return TRUE_;
00674 }

Here is the call graph for this function:

int C2F() createvarfromptr ( integer number,
char *  typex,
integer m,
integer n,
void *  iptr,
unsigned long  type_len 
)

Definition at line 1671 of file stack2.c.

References C2F, cre_smat_from_str(), cre_sparse_from_ptr(), createvar(), cstk, dcopy(), FALSE_, Get_Iname(), icopy(), istk, Lstk, Max, Nbvars, nlgh, Rhs, sstk, stk, Top, tpconv(), TRUE_, and type_len.

Referenced by lasterror(), and mxCreateString().

01672 {
01673   static int un=1;
01674   unsigned char Type = *typex;
01675   int MN= (*m)*(*n),lr,it,lw1;
01676   char *fname = Get_Iname();
01677   lw1 = *number + Top - Rhs;
01678   switch ( Type ) 
01679     {
01680     case 'd' :
01681       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01682       C2F(dcopy)(&MN,*((double **) iptr),&un, stk(lr),&un);
01683       break;
01684     case 'i' :
01685     case 'b' :
01686       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01687       C2F(icopy)(&MN,*((int **) iptr), &un, istk(lr), &un);
01688       break;
01689     case 'r' :
01690       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01691       C2F(rcopy)(&MN,*((float **)iptr), &un, sstk(lr), &un);
01692       break;
01693     case 'c' :
01694       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01695       strcpy(cstk(lr),*((char **) iptr));
01696       break;
01697     case 'I' :
01698       /* on entry lr must gives the int type */
01699       it = lr = ((SciIntMat *) iptr)->it;
01700       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01701       C2F(tpconv)(&it,&it,&MN,((SciIntMat *) iptr)->D, &un,istk(lr), &un);
01702       break;
01703     case 'p' :
01704       if ( C2F(createvar)(number, typex, m, n, &lr, type_len) == FALSE_ ) return FALSE_;
01705       *stk(lr) = (double) ((unsigned long int) iptr);
01706       break;
01707     case 'S' :
01708       /* special case: not taken into account in createvar */
01709       Nbvars = Max(*number,Nbvars);
01710       if ( !cre_smat_from_str(fname,&lw1, m, n, (char **) iptr, nlgh)) 
01711         return FALSE_;
01712       C2F(intersci).iwhere[*number - 1] = *Lstk(lw1);
01713       C2F(intersci).ntypes[*number - 1] = '$';
01714       break;
01715     case 's' :
01716       /* special case: not taken into account in createvar */
01717       Nbvars = Max(*number,Nbvars);
01718       if ( !cre_sparse_from_ptr(fname,&lw1, m, n, (SciSparse *) iptr, nlgh))
01719         return FALSE_;
01720       C2F(intersci).iwhere[*number - 1] = *Lstk(lw1);
01721       C2F(intersci).ntypes[*number - 1] = '$';
01722       break;
01723     default :
01724       Scierror(999,"%s: createvarfromptr was called with bad second argument!\r\n",fname);
01725       return FALSE_;
01726     }
01727   /*     this object will be copied with a vcopyobj in putlhsvar */
01728   return TRUE_; 
01729 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() creatework ( integer number,
integer m,
integer lr 
)

Definition at line 1094 of file stack2.c.

References Bot, C2F, cremat(), FALSE_, Get_Iname(), iadr, intersiz, lcs, Lstk, Max, Nbvars, nlgh, Rhs, sadr, Top, and TRUE_.

01095 {
01096   int n,it=0,lw1,lcs,il;
01097   char *fname = Get_Iname();
01098   if (*number > intersiz) {
01099     Scierror(999,"%s: (creatework) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01100              fname);
01101     return FALSE_ ;
01102   }
01103   Nbvars = Max(*number,Nbvars);
01104   lw1 = *number + Top - Rhs;
01105   if (lw1 < 0) {
01106     Scierror(999,"%s: bad call to creatework! (1rst argument)\r\n",
01107              fname);
01108     return FALSE_ ;
01109   }
01110   il = iadr(*Lstk(lw1));
01111   *m = *Lstk(Bot ) - sadr(il+4);
01112   n = 1;
01113   if (! C2F(cremat)(fname, &lw1, &it, m, &n, lr, &lcs, nlgh))    return FALSE_;
01114   return TRUE_; 
01115 }

Here is the call graph for this function:

int C2F() elementtype ( integer lnumber,
integer number 
)

Definition at line 1447 of file stack2.c.

References FALSE_, Get_Iname(), iadr, ili, istk, ix, Lstk, Rhs, sadr, and Top.

01448 {
01449   integer il,lw,itype,n,ix,ili;
01450   char *fname = Get_Iname();
01451 
01452   if (*lnumber > Rhs) {
01453     Scierror(999,"%s: bad call to elementtype! \r\n",fname);
01454     return FALSE_;
01455   }
01456 
01457   lw = *lnumber + Top - Rhs; /*index of the variable numbered *lnumber in the stack */
01458   il = iadr(*Lstk(lw)); 
01459   if (*istk(il) < 0) il = iadr(*istk(il + 1));
01460   itype = *istk(il ); /* type of the variable numbered *lnumber */
01461   if (itype < 15 || itype > 17) { /* check if it is really a list */
01462     Scierror(210,"%s: Argument %d: wrong type argument, expecting a list\r\n",fname,*lnumber);
01463     return FALSE_;
01464   }
01465   n = *istk(il + 1);/* number of elements in the list */
01466   itype = 0; /*default answer if *number is not a valid element index */
01467   if (*number<=n && *number>0) {
01468     ix = sadr(il + 3 + n); /* adress of the first list element */
01469     if (*istk(il + 1+ *number) < *istk(il + *number + 2)) { /* the required element is defined */
01470       ili = iadr(ix + *istk(il + 1+ *number) - 1); /* adress of the required element */
01471       itype = *istk(ili);
01472     }
01473   }
01474   return itype;
01475 }

Here is the call graph for this function:

int C2F() errorinfo ( char *  fname,
integer info,
unsigned long  fname_len 
)

Definition at line 2373 of file stack2.c.

References fname_len, and get_fname().

Referenced by C2F(), intdsyev(), and intzgeesx().

02374 {
02375   Scierror(998,"%s: internal error, info=%d\r\n",get_fname(fname,fname_len),*info);
02376   return 0;
02377 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() findopt ( char *  str,
rhs_opts  opts[] 
)

Definition at line 133 of file stack2.c.

References i, pos, and rhs_opt_find().

00134 {
00135   int i, pos;
00136 
00137   pos = 0;
00138   i = rhs_opt_find(str,opts);
00139   if ( i>=0 ) 
00140     if (opts[i].position>0) 
00141       pos = opts[i].position;
00142   
00143   return(pos);
00144 }

Here is the call graph for this function:

integer C2F() firstopt (  ) 

Definition at line 115 of file stack2.c.

References Infstk, Rhs, and Top.

00117 {
00118   integer k;
00119   for (k = 1; k <= Rhs ; ++k) 
00120     if (*Infstk(k + Top - Rhs )==1)
00121       return k;
00122   return(Rhs+1);
00123 }

static char* Get_Iname (  )  [static]

Definition at line 2792 of file stack2.c.

References C2F, cvname(), cx1, i, nlgh, and nsiz.

Referenced by check_dim_prop(), check_dims(), check_length(), check_list_one_dim(), check_list_prop(), check_one_dim(), check_prop(), check_same_dims(), createcvar(), createcvarfrom(), createcvarfromptr(), createdata(), createlist(), createlistcvarfrom(), createlistcvarfromptr(), createlistvarfrom(), createlistvarfromptr(), createvar(), createvarfrom(), createvarfromptr(), creatework(), elementtype(), getlistrhscvar(), getlistrhsvar(), getmatdims(), getrhscvar(), getrhsvar(), and setworksize().

02793 {
02794   int i;
02795   C2F(cvname)(&C2F(recu).ids[(C2F(recu).pt + 1) * nsiz - nsiz], Fname, &cx1, nlgh);
02797   for (i=0 ; i < nlgh ; i++) if (Fname[i]==' ') { Fname[i]='\0'; break;} 
02798   Fname[nlgh]='\0'; 
02799   return Fname;
02800 }

Here is the call graph for this function:

Here is the caller graph for this function:

int get_optionals ( char *  fname,
rhs_opts  opts[] 
)

Definition at line 274 of file stack2.c.

References Error, GetRhsVar, i, isopt(), IsOpt, rhs_opts__::l, rhs_opts__::m, rhs_opts__::n, name, nlgh, NULL, NumOpt, rhs_opts__::position, Rhs, rhs_opt_find(), rhs_opt_print_names(), sciprint(), and rhs_opts__::type.

Referenced by intex2c(), sci_champ_G(), sci_drawaxis(), sci_fec(), sci_grayplot(), sci_matplot(), sci_param3d(), sci_param3d1(), sci_plot2d(), sci_plot2d1_G(), sci_plot3d(), sci_xsetech(), and sci_xtitle().

00275 {
00276   int k,i=0;
00277   char name[nlgh+1];
00278   int nopt = NumOpt(); /* optional arguments on the stack */
00279 
00280   /* reset first field since opts is declared static in calling function */
00281   /* this could be avoided with ansi compilers by removing static in the 
00282    * opts declaration */
00283 
00284   while ( opts[i].name != NULL )
00285     {
00286       opts[i].position = -1;
00287       i++;
00288     }
00289 
00290   /* Walking through last arguments */
00291 
00292   for ( k = Rhs - nopt + 1; k <= Rhs ;k++)
00293     {
00294       if ( IsOpt(k,name) == 0  ) 
00295         {
00296           Scierror(999,"%s: optional arguments name=val must be at the end\r\n",fname);
00297           return 0;
00298         }
00299       else 
00300         {
00301           int isopt = rhs_opt_find(name,opts);
00302           if ( isopt >= 0 ) 
00303             {
00304               rhs_opts *ro = &opts[isopt];
00305               ro->position = k;
00306               if (ro->type[0] != '?')
00307                 GetRhsVar(ro->position, ro->type,&ro->m,&ro->n,&ro->l);
00308             }
00309           else 
00310             {
00311               sciprint("%s: unrecognized optional arguments %s\r\n",fname,name);
00312               rhs_opt_print_names(opts) ;
00313               Error(999); 
00314               return(0);
00315             }
00316         }
00317     }
00318   return 1;
00319 }

Here is the call graph for this function:

Here is the caller graph for this function:

void* GetData ( int  lw  ) 

Definition at line 3080 of file stack2.c.

References C2F, Lstk, Rhs, stk, and Top.

Referenced by __PARAMS(), C2F(), createreffromname(), empty(), int_objfprintfMat(), intcpass2(), intdiffobjs(), intgetscicosvarsc(), intscicosimc(), intspvm_bcast(), intspvm_f772sci(), intspvm_sci2f77(), intspvm_send(), mexGetVariable(), mxCreateLogicalMatrix(), mxGetCell(), mxGetField(), mxGetFieldByNumber(), sciReturnUserData(), and set_user_data_property().

03081              : header = (int *) GetData(lw); header[0] = type of variable lw etc */
03082 {
03083   int lw1 = lw + Top - Rhs ;
03084   int l1 = *Lstk(lw1);
03085   int *loci = (int *) stk(l1);
03086   if (loci[0] < 0) 
03087     {
03088       l1 = loci[1];
03089       loci = (int *) stk(l1);
03090     }
03091   C2F(intersci).ntypes[lw - 1] = '$';
03092   C2F(intersci).iwhere[lw - 1] = l1;
03093   C2F(intersci).lad[lw - 1] = l1;
03094   return loci;
03095 }

Here is the caller graph for this function:

void* GetDataFromName ( char *  name  ) 

Definition at line 3125 of file stack2.c.

References C2F, fin, iadr, istk, Lstk, and objptr().

Referenced by Java_javasci_SciBooleanArray_getColFromScilab(), Java_javasci_SciBooleanArray_getRowFromScilab(), Java_javasci_SciComplexArray_getColFromScilab(), Java_javasci_SciComplexArray_getRowFromScilab(), Java_javasci_SciDoubleArray_getColFromScilab(), Java_javasci_SciDoubleArray_getRowFromScilab(), Java_javasci_Scilab_receiveDataByName(), Java_javasci_Scilab_TypeVar(), Java_javasci_SciStringArray_getColFromScilab(), and Java_javasci_SciStringArray_getRowFromScilab().

03126              :  header = (int *) GetDataFromName("pipo"); header[0] = type of variable pipo etc... */
03127 {
03128   void *header; int lw; int fin;
03129  if (C2F(objptr)(name,&lw,&fin,strlen(name))) {
03130     header = istk( iadr(*Lstk(fin)));  
03131     return (void *) header;
03132   }
03133  else
03134     {  
03135       Scierror(999,"GetDataFromName: variable %s not found\r\n",name);
03136       return (void *) 0;
03137     }
03138 }

Here is the call graph for this function:

Here is the caller graph for this function:

int GetDataSize ( int  lw  ) 

Definition at line 3097 of file stack2.c.

References Lstk, Rhs, stk, and Top.

Referenced by set_user_data_property().

03099 {
03100   int lw1 = lw + Top - Rhs ;
03101   int l1 = *Lstk(lw1);
03102   int *loci = (int *) stk(l1);
03103   int n =  *Lstk(lw1+1)-*Lstk(lw1);
03104   if (loci[0] < 0) 
03105     {
03106       l1 = loci[1];
03107       loci = (int *) stk(l1);
03108       n=loci[3];
03109     }
03110   return n;
03111 }

Here is the caller graph for this function:

int C2F() getlistrhscvar ( integer lnumber,
integer number,
char *  typex,
integer it,
integer m,
integer n,
integer lr,
integer lc,
unsigned long  type_len 
)

Definition at line 1619 of file stack2.c.

References C2F, FALSE_, Get_Iname(), iadr, intersiz, istk, Max, Nbvars, nlgh, Rhs, sstk, stk, Top, and TRUE_.

01620 {
01621   integer ix1, topk= Top, lw;
01622   char *fname = Get_Iname();
01623   unsigned  char    Type = * typex;
01624 
01625   Nbvars = Max(Nbvars,*lnumber);
01626   lw = *lnumber + Top - Rhs;
01627   if (*lnumber > Rhs) {
01628     Scierror(999,"%s: bad call to getlistrhscvar! (1rst argument)\r\n",fname);
01629     return FALSE_;
01630   }
01631   if (*lnumber > intersiz) {
01632     Scierror(999,"%s: (getlistrhscvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01633              fname);
01634     return FALSE_;
01635   }
01636   switch ( Type ) {
01637   case 'd' :
01638     if (! C2F(getlistmat)(fname, &topk, &lw, number, it, m, n, lr, lc, nlgh)) return FALSE_;
01639     break;
01640   case 'r' :
01641     if (! C2F(getlistmat)(fname, &topk, &lw, number, it, m, n, lr, lc, nlgh)) 
01642       return FALSE_;
01643     ix1 = *m * *n * (*it + 1);
01644     C2F(simple)(&ix1, stk(*lr), sstk(iadr(*lr)));
01645     *lr  = iadr(*lr);
01646     *lc = *lr + *m * *n;
01647     break;
01648   case 'i' :
01649     if (! C2F(getlistmat)(fname, &topk, &lw, number, it, m, n, lr, lc, nlgh)) 
01650       return FALSE_;
01651     ix1 = *m * *n * (*it + 1);
01652     C2F(entier)(&ix1, stk(*lr), istk(iadr(*lr)));
01653     *lr = iadr(*lr) ;
01654     *lc = *lr + *m * *n;
01655     break;
01656   default :
01657     Scierror(999,"%s: getlistrhscvar was called with  bad third argument!\r\n",fname);
01658     return FALSE_;
01659   }
01660   /* can't perform back data conversion with lists */
01661   C2F(intersci).ntypes[*number - 1] = '$';
01662   return TRUE_;
01663 }

Here is the call graph for this function:

int C2F() getlistrhsvar ( integer lnumber,
integer number,
char *  typex,
integer m,
integer n,
integer lr,
unsigned long  type_len 
)

Definition at line 1490 of file stack2.c.

References C2F, cadr, cstk, cx1, sciintmat::D, double2z(), FALSE_, Get_Iname(), getlistbmat(), getlistimat(), getlistpointer(), getlistsimat(), getlistsparse(), getlistwsmat(), scisparse::I, iadr, scisparse::icol, icol, ierr, il1, in2str(), intersiz, istk, sciintmat::it, scisparse::it, sciintmat::l, lr1, sciintmat::m, scisparse::m, m1, Max, scisparse::mnel, mnel, sciintmat::n, scisparse::n, n1, Nbvars, scisparse::nel, nlgh, scisparse::R, Rhs, sadr, ScilabMStr2CM(), SciToF77(), sstk, stk, Top, and TRUE_.

Referenced by getrhssys().

01491 {
01492   int lr1;
01493   char **items;
01494   int il1,ild1,nn,ierr=0;
01495   char *fname = Get_Iname();
01496   integer m1, n1, lc, it, lw, topk = Top, ix1,ix2;
01497   unsigned char Type = *typex;   
01498   integer mnel,icol;
01499   SciSparse *Sp;
01500   SciIntMat *Im;
01501 
01502   Nbvars = Max(Nbvars,*lnumber);
01503   lw = *lnumber + Top - Rhs;
01504   if (*lnumber > Rhs) {
01505     Scierror(999,"%s: bad call to getlistrhsvar! (1rst argument)\r\n",fname);
01506     return FALSE_;
01507   }
01508   if (*lnumber > intersiz) {
01509     Scierror(999,"%s: (getlistrhsvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01510              fname);
01511     return FALSE_;
01512   }
01513 
01514   switch ( Type ) { 
01515   case 'c' : 
01516     *n = 1;
01517     if (! C2F(getlistsimat)(fname, &topk, &lw, number, &m1, &n1, &cx1, &cx1,lr, m, nlgh)) 
01518       return FALSE_;
01519     ix2 = *m * *n;
01520     C2F(in2str)(&ix2, istk(*lr), cstk(cadr(*lr)), ix2 + 1);
01521     *lr = cadr(*lr);
01522     break;
01523   case 'd' : 
01524     if (! C2F(getlistmat)(fname, &topk, &lw, number, &it, m, n, lr, &lc, nlgh))
01525       return FALSE_;
01526     break;
01527   case 'r' :
01528     if (! C2F(getlistmat)(fname, &topk, &lw, number, &it, m, n, lr, &lc, nlgh))
01529       return FALSE_;
01530     ix1 = *m * *n;
01531     C2F(simple)(&ix1, stk(*lr), sstk(iadr(*lr)));
01532     *lr = iadr(*lr);
01533     break;
01534   case 'i' :
01535     if (! C2F(getlistmat)(fname, &topk, &lw, number, &it, m, n, lr, &lc, nlgh))
01536       return FALSE_;
01537     ix1 = *m * *n;
01538     C2F(entier)(&ix1, stk(*lr), istk(iadr(*lr)));
01539     *lr = iadr(*lr);
01540     break;
01541   case 'b' :
01542     if (! C2F(getlistbmat)(fname, &topk, &lw, number, m, n, lr, nlgh)) 
01543       return FALSE_;
01544     *lr = *lr;
01545     break;
01546   case 'z' :
01547     if (! C2F(getlistmat)(fname, &topk, &lw,number, &it, m, n, lr, &lc, nlgh)) return FALSE_;
01548     ix2 = *m * *n;
01549     if ((it != 1) && (ix2 !=0)){
01550       Scierror(999,"%s: argument %d >(%d) should be a complex matrix\r\n",
01551                fname, Rhs + (lw -topk) , *number);
01552       return FALSE_;
01553     };
01554       if (!(*lr % 2) ) {  /* bad adress (lr is even) shift up the stack */
01555         double2z(stk(*lr), stk(*lr)-1, ix2, ix2);
01556         ix2=2*ix2;
01557         *istk(iadr(*lr)-4)=133;
01558         *istk(iadr(*lr)-3)=iadr(*lr + ix2);
01559         *istk( iadr(*lr + ix2) )= *m;
01560         *istk( iadr(*lr + ix2) +1 )= *n;
01561         *lr = sadr(*lr-1); 
01562       } else
01563         {
01564       SciToF77(stk(*lr), ix2, ix2);
01565       *lr = sadr(*lr);
01566         }
01567     break;
01568   case 'S' :
01570     if (! C2F(getlistwsmat)(fname,&topk,&lw,number,m,n,&il1,&ild1, nlgh)) return FALSE_;
01571     nn= (*m)*(*n);
01572     ScilabMStr2CM(istk(il1),&nn,istk(ild1),&items,&ierr);
01573     if ( ierr == 1) return FALSE_;
01574     Type = '$';
01575     /*
01576      * Warning : lr must have the proper size when calling getrhsvar 
01577      * char **Str1; .... GetRhsVar(...., &lr) 
01578      */
01579     *((char ***) lr) = items ;
01580     break;
01581   case 's' :
01582     /* sparse matrices */ 
01583     Sp = (SciSparse *) lr ;
01584     if (! C2F(getlistsparse)(fname,&topk,&lw,number,&it,m,n,&(Sp->nel),&mnel,&icol,&lr1,&lc,nlgh))
01585       return FALSE_;
01586     Sp->m = *m ; Sp->n = *n ; Sp->it = it; 
01587     Sp->mnel = istk(mnel);
01588     Sp->icol = istk(icol);
01589     Sp->R = stk(lr1);
01590     Sp->I = stk(lc);
01591     Type = '$';
01592     break;
01593   case 'I' :
01594     /* int matrices */ 
01595     Im = (SciIntMat *) lr ;
01596     if (! C2F(getlistimat)(fname,&topk,&lw,number,&it,m,n,&lr1,nlgh))
01597       return FALSE_;
01598     Im->m = *m ; Im->n = *n ; Im->it = it; Im->l = lr1;
01599     Im->D = istk(lr1);
01600     Type = '$';
01601     break;
01602   case 'p' :
01603     if (! C2F(getlistpointer)(fname, &topk, &lw, number, lr,  nlgh))
01604       return FALSE_;
01605     break;
01606   default :
01607     Scierror(999,"%s: getlistrhsvar was called with bad third argument (%c)\r\n",fname,Type);
01608     return FALSE_;
01609   }
01610   /* can't perform back data conversion with lists */
01611   C2F(intersci).ntypes[*number - 1] = '$';
01612   return TRUE_ ; 
01613 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() getmatdims ( integer number,
integer m,
integer n 
)

Definition at line 1156 of file stack2.c.

References FALSE_, Get_Iname(), iadr, istk, Lstk, Rhs, Top, TRUE_, and typ.

01157 {
01158   char *fname = Get_Iname();
01159   integer il,lw,typ;
01160 
01161   lw = *number + Top - Rhs;
01162   if ( *number > Rhs) {
01163     Scierror(999,"%s: bad call to getmatdims! (1rst argument)\r\n",fname);
01164     return FALSE_;
01165   }
01166 
01167   il = iadr(*Lstk(lw));
01168   if (*istk(il ) < 0) il = iadr(*istk(il +1));
01169   typ = *istk(il );
01170   if (typ > 10) {
01171     Scierror(201,"%s: argument %d should be a matrix\r\n", fname,*number);
01172     return  FALSE_;    
01173   }
01174   *m = *istk(il + 1);
01175   *n = *istk(il + 2);
01176   return TRUE_;
01177 }

Here is the call graph for this function:

integer C2F() getopcode ( char *  string,
unsigned long  string_len 
)

Definition at line 2060 of file stack2.c.

References op, and string_len.

Referenced by scistring().

02061 {
02062   unsigned char ch = string[0];
02063   integer op = 0;
02064   if (  string_len >= 2) {
02065     /*     .op  or op. */
02066     if ( ch  == '.') ch = string[1];
02067     op += 51;
02068   }
02069   switch ( ch ) 
02070     {
02071     case  '*'  :  op += 47; break;
02072     case  '+'  :  op += 45; break;
02073     case  '-'  :  op += 46; break;
02074     case  '\'' :  op += 53; break;
02075     case  '/'  :  op += 48; break;
02076     case  '\\' :  op += 49; break;
02077     case  '^'  :  op += 62; break;
02078     }
02079   return op;
02080 }

Here is the caller graph for this function:

void* GetRawData ( int  lw  ) 

Definition at line 3113 of file stack2.c.

References C2F, Lstk, Rhs, stk, and Top.

Referenced by changetoref(), createreference(), mexGetArray(), mexGetVariablePtr(), and mxDuplicateArray().

03115 {
03116   int lw1 = lw + Top - Rhs ;
03117   int l1 = *Lstk(lw1);
03118   int *loci = (int *) stk(l1);
03119   C2F(intersci).ntypes[lw - 1] = '$';
03120   C2F(intersci).iwhere[lw - 1] = l1;
03121   /*  C2F(intersci).lad[lw - 1] = l1;  to be checked */
03122   return loci;
03123 }

Here is the caller graph for this function:

int C2F() getrhscvar ( integer number,
char *  typex,
integer it,
integer m,
integer n,
integer lr,
integer lc,
unsigned long  type_len 
)

Definition at line 1398 of file stack2.c.

References C2F, FALSE_, Get_Iname(), getmat(), iadr, intersiz, istk, Lstk, Max, Nbvars, nlgh, Rhs, sstk, stk, Top, and TRUE_.

01399 {
01400   integer ix1, lw, topk;
01401   unsigned char Type = *typex;
01402   char *fname = Get_Iname();
01403   
01404   Nbvars = Max(Nbvars,*number);
01405   lw = *number + Top - Rhs;
01406   if (*number > Rhs) {
01407     Scierror(999,"%s: bad call to getrhscvar! (1rst argument)\r\n", fname);
01408     return FALSE_;
01409   }
01410   if (*number > intersiz) {
01411     Scierror(999,"%s: (getrhscvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01412              fname);
01413     return FALSE_;
01414   }
01415   topk = Top;
01416   switch ( Type ) {
01417   case 'd' :
01418     if (! C2F(getmat)(fname, &topk, &lw, it, m, n, lr, lc, nlgh)) return FALSE_;
01419     break;
01420   case 'r' :
01421     if (! C2F(getmat)(fname, &topk, &lw, it, m, n, lr, lc, nlgh)) return FALSE_;
01422     ix1 = *m * *n * (*it + 1);
01423     C2F(simple)(&ix1, stk(*lr), sstk(iadr(*lr)));
01424     *lr = iadr(*lr);
01425     *lc = *lr + *m * *n;
01426     break;
01427   case 'i' :
01428     if (! C2F(getmat)(fname, &topk, &lw, it, m, n, lr, lc, nlgh)) return FALSE_;
01429     ix1 = *m * *n * (*it + 1);
01430     C2F(entier)(&ix1, stk(*lr), istk(iadr(*lr)));
01431     *lr = iadr(*lr);
01432     *lc = *lr + *m * *n;
01433     break;
01434   }
01435   C2F(intersci).ntypes[*number - 1] = Type;
01436   C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01437   C2F(intersci).lad[*number - 1] = *lr;
01438   return TRUE_;
01439 }

Here is the call graph for this function:

int C2F() getrhssys ( integer lw,
integer n,
integer m,
integer p,
integer ptra,
integer ptrb,
integer ptrc,
integer ptrd,
integer ptrx0,
double *  hx 
)

Definition at line 2287 of file stack2.c.

References C2F, cx2, cx4, FALSE_, getlistrhsvar(), getrhsvar(), iadr, istk, ix, L, ma, mb, md, na, nb, nc, nd, sadr, stk, and TRUE_.

02288 {
02289   integer cx2 = 2, cx3 = 3, cx4 = 4, cx5 = 5, cx6 = 6;
02290   integer ix1, junk, msys, nsys, ix, icord;
02291   integer ma, na, mb, nb, mc, nc, il, md, nd;
02292   integer mx0, nx0, ptrsys, itimedomain;
02293   static integer iwork[23] = { 10,1,7,0,1,4,5,6,7,8,10,12,21,28,28,-10,-11,
02294                                -12,-13,-33,0,13,29 };
02295   if (! C2F(getrhsvar)(lw, "t", &msys, &nsys, &ptrsys, 1L)) return FALSE_;
02296   il = iadr(ptrsys) - msys - 1;
02297   /*     syslin tlist=[ chain, (A,B,C,D,X0) ,chain or scalar ]
02298    *                     10     1 1 1 1 1      10       1    
02299    */
02300   junk = il + msys + iadr(*istk(il));
02301   if ( *istk(junk) != 10) return FALSE_;
02302   if ( *istk(il + msys + iadr(*istk(il + 1))) != 1) return FALSE_;
02303   if ( *istk(il + msys + iadr(*istk(il + 2))) != 1) return FALSE_;
02304   if ( *istk(il + msys + iadr(*istk(il + 3))) != 1) return FALSE_;
02305   if ( *istk(il + msys + iadr(*istk(il + 4))) != 1) return FALSE_;
02306   if ( *istk(il + msys + iadr(*istk(il + 5))) != 1) return FALSE_;
02307   itimedomain = *istk(il + msys + iadr(*istk(il + 6)));
02308   switch ( itimedomain ) {
02309   case 10 :
02310     /* Sys(7)='c' or 'd' */
02311     icord = *istk(il + msys + iadr(*istk(il + 6))+ 6);
02312     switch ( icord ) 
02313       {
02314       case 12 :  *hx = 0.; break;
02315       case 13 :  *hx = 1.; break;
02316       default : 
02317         Scierror(999,"invalid time domain\r\n");
02318         return FALSE_;
02319       }
02320     break;
02321   case 1 : 
02322     /*     Sys(7)=h */
02323     ix1 = il + msys + iadr(*istk(il + 6)) + 4;
02324     *hx = *stk(sadr(ix1));
02325     break;
02326   default : 
02327     Scierror(999,"invalid time domain\r\n");
02328     return FALSE_;
02329   }
02330   for (ix = 0; ix < 23; ++ix) 
02331     {
02332       if (iwork[ix] != *istk(junk + ix)) {
02333         Scierror(999,"invalid system\r\n");
02334         return FALSE_;
02335       }
02336     }
02337   if (! C2F(getlistrhsvar)(lw, &cx2, "d", &ma, &na, ptra, 1L)) return FALSE_;
02338   if (! C2F(getlistrhsvar)(lw, &cx3, "d", &mb, &nb, ptrb, 1L)) return FALSE_;
02339   if (! C2F(getlistrhsvar)(lw, &cx4, "d", &mc, &nc, ptrc, 1L)) return FALSE_;
02340   if (! C2F(getlistrhsvar)(lw, &cx5, "d", &md, &nd, ptrd, 1L)) return FALSE_;
02341   if (! C2F(getlistrhsvar)(lw, &cx6, "d", &mx0, &nx0, ptrx0, 1L))  return FALSE_;
02342   if (ma != na) {
02343     Scierror(999,"A matrix non square!\r\n");
02344     return FALSE_;
02345   }
02346   if (ma != mb && mb != 0) {
02347     Scierror(999,"Invalid A,B matrices\r\n");
02348     return FALSE_;
02349   }
02350   if (ma != nc && nc != 0) {
02351     Scierror(999,"Invalid A,C matrices\r\n");
02352     return FALSE_;
02353   }
02354   if (mc != md && md != 0) {
02355     Scierror(999,"Invalid C,D matrices\r\n");
02356     return FALSE_;
02357   }
02358   if (nb != nd && nd != 0) {
02359     Scierror(999,"Invalid B;D matrices\r\n");
02360     return FALSE_;
02361   }
02362   *n = ma;
02363   *m = nb;
02364   *p = mc;
02365   return TRUE_;
02366 }

Here is the call graph for this function:

int C2F() getrhsvar ( integer number,
char *  typex,
integer m,
integer n,
integer lr,
unsigned long  type_len 
)

Definition at line 1195 of file stack2.c.

References C2F, cadr, cstk, cx1, sciintmat::D, double2z(), FALSE_, Get_Iname(), getbmat(), getexternal(), gethmat(), getilist(), getimat(), getmat(), getpointer(), getsmat(), getsparse(), getwsmat(), scisparse::I, iadr, scisparse::icol, icol, ierr, il1, in2str(), intersiz, istk, sciintmat::it, scisparse::it, sciintmat::l, lr1, Lstk, sciintmat::m, scisparse::m, m1, Max, scisparse::mnel, mnel, sciintmat::n, scisparse::n, n1, Nbvars, scisparse::nel, nlgh, nsiz, NULL, overloadtype(), scisparse::R, Rhs, sadr, ScilabMStr2CM(), SciToF77(), setfeval(), sstk, stk, Top, and TRUE_.

Referenced by getrhssys(), GetScalarDouble(), and GetScalarInt().

01196 {
01197   int ierr=0,il1,ild1,nn;
01198   int lrr;
01199   char *fname = Get_Iname();
01200   char **items, namex[nlgh+1];
01201   unsigned char Type = *(unsigned char *) typex;
01202   integer topk,ltype, m1, n1, lc,lr1, it=0, lw, ile, ils, ix1,ix2;
01203   integer mnel,icol;
01204   SciSparse *Sp;
01205   SciIntMat *Im;
01206   /* we accept a call to getrhsvar after a createvarfromptr call */
01207   if ( *number > Rhs && *number > Nbvars ) {
01208     Scierror(999,"%s: bad call to getrhsvar! (1rst argument)\r\n",fname);
01209     return FALSE_;
01210   }
01211 
01212   Nbvars = Max(Nbvars,*number);
01213   lw = *number + Top - Rhs;
01214 
01215   if (*number > intersiz) {
01216     Scierror(999,"%s: (getrhsvar) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01217              fname);
01218     return FALSE_;
01219   }
01220 
01221   if (  C2F(overloadtype)(&lw,fname,&Type) == 0) return FALSE_;
01222   
01223   topk = Top;
01224   switch ( Type ) 
01225     {
01226     case 'c' : 
01227       *n = 1;
01228       if (! C2F(getsmat)(fname,&topk,&lw,&m1,&n1,&cx1,&cx1,lr,m, nlgh))
01229         return FALSE_;
01230       ix2 = *m * *n;
01231       /* in case where ix2 is 0 in2str adds the \0 char after the end of
01232          the storage of the variable, so it writes over the next variable 
01233          tp avoid this pb we shift up by one the location where the 
01234          data is written*/
01235       lrr=*lr;
01236       if (ix2==0) lrr--;
01237 
01238       C2F(in2str)(&ix2, istk(*lr), cstk(cadr(*lr)), ix2 + 1);
01239       *lr = cadr(*lr);
01240       C2F(intersci).ntypes[*number - 1] = Type ;
01241       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01242       C2F(intersci).lad[*number - 1] = *lr;
01243       break;
01244 
01245     case 'd' :
01246       if (! C2F(getmat)(fname, &topk, &lw, &it, m, n, lr, &lc, nlgh)) return FALSE_;
01247       C2F(intersci).ntypes[*number - 1] = Type ;
01248       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01249       C2F(intersci).lad[*number - 1] = *lr;
01250       break ;
01251     case 'z' :
01252       if (! C2F(getmat)(fname, &topk, &lw, &it, m, n, lr, &lc, nlgh)) return FALSE_;
01253       ix2 = *m * *n;
01254       if ((it != 1) && (ix2 !=0)) {
01255         Scierror(999," Waiting for a complex argument (z)"); return FALSE_;
01256       };
01257       if (!(*lr % 2) ) {  /* bad adress (lr is even) shift up the stack */
01258         double2z(stk(*lr), stk(*lr)-1, ix2, ix2);
01259         *istk(iadr(*lr)-4)=133;
01260         *istk(iadr(*lr)-3)=iadr(*lr + 2*ix2-1);
01261         *istk( iadr(*lr + 2*ix2-1) )= *m;
01262         *istk( iadr(*lr + 2*ix2-1) +1 )= *n;
01263         C2F(intersci).ntypes[*number - 1] = Type ;
01264         C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01265         C2F(intersci).lad[*number - 1] = *lr-1;
01266         *lr = sadr(*lr-1);
01267       }
01268       else {
01269         SciToF77(stk(*lr), ix2, ix2);
01270         C2F(intersci).ntypes[*number - 1] = Type ;
01271         C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01272         C2F(intersci).lad[*number - 1] = *lr;
01273         *lr = sadr(*lr);
01274       };
01275       break ;
01276     case 'r' :
01277       if (! C2F(getmat)(fname, &topk, &lw, &it, m, n, lr, &lc, nlgh))  return FALSE_;
01278       ix1 = *m * *n;
01279       C2F(simple)(&ix1, stk(*lr), sstk(iadr(*lr)));
01280       *lr = iadr(*lr);
01281       C2F(intersci).ntypes[*number - 1] = Type ;
01282       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01283       C2F(intersci).lad[*number - 1] = *lr;
01284       break;
01285     case 'i' :
01286       if (! C2F(getmat)(fname, &topk, &lw, &it, m, n, lr, &lc, nlgh)) return FALSE_;
01287       ix1 = *m * *n;
01288       C2F(entier)(&ix1, stk(*lr), istk(iadr(*lr)));
01289       *lr = iadr(*lr) ;
01290       C2F(intersci).ntypes[*number - 1] = Type ;
01291       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01292       C2F(intersci).lad[*number - 1] = *lr;
01293       break;
01294     case 'b' : 
01295       if (! C2F(getbmat)(fname, &topk, &lw, m, n, lr, nlgh))  return FALSE_;
01296       C2F(intersci).ntypes[*number - 1] = Type ;
01297       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01298       C2F(intersci).lad[*number - 1] = *lr;
01299       break;
01300     case 'l' :    case 't' :    case 'm' :
01301       *n = 1;
01302       if (! C2F(getilist)(fname, &topk, &lw, m, n, lr, nlgh))  return FALSE_;
01303       /* No data conversion for list members ichar(type)='$' */
01304       Type = '$' ;
01305       C2F(intersci).ntypes[*number - 1] = Type ;
01306       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01307       C2F(intersci).lad[*number - 1] = *lr;
01308       break;
01309     case 'S' :
01311       if (! C2F(getwsmat)(fname,&topk,&lw,m,n,&il1,&ild1, nlgh)) return FALSE_;
01312       nn= (*m)*(*n);
01313       ScilabMStr2CM(istk(il1),&nn,istk(ild1),&items,&ierr);
01314       if ( ierr == 1) return FALSE_;
01315       Type = '$';
01316       /*
01317        * Warning : lr must have the proper size when calling getrhsvar 
01318        * char **Str1; .... GetRhsVar(...., &lr) 
01319        */
01320       *((char ***) lr) = items ;
01321       C2F(intersci).ntypes[*number - 1] = Type ;
01322       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01323       C2F(intersci).lad[*number - 1] = *lr;
01324       break;
01325     case 's' :
01326       /* sparse matrices */ 
01327       Sp = (SciSparse *) lr ;
01328       if (! C2F(getsparse)(fname,&topk,&lw,&it,m,n,&(Sp->nel),&mnel,&icol,&lr1,&lc,nlgh))
01329         return FALSE_;
01330       Sp->m = *m ; Sp->n = *n ; Sp->it = it; 
01331       Sp->mnel = istk(mnel);
01332       Sp->icol = istk(icol);
01333       Sp->R = stk(lr1);
01334       Sp->I = (it==1) ? stk(lc): NULL;
01335       Type = '$';
01336       C2F(intersci).ntypes[*number - 1] = Type ;
01337       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01338       C2F(intersci).lad[*number - 1] = *lr;
01339       break;
01340     case 'I' :
01341       /* int matrices */ 
01342       Im = (SciIntMat *) lr ;
01343       if (! C2F(getimat)(fname,&topk,&lw,&it,m,n,&lr1,nlgh))
01344         return FALSE_;
01345       Im->m = *m ; Im->n = *n ; Im->it = it; Im->l = lr1;
01346       Im->D = istk(lr1);
01347       Type = '$';
01348       C2F(intersci).ntypes[*number - 1] = Type ;
01349       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01350       C2F(intersci).lad[*number - 1] = *lr;
01351       break;
01352     case 'f' :
01353       /* XXXXXX : gros bug ici car getexternal a besoin de savoir 
01354          pour quelle fonction on recupere un external 
01355          or ici on presuppose que c'est setfeval 
01356          de plus on ne sait pas exactement de quel type d'external il s'agit
01357       */
01358          
01359       /*      int function getrhsvar(number,type,m,n,lr) */
01360       *lr = *Lstk(lw);
01361       ils = iadr(*lr) + 1;
01362       *m = *istk(ils);
01363       ile = ils + *m * nsiz + 1;
01364       *n = *istk(ile);
01365       if (! C2F(getexternal)(fname, &topk, &lw, namex, &ltype, C2F(setfeval), nlgh, 
01366                              nlgh)) {
01367         return FALSE_;
01368       }
01369       Type = '$';
01370       C2F(intersci).ntypes[*number - 1] = Type ;
01371       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01372       C2F(intersci).lad[*number - 1] = *lr;
01373       break;
01374     case 'p' : 
01375       if (! C2F(getpointer)(fname, &topk, &lw,lr, nlgh)) return FALSE_;
01376       C2F(intersci).ntypes[*number - 1] = Type ;
01377       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01378       C2F(intersci).lad[*number - 1] = *lr;
01379       break;
01380     case 'h' :
01381       if (! C2F(gethmat)(fname, &topk, &lw, m, n, lr, nlgh)) return FALSE_;
01382       C2F(intersci).ntypes[*number - 1] = Type ;
01383       C2F(intersci).iwhere[*number - 1] = *Lstk(lw);
01384       C2F(intersci).lad[*number - 1] = *lr;
01385       break ;
01386     }
01387   return TRUE_;
01388 } 

Here is the call graph for this function:

Here is the caller graph for this function:

integer C2F() gettype ( integer lw  ) 

Definition at line 178 of file stack2.c.

References iadr, istk, and Lstk.

00179 {
00180   integer il;
00181   il = iadr(*Lstk(*lw ));
00182   if (*istk(il ) < 0) il = iadr(*istk(il +1));
00183   return *istk(il);
00184 }

int C2F() in2str ( integer n,
integer line,
char *  str,
unsigned long  str_len 
)

Definition at line 2778 of file stack2.c.

References C2F, codetoascii(), and str_len.

Referenced by getlistrhsvar(), getrhsvar(), mxgetstring(), and mxGetString().

02779 {
02780   C2F(codetoascii)(n,line, str, str_len);
02781   str[*n] = '\0';
02782   return 0;
02783 } 

Here is the call graph for this function:

Here is the caller graph for this function:

static void intersci_pop ( void   )  [static]

Definition at line 3232 of file stack2.c.

References C2F, FREE, i, inter_s_::iwhere, iwhere, L_intersci, inter_s_::lad, lad, inter_s_::lhsvar, lhsvar, inter_l::nbvars, Nbvars, inter_l::next, inter_s_::ntypes, ntypes, NULL, and inter_l::state.

Referenced by scibuiltin(), and scifunction().

03233 {
03234   int i;
03235   intersci_list *loc = L_intersci;
03236   if ( loc == NULL ) return ;
03237   Nbvars =  loc->nbvars;
03238   for ( i = 0 ; i <  Nbvars ; i++ ) 
03239     {
03240       C2F(intersci).iwhere[i] =   loc->state[i].iwhere ;
03241       C2F(intersci).ntypes[i] =   loc->state[i].ntypes ;
03242       C2F(intersci).lad[i] =   loc->state[i].lad    ;
03243       C2F(intersci).lhsvar[i] =   loc->state[i].lhsvar ;
03244     }
03245   L_intersci = loc->next ;
03246   FREE(loc->state);
03247   FREE(loc);
03248 }

Here is the caller graph for this function:

static int intersci_push ( void   )  [static]

Definition at line 3209 of file stack2.c.

References C2F, i, iwhere, inter_s_::iwhere, L_intersci, inter_s_::lad, inter_s_::lhsvar, MALLOC, inter_l::nbvars, Nbvars, inter_l::next, inter_s_::ntypes, NULL, and inter_l::state.

Referenced by scibuiltin(), and scifunction().

03210 {
03211   int i;
03212   intersci_list *loc;
03213   intersci_state *new ;
03214   new = MALLOC( Nbvars * sizeof(intersci_state) );
03215   if (new == 0 ) return 0;
03216   loc = MALLOC( sizeof(intersci_list) );
03217   if ( loc == NULL ) return 0;
03218   loc->next = L_intersci;
03219   loc->state = new; 
03220   loc->nbvars =  Nbvars;
03221   for ( i = 0 ; i <  Nbvars ; i++ ) 
03222     {
03223       loc->state[i].iwhere = C2F(intersci).iwhere[i];
03224       loc->state[i].ntypes = C2F(intersci).ntypes[i];
03225       loc->state[i].lad    = C2F(intersci).lad[i];
03226       loc->state[i].lhsvar = C2F(intersci).lhsvar[i];
03227     }
03228   L_intersci = loc;
03229   return 1;
03230 }

Here is the caller graph for this function:

int C2F() isopt ( integer k,
char *  namex,
unsigned long  name_len 
)

Definition at line 85 of file stack2.c.

References C2F, FALSE_, i1, isoptlw(), name_len, nlgh, Rhs, Top, and TRUE_.

Referenced by get_optionals().

00086 {
00087   integer i1 =  *k + Top - Rhs;
00088   if ( C2F(isoptlw)(&Top, &i1, namex, name_len) == FALSE_) return FALSE_ ;
00089   /* add a '\0' at the end of the string removing trailing blanks */
00090   for ( i1 = nlgh-1 ; i1 >=0 ; i1--) { if ( namex[i1] != ' ') break ;} 
00091   namex[i1+1]='\0';
00092   return TRUE_;
00093 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() isoptlw ( integer topk,
integer lw,
char *  namex,
unsigned long  name_len 
)

Definition at line 102 of file stack2.c.

References C2F, cvname(), cx1, FALSE_, Infstk, name_len, nsiz, and TRUE_.

Referenced by isopt().

00103 {
00104   if (*Infstk(*lw ) != 1) return FALSE_ ;
00105   C2F(cvname)(&C2F(vstk).idstk[(*lw) * nsiz - nsiz], namex, &cx1, name_len);
00106   return TRUE_;
00107 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() isref ( integer number  ) 

Definition at line 376 of file stack2.c.

References FALSE_, iadr, istk, Lstk, number, Rhs, Top, and TRUE_.

Referenced by IsRef().

00377 {
00378   integer il,lw;
00379   lw = *number + Top - Rhs;
00380   if ( *number > Rhs) {
00381     Scierror(999,"isref: bad call to isref! (1rst argument)\r\n");
00382     return FALSE_;
00383   }
00384   il = iadr(*Lstk(lw));
00385   if ( *istk(il) < 0) 
00386     return TRUE_ ; 
00387   else 
00388     return FALSE_ ; 
00389 }

Here is the caller graph for this function:

int IsRef ( int  number  ) 

Definition at line 372 of file stack2.c.

References C2F, and isref().

Referenced by intspvm_f772sci(), intspvm_recv(), and intspvm_sci2f77().

00372                       { 
00373   return C2F(isref)(&number);
00374 }

Here is the call graph for this function:

Here is the caller graph for this function:

integer C2F() maxvol ( integer lw,
char *  lw_type,
unsigned long  type_len 
)

Definition at line 2394 of file stack2.c.

References Bot, cadr, iadr, Lstk, Rhs, sadr, and Top.

Referenced by intdsyev().

02395 {
02396   unsigned char Type =  *(unsigned char *)lw_type ;
02397   /* I like this one a lot: a kind of free jazz pattern  */
02398   integer m = *Lstk(Bot) - sadr(iadr(*Lstk(*lw + Top - Rhs)) +4);
02399   switch ( Type ) 
02400     {
02401     case 'd' : return m; break;
02402     case 'i' : return iadr(m);break;
02403     case 'r' : return iadr(m);break;
02404     case 'c' : return cadr(m);break;
02405     case 'z' : return sadr(m)-3;break;
02406     }
02407   /* should never get there */
02408   return m; 
02409 }

Here is the caller graph for this function:

int C2F() mklistfromvars ( integer pos,
integer n 
)

Definition at line 1786 of file stack2.c.

References C2F, convert2sci(), mklist(), Rhs, Top, and TRUE_.

01787 {
01788   integer tops =  Top;
01789   int k;
01790   for ( k= *pos; k < *pos+*n; k++) C2F(convert2sci)(&k);
01791   Top = Top - Rhs + *pos - 1 + *n;
01792   C2F(mklist)(n);
01793   Top = tops;
01794   C2F(intersci).ntypes[*pos - 1] = '$';
01795   return  TRUE_;
01796 } 

Here is the call graph for this function:

int C2F() mkmlistfromvars ( integer pos,
integer n 
)

Definition at line 1819 of file stack2.c.

References C2F, convert2sci(), Rhs, Top, TRUE_, and type.

Referenced by __PARAMS().

01820 {
01821   integer type=17;
01822   integer tops =  Top;
01823   int k;
01824   for ( k= *pos; k < *pos+*n; k++) C2F(convert2sci)(&k);
01825   Top = Top - Rhs + *pos - 1 + *n;
01826   C2F(mklistt)(n,&type);
01827   Top = tops;
01828   C2F(intersci).ntypes[*pos - 1] = '$';
01829   return  TRUE_;
01830 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() mktlistfromvars ( integer pos,
integer n 
)

Definition at line 1802 of file stack2.c.

References C2F, convert2sci(), Rhs, Top, TRUE_, and type.

01803 {
01804   integer type=16;
01805   integer tops =  Top;
01806   int k;
01807   for ( k= *pos; k < *pos+*n; k++) C2F(convert2sci)(&k);
01808   Top = Top - Rhs + *pos - 1 + *n;
01809   C2F(mklistt)(n,&type);
01810   Top = tops;
01811   C2F(intersci).ntypes[*pos - 1] = '$';
01812   return  TRUE_;
01813 } 

Here is the call graph for this function:

static int C2F() mvfromto ( integer itopl,
integer ix 
) [static]

Definition at line 2571 of file stack2.c.

References abs, C2F, cadr, crebmat(), crehmat(), cremat(), cresmat2(), cx1, dcopy(), FALSE_, iadr, icopy(), ilp, istk, ix, L, l, lad, lcs, lrs, Lstk, pointed, Rhs, size, stk, Top, TRUE_, unsfdcopy(), vcopyobj(), and z2double().

Referenced by convert2sci(), and putlhsvar().

02572 {
02573   integer ix1=0;
02574   integer m=0;
02575   integer n=0;
02576   integer it=0;
02577   integer lcs=0;
02578   integer lrs=0;
02579   integer l=0;
02580   integer size=0;
02581   integer pointed=0;
02582   unsigned long int ilp=0;
02583   unsigned char Type;
02584   double wsave;
02585 
02586   Type = (unsigned char)C2F(intersci).ntypes[*ix - 1];
02587   if ( Type != '$') 
02588     {
02589       /* int iwh = *ix + Top - Rhs;
02590          ilp = iadr(*Lstk(iwh)); */ 
02591       int iwh = C2F(intersci).iwhere[*ix - 1];
02592       ilp = iadr(iwh); 
02593       if ( *istk(ilp) < 0)  ilp = iadr(*istk(ilp +1));
02594       m =*istk(ilp +1);
02595       n =*istk(ilp +2);
02596       it = *istk(ilp +3);
02597     }
02598 
02599   switch ( Type ) {
02600   case 'i' : 
02601     if (! C2F(cremat)("mvfromto", itopl, &it, &m, &n, &lrs, &lcs, 8L)) {
02602       return FALSE_;
02603     }
02604     ix1 = m * n * (it + 1);
02605     C2F(stacki2d)(&ix1, &C2F(intersci).lad[*ix - 1], &lrs);
02606     C2F(intersci).lad[*ix - 1] = iadr(lrs);
02607     break ;
02608   case 'r' :
02609     if (! C2F(cremat)("mvfromto", itopl, &it, &m, &n, &lrs, &lcs, 8L)) {
02610       return FALSE_;
02611     }
02612     ix1 = m * n * (it + 1);
02613     C2F(stackr2d)(&ix1, &C2F(intersci).lad[*ix - 1], &lrs);
02614     C2F(intersci).lad[*ix - 1] = iadr(lrs);
02615     break;
02616   case 'd' :
02617     if (! C2F(cremat)("mvfromto", itopl, &it, &m, &n, &lrs, &lcs, 8L)) {
02618       return FALSE_;
02619     }
02620     /* no copy if the two objects are the same 
02621      * the cremat above is kept to deal with possible size changes 
02622      */
02623     if (C2F(intersci).lad[*ix - 1] != lrs) {
02624       ix1 = m * n * (it + 1);
02625       l=C2F(intersci).lad[*ix - 1];
02626       if (abs(l-lrs)<ix1)
02627         C2F(unsfdcopy)(&ix1, stk(l), &cx1, stk(lrs), &cx1);
02628       else
02629         C2F(dcopy)(&ix1, stk(l), &cx1, stk(lrs), &cx1);
02630       C2F(intersci).lad[*ix - 1] = lrs;
02631     }
02632     break;
02633   case 'z' :
02634     if ( *istk(ilp) == 133 ) {
02635       wsave=*stk(C2F(intersci).lad[*ix - 1]); 
02636       n=*istk(m+1);
02637           m=*istk(m);
02638           it=1;
02639       if (! C2F(cremat)("mvfromto", itopl, &it, &m, &n, &lrs, &lcs, 8L)) {
02640       return FALSE_;  }
02641       z2double(stk(C2F(intersci).lad[*ix - 1]),stk(lrs),m*n, m*n);
02642       *stk(lrs)=wsave;
02643       C2F(intersci).lad[*ix - 1] = lrs;
02644       }
02645     else { 
02646       if (! C2F(cremat)("mvfromto", itopl, &it, &m, &n, &lrs, &lcs, 8L)) {
02647         return FALSE_;
02648       }
02649     z2double(stk(C2F(intersci).lad[*ix - 1]), stk(lrs), m*n, m*n);
02650     C2F(intersci).lad[*ix - 1] = lrs;
02651     }
02652     break;
02653   case 'c' : 
02654     m = *istk(ilp + 4  +1) - *istk(ilp + 4 );
02655     n = 1;
02656     ix1 = m * n;
02657     if (! C2F(cresmat2)("mvfromto", itopl, &ix1, &lrs, 8L)) {
02658       return FALSE_;
02659     }
02660     C2F(stackc2i)(&ix1, &C2F(intersci).lad[*ix - 1], &lrs);
02661     C2F(intersci).lad[*ix - 1] = cadr(lrs);
02662     break;
02663   
02664   case 'b' :
02665     if (! C2F(crebmat)("mvfromto", itopl, &m, &n, &lrs, 8L)) {
02666       return FALSE_;
02667     }
02668     ix1 = m * n;
02669     C2F(icopy)(&ix1, istk(C2F(intersci).lad[*ix - 1]), &cx1,istk(lrs), &cx1);
02670     C2F(intersci).lad[*ix - 1] = lrs;
02671     break;
02672   case '-' :
02673     /*    reference  '-' = ascii(45) */
02674     ilp = iadr(*Lstk(*ix));
02675     size = *istk(ilp+3);
02676     pointed = *istk(ilp+2);
02677     if (! C2F(cremat)("mvfromto", itopl, (it=0 ,&it), (m=1, &m), &size, &lrs, &lcs, 8L)) {
02678       return FALSE_;
02679     }
02680     if ( C2F(vcopyobj)("mvfromto", &pointed, itopl, 8L) == FALSE_) 
02681           return FALSE_;
02682     break;
02683   case 'h' :
02684     if (! C2F(crehmat)("mvfromto", itopl, &m, &n, &lrs, 8L)) {
02685       return FALSE_;
02686     }
02687     /* no copy if the two objects are the same 
02688      * the cremat above is kept to deal with possible size changes 
02689      */
02690     if (C2F(intersci).lad[*ix - 1] != lrs) {
02691       ix1 = m * n;
02692       l=C2F(intersci).lad[*ix - 1];
02693       if (abs(l-lrs)<ix1)
02694         C2F(unsfdcopy)(&ix1, stk(l), &cx1, stk(lrs), &cx1);
02695       else
02696         C2F(dcopy)(&ix1, stk(l), &cx1, stk(lrs), &cx1);
02697       C2F(intersci).lad[*ix - 1] = lrs;
02698     }
02699     break;
02700   case 'p' :   case '$' :
02701     /*     special case */
02702     if (Top - Rhs + *ix != *itopl) 
02703       {
02704         ix1 = Top - Rhs + *ix;
02705         if ( C2F(vcopyobj)("mvfromto", &ix1, itopl, 8L) == FALSE_) 
02706           return FALSE_;
02707       }
02708   }
02709   return TRUE_;
02710 } 

Here is the call graph for this function:

Here is the caller graph for this function:

integer C2F() numopt ( void   ) 

Definition at line 154 of file stack2.c.

References Infstk, Rhs, and Top.

00155 {
00156   integer k, ret=0;
00157   for (k = 1; k <= Rhs ; ++k) 
00158     if ( *Infstk(k + Top - Rhs) == 1 ) ret++;
00159   return ret;
00160 } 

integer C2F() ogettype ( integer lw  ) 

Definition at line 260 of file stack2.c.

References iadr, istk, and Lstk.

00261 {
00262   return  *istk(iadr(*Lstk(*lw )) );
00263 }

integer C2F() overload ( integer lw,
char *  fname,
unsigned long  l 
)

Definition at line 248 of file stack2.c.

References C2F, and l.

Referenced by overloadtype(), sci_copy(), sci_delete(), sci_draw(), sci_get(), and sci_set().

00249 {
00250   C2F(putfunnam)(fname,lw,l);
00251   C2F(com).fun=-1;
00252   return 0;
00253 }

Here is the caller graph for this function:

integer C2F() overloadtype ( integer lw,
char *  fname,
char *  typ 
)

Definition at line 193 of file stack2.c.

References C2F, iadr, istk, Lstk, overload(), and typ.

Referenced by getrhsvar().

00194 {
00195   integer il=0;
00196   integer ityp=0;
00197   il = iadr(*Lstk(*lw ));
00198   if (*istk(il ) < 0) il = iadr(*istk(il +1));
00199   switch (*typ) {
00200   case 'c' : /* string */
00201   case 'S' : /* string Matrix */
00202     ityp=10;
00203     break;
00204   case 'd' :  case 'i' :  case 'r' :  case 'z' :   /* numeric */
00205     ityp=1;
00206     break ;
00207   case 'b' : /* boolean */
00208     ityp=4;
00209     break;
00210   case 'h' : /* handle */
00211     ityp=9;
00212     break;
00213   case 'l' : /* list */
00214     ityp=15;
00215     break;
00216   case 't' : /* tlist */
00217     ityp=16;
00218     break;
00219   case 'm' : /* mlist */
00220     ityp=17;
00221     break;
00222   case 'f' : /* external */
00223     ityp=13;
00224     break;
00225   case 'p' : /* pointer */
00226     ityp=128;
00227     break;
00228   case 's' : /* sparse */
00229     ityp= 5;
00230     break;
00231   case 'I' : /* int matrix */
00232     ityp=8;
00233     break;
00234 
00235   }
00236   if (*istk(il ) != ityp) {
00237     return C2F(overload)(lw,fname,strlen(fname));
00238   }
00239   return 1;
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() putlhsvar (  ) 

Definition at line 2475 of file stack2.c.

References Bot, C2F, Check_references(), err, err1, FALSE_, fun, iadr, intersiz, istk, ix, L, Lhs, LhsVar, Lstk, Max, mvfromto(), Nbvars, objvide(), Rhs, Top, and TRUE_.

Referenced by __PARAMS(), C2F(), endmex(), getversion_no_rhs(), getversion_two_rhs(), gw_cscicos(), gw_graphics(), gw_linear_algebra(), gw_special_functions2(), InterfaceWindowsClipboard(), intopenxls(), intreadxls(), lasterror(), NoRhs(), OneLhs(), OneRhs_gettext(), ReturnValueSetenv(), sci_clc(), sci_gateway(), sci_raise_window(), sci_tohome(), sci_xsnative(), TwoLhs(), and TwoRhs_gettext().

02476 {
02477   integer ix2, ivar, ibufprec, ix, k, lcres, nbvars1;
02478   integer plhsk;
02479   Check_references();
02480   
02481   for (k = 1; k <= Lhs; k++)
02482     {
02483       plhsk=*Lstk(LhsVar(k)+Top-Rhs);
02484       if (*istk( iadr(plhsk) ) < 0) {
02485         if (*Lstk(Bot) > *Lstk(*istk(iadr (plhsk) +2)) )
02486         LhsVar(k)=*istk(iadr(plhsk)+2);
02487         /* lcres = 0 */
02488       }
02489     }
02490 
02491   if (C2F(iop).err > 0||C2F(errgst).err1> 0)  return TRUE_ ; 
02492   if (C2F(com).fun== -1 ) return TRUE_ ; /* execution continue with an 
02493                                             overloaded function */
02494   if (LhsVar(1) == 0) 
02495     {
02496       Top = Top - Rhs + Lhs;
02497       C2F(objvide)(" ", &Top, 1L);
02498       Nbvars = 0;
02499       return TRUE_;
02500     }
02501   nbvars1 = 0;
02502   for (k = 1; k <= Lhs ; ++k) nbvars1 = Max( nbvars1 , LhsVar(k));
02503   /* check if output variabe are in increasing order in the stack */
02504   lcres = TRUE_;
02505   ibufprec = 0;
02506   for (ix = 1; ix <= Lhs ; ++ix) {
02507     if (LhsVar(ix) < ibufprec) {
02508       lcres = FALSE_;
02509       break;
02510     } else {
02511       ibufprec = LhsVar(ix );
02512     }
02513   }
02514   if (! lcres) {
02515     /* First pass if output variables are not 
02516      * in increasing order 
02517      */
02518     for (ivar = 1; ivar <= Lhs; ++ivar) {
02519       ix2 = Top - Rhs + nbvars1 + ivar;
02520       if (! C2F(mvfromto)(&ix2, &LhsVar(ivar))) {
02521         return FALSE_;
02522       }
02523       LhsVar(ivar) = nbvars1 + ivar;
02524       /* I change type of variable nbvars1 + ivar 
02525        * in order to just perform a dcopy at next pass 
02526        */
02527       if (nbvars1 + ivar > intersiz) {
02528         Scierror(999,"putlhsvar: intersiz is too small\r\n");
02529         return FALSE_;
02530       }
02531       C2F(intersci).ntypes[nbvars1 + ivar - 1] = '$';
02532     }
02533   }
02534   /*  Second pass */
02535   for (ivar = 1; ivar <= Lhs ; ++ivar) 
02536     {
02537       ix2 = Top - Rhs + ivar;
02538       if (! C2F(mvfromto)(&ix2, &LhsVar(ivar))) {
02539         return FALSE_;
02540       }
02541     }
02542   Top = Top - Rhs + Lhs;
02543   LhsVar(1) = 0;
02544   Nbvars = 0;
02545   return TRUE_;
02546 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int Ref2val ( int  from,
int  to 
)

Definition at line 2722 of file stack2.c.

References C2F, copyobj(), FALSE_, iadr, istk, Lstk, lwd, Rhs, and Top.

02723 {
02724   integer il,lw;
02725   lw = from + Top - Rhs;
02726   if ( from  > Rhs) {
02727     Scierror(999,"copyref: bad call to isref! (1rst argument)\r\n");
02728     return FALSE_;
02729   }
02730   il = iadr(*Lstk(lw));
02731   if ( *istk(il) < 0) 
02732     {
02733       int lwd ; 
02734       /* from contains a reference */ 
02735       lw= *istk(il+2); 
02736       lwd = to + Top -Rhs;
02737       C2F(copyobj)("copyref", &lw, &lwd, strlen("copyref"));
02738     }
02739   return 0;
02740 }

Here is the call graph for this function:

int rhs_opt_find ( char *  name,
rhs_opts  opts[] 
)

Definition at line 323 of file stack2.c.

References i, NULL, and rep.

Referenced by findopt(), and get_optionals().

00324 {
00325   int rep=-1,i=0;
00326   while ( opts[i].name != NULL ) 
00327     {
00328       int cmp;
00329       /* name is terminated by white space and we want to ignore them */
00330       if ( (cmp=strcmp(name,opts[i].name)) == 0 )
00331         {
00332           rep = i ; break;
00333         }
00334       else if ( cmp < 0 )
00335         {
00336           break;
00337         }
00338       else 
00339         {
00340           i++;
00341         }
00342     }
00343   return rep;
00344 }

Here is the caller graph for this function:

void rhs_opt_print_names ( rhs_opts  opts[]  ) 

Definition at line 346 of file stack2.c.

References i, name, NULL, and sciprint().

Referenced by get_optionals().

00349 {
00350   int i=0;
00351   if ( opts[i].name == NULL )
00352     {
00353       sciprint("optional argument list is empty\r\n");
00354       return;
00355     }
00356   sciprint("optional arguments list: ");
00357   while ( opts[i+1].name != NULL ) 
00358     {
00359       sciprint("%s, ",opts[i].name);
00360       i++;
00361     }
00362   sciprint("and %s.\r\n",opts[i].name);
00363   return ;
00364 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() scibuiltin ( integer number,
integer ifun,
integer ifin,
integer mlhs,
integer mrhs 
)

Definition at line 2090 of file stack2.c.

References allowptr(), Bot, C2F, callinterf(), cx0, cx1, cx4, Err, error, FALSE_, fin, fun, funs(), iadr, icall, intersci_pop(), intersci_push(), ir, iset(), istk, ix, krec, Lhs, Lstk, nsiz, parse(), pt, ref2val(), Rhs, rstk, Top, and TRUE_.

Referenced by sciops(), and scistring().

02091 {
02092   integer krec, srhs, slhs, iflagint;
02093   integer ix, k, intop, il, ir, lw, pt0;
02094   intop = Top;
02095   
02096   if ( intersci_push() == 0 ) 
02097     {
02098       Scierror(999,"scifunction: Running out of memory \r\n");
02099       goto L9999;
02100     }
02101 
02102   Top = Top - Rhs + *number + *mrhs - 1;
02103   slhs = Lhs;
02104   srhs = Rhs;
02105   Lhs = *mlhs;
02106   Rhs = *mrhs;
02107   krec = -1;
02108   pt0 = C2F(recu).pt;
02109   goto L90;
02110   /* ***************************** */
02111   /*<  60   call  parse >*/
02112  L60:
02113   C2F(parse)();
02114   if (C2F(com).fun == 99) {
02115     C2F(com).fun = 0;
02116     goto L200;
02117   }
02118   if (Err > 0) {
02119     goto L9999;
02120   }
02121   if (C2F(recu).rstk[C2F(recu).pt - 1] / 100 == 9) {
02122     ir = C2F(recu).rstk[C2F(recu).pt - 1] - 900;
02123     if (ir == 1) {
02124       /*     .     back to matsys */
02125       k = 13;
02126     } else if (ir >= 2 && ir <= 9) {
02127       /*     .     back to matio */
02128       k = 5;
02129     } else if (ir == 10) {
02130       /*     .     end of overloaded function */
02131       goto L96;
02132     } else if (ir > 40) {
02133       /*     .     back to matus2 */
02134       k = 24;
02135     } else if (ir > 20) {
02136       /*     .     back to matusr */
02137       k = 14;
02138     } else {
02139       goto L89;
02140     }
02141     iflagint = 0;
02142     goto L95;
02143   }
02144  L89:
02145   if (Top < Rhs) {
02146     Scierror(22,"scibuiltin: recursion problems. Sorry....\r\n");
02147     goto L9999;
02148   }
02149   if (Top - Rhs + Lhs + 1 >= Bot) {
02150     Scierror(18,"scibuiltin: too many names\r\n");
02151     goto L9999;
02152   }
02153   goto L91;
02154  L90:
02155   if (Err > 0) {
02156     goto L9999;
02157   }
02158   if (Top - Lhs + 1 > 0) {
02159     C2F(iset)(&Rhs, &cx0, &C2F(vstk).infstk[Top - Lhs], &cx1);
02160   }
02161  L91:
02162   k = C2F(com).fun;
02163   C2F(com).fun = 0;
02164   if (k == krec) {
02165     Scierror(22,"scibuiltin: recursion problems. Sorry....\r\n");
02166     goto L9999;
02167   }
02168   if (k == 0) {
02169     if (C2F(recu).pt > pt0) {
02170       goto L60;
02171     }
02172     goto L200;
02173   }
02174   if (k == 2) {
02175     il = iadr(*Lstk(Top + 1 - Rhs));
02176     iflagint = *istk(il + 3);
02177   }
02178   if (! C2F(allowptr)(&k)) {
02179     C2F(ref2val)();
02180   }
02181  L95:
02182   C2F(callinterf)(&k, &iflagint);
02183   if (C2F(recu).icall != 0) {
02184     goto L60;
02185   }
02186   if (C2F(com).fun >= 0) {
02187     goto L90;
02188   }
02189   /*    called interface ask for a sci function to perform the function (fun=-1)*/
02190   /*     the function name is given in ids(1,pt+1) */
02191   C2F(ref2val)();
02192   C2F(com).fun = 0;
02193   C2F(funs)(&C2F(recu).ids[(C2F(recu).pt + 1)* nsiz - nsiz]);
02194   if (Err > 0) {
02195     goto L9999;
02196   }
02197   if (C2F(com).fun > 0) {
02198     goto L91;
02199   }
02200   if (C2F(com).fin == 0) {
02201     integer cx4 = 4;
02202     C2F(error)(&cx4);
02203     if (Err > 0) {
02204       goto L9999;
02205     }
02206   }
02207   ++C2F(recu).pt;
02208   C2F(com).fin = *Lstk(C2F(com).fin);
02209   C2F(recu).rstk[C2F(recu).pt - 1] = 910;
02210   C2F(recu).icall = 5;
02211   C2F(com).fun = 0;
02212   /*     *call*  macro */
02213   goto L60;
02214  L96:
02215   --C2F(recu).pt;
02216   goto L90;
02217   /* ************************** */
02218  L200:
02219   Lhs = slhs;
02220   Rhs = srhs;
02221   Top = intop;
02222   intersci_pop();
02223   for (ix = 0 ; ix < *mlhs ; ++ix) {
02224     lw = Top - Rhs + *number + ix ;
02225     C2F(intersci).ntypes[lw - 1] = '$';
02226   }
02227   return TRUE_;
02228  L9999:
02229   intersci_pop();
02230   return FALSE_;
02231 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() scifunction ( integer number,
integer ptr,
integer mlhs,
integer mrhs 
)

Definition at line 1853 of file stack2.c.

References allowptr(), Bot, C2F, callinterf(), cx0, cx1, cx4, Err, error, FALSE_, fin, fun, funs(), iadr, intersci_pop(), intersci_push(), ir, iset(), istk, ix, krec, Lhs, Lstk, mrhs, nsiz, parse(), psiz, pt, ref2val(), Rhs, rstk, Top, and TRUE_.

Referenced by scistring().

01854 {
01855   integer cx26 = 26;
01856   integer ix1, krec, iflagint, ix, k, intop, il, ir, lw;
01857   
01858   if ( intersci_push() == 0 ) 
01859     {
01860       Scierror(999,"scifunction: Running out of memory \r\n");
01861       goto L9999;
01862     }
01863 
01864   /*     macro execution */
01865   intop = Top;
01866   Top = Top - Rhs + *number + *mrhs - 1;
01867   ++C2F(recu).pt;
01868   if (C2F(recu).pt > psiz) {
01869     C2F(error)(&cx26);
01870     goto L9999;
01871   }
01872   C2F(recu).ids[C2F(recu).pt * nsiz - nsiz] = Lhs;
01873   C2F(recu).ids[C2F(recu).pt * nsiz - (nsiz-1)] = Rhs;
01874   C2F(recu).rstk[C2F(recu).pt - 1] = 1001;
01875   Lhs = *mlhs;
01876   Rhs = *mrhs;
01877   ++C2F(recu).niv;
01878   C2F(com).fun = 0;
01879   C2F(com).fin = *ptr;
01880   C2F(recu).icall = 5;
01881   krec = -1;
01882 
01883  L60:
01884   C2F(parse)();
01885   if (C2F(com).fun == 99) {
01886     C2F(com).fun = 0;
01887     goto L200;
01888   }
01889   if (Err > 0)  goto L9999;
01890   if (C2F(recu).rstk[C2F(recu).pt - 1] / 100 == 9) {
01891     ir = C2F(recu).rstk[C2F(recu).pt - 1] - 900;
01892     if (ir == 1) {
01893       /*     .     back to matsys */
01894       k = 13;
01895     } else if (ir >= 2 && ir <= 9) {
01896       /*     .     back to matio */
01897       k = 5;
01898       /*<          elseif(ir.eq.10) then >*/
01899     } else if (ir == 10) {
01900       /*     .     end of overloaded function */
01901       goto L96;
01902       /*<          elseif(ir.gt.40) then >*/
01903     } else if (ir > 40) {
01904       /*     .     back to matus2 */
01905       k = 24;
01906     } else if (ir > 20) {
01907       /*     .     back to matusr */
01908       k = 14;
01909     } else {
01910       goto L89;
01911     }
01912     iflagint = 0;
01913     goto L95;
01914   }
01915 
01916  L89:
01917   if (Top < Rhs) {
01918     Scierror(22,"scifunction: recursion problems. Sorry....\r\n");
01919     goto L9999;
01920   }
01921   if (Top - Rhs + Lhs + 1 >= Bot) {
01922     Scierror(18,"scifunction: too many names\r\n");
01923     goto L9999;
01924   }
01925   goto L91;
01926  L90:
01927   if (Err > 0) {
01928     goto L9999;
01929   }
01930   if (Top - Lhs + 1 > 0) {
01931     C2F(iset)(&Lhs, &cx0, &C2F(vstk).infstk[Top - Lhs], &cx1);
01932   }
01933  L91:
01934   k = C2F(com).fun;
01935   C2F(com).fun = 0;
01936   if (k == krec) {
01937     Scierror(22,"scifunction: recursion problems. Sorry....\r\n");
01938     goto L9999;
01939   }
01940   if (k == 0) {
01941     goto L60;
01942   }
01943   if (k == 2) {
01944     il = iadr( *Lstk(Top + 1 - Rhs));
01945     iflagint = *istk(il + 3);
01946   }
01947  L95:
01948   if (! C2F(allowptr)(&k)) {
01949     C2F(ref2val)();
01950   }
01951   C2F(callinterf)(&k, &iflagint);
01952   if (C2F(com).fun >= 0) {
01953     goto L90;
01954   }
01955   /*    called interface ask for a scilab function to perform the function (fun=-1)
01956    *     the function name is given in ids(1,pt+1) 
01957    */
01958   C2F(ref2val)();
01959   C2F(com).fun = 0;
01960   C2F(funs)(&C2F(recu).ids[(C2F(recu).pt + 1)* nsiz - nsiz]);
01961   if (Err > 0) {
01962     goto L9999;
01963   }
01964   if (C2F(com).fun > 0) {
01965     goto L91;
01966   }
01967   if (C2F(com).fin == 0) {
01968     integer cx4 = 4;
01969     C2F(error)(&cx4);
01970     if (Err > 0) {
01971       goto L9999;
01972     }
01973     goto L90;
01974   }
01975   ++C2F(recu).pt;
01976   C2F(com).fin = *Lstk(C2F(com).fin);
01977   C2F(recu).rstk[C2F(recu).pt - 1] = 910;
01978   C2F(recu).icall = 5;
01979   C2F(com).fun = 0;
01980   /*     *call*  macro */
01981   goto L60;
01982  L96:
01983   --C2F(recu).pt;
01984   goto L90;
01985  L200:
01986   Lhs = C2F(recu).ids[C2F(recu).pt * nsiz -nsiz ];
01987   Rhs = C2F(recu).ids[C2F(recu).pt * nsiz -(nsiz-1)];
01988   --C2F(recu).pt;
01989   --C2F(recu).niv;
01990   /* + */
01991   Top = intop;
01992   ix1 = *mlhs;
01993   intersci_pop();
01994   for (ix = 1; ix <= ix1; ++ix) {
01995     lw = Top - Rhs + *number + ix - 1;
01996     C2F(intersci).ntypes[lw - 1] = '$';
01997   }
01998   return TRUE_;
01999 
02000  L9999:
02001   Top = intop;
02002   --C2F(recu).niv;
02003   intersci_pop();
02004   return FALSE_;
02005 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() sciops ( integer number,
integer op,
integer mlhs,
integer mrhs 
)

Definition at line 2239 of file stack2.c.

References allops(), C2F, Err, FALSE_, Fin, fun, ix, Lhs, Rhs, scibuiltin(), Top, and TRUE_.

Referenced by scistring().

02240 {
02241   integer ifin, ifun, srhs= Rhs , slhs= Lhs, ix, intop=Top , lw;
02242 
02243   Fin   = *op;
02244   Top = Top - Rhs + *number + *mrhs - 1;
02245   Lhs = *mlhs;
02246   Rhs = *mrhs;
02247 
02248   while (1) 
02249     {
02250       C2F(allops)();
02251       if (Err > 0) {return FALSE_;} ;
02252       if (C2F(com).fun == 0) break; 
02253       Top = intop;
02254       ifun = C2F(com).fun;
02255       ifin = C2F(com).fin;
02256       if (! C2F(scibuiltin)(number, &ifun, &ifin, mlhs, mrhs)) 
02257         {return FALSE_;} ;
02258       if (Err > 0) {return FALSE_;} ;
02259     }
02260   Lhs = slhs;
02261   Rhs = srhs;
02262   Top = intop;
02263   
02264   for (ix = 1 ; ix <= *mlhs ; ++ix) {
02265     lw = Top - Rhs + *number + ix - 1;
02266     C2F(intersci).ntypes[lw - 1] = '$';
02267   }
02268   C2F(com).fun = 0;
02269   C2F(com).fin = *op;
02270   C2F(recu).icall = 0;
02271   return TRUE_;
02272 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() scistring ( integer ifirst,
char *  thestring,
integer mlhs,
integer mrhs,
unsigned long  thestring_len 
)

Definition at line 2017 of file stack2.c.

References C2F, cvname(), cx0, FALSE_, fin, fun, funs(), get_fname(), getopcode(), iadr, ifin, ifun, istk, Lstk, nsiz, op, Rhs, scibuiltin(), scifunction(), sciops(), thestring_len, and Top.

Referenced by mexCallSCI().

02018 {
02019   int ret = FALSE_;
02020   integer ifin, ifun, tops, moutputs, id[nsiz], lf, op, ile, ils, nnn, ninputs;
02021   nnn =  thestring_len;
02022   op = 0;
02023   if (nnn <= 2) {
02024     op = C2F(getopcode)(thestring, thestring_len);
02025   }
02026   if (op == 0) {
02027     C2F(cvname)(id, thestring, &cx0, nnn);
02028     C2F(com).fin = 0;
02029     tops = Top;
02030     Top = Top - Rhs + *ifirst + *mrhs - 1;
02031     C2F(funs)(id);
02032     Top = tops;
02033     if (C2F(com).fin == 0) {
02034       Scierror(999,"scistring: %s is not a Scilab function\r\n", 
02035                get_fname(thestring,thestring_len));
02036       return ret;
02037     }
02038     if (C2F(com).fun <= 0) {
02039       lf = *Lstk(C2F(com).fin);
02040       ils = iadr(lf) + 1;
02041       moutputs = *istk(ils);
02042       ile = ils + moutputs * nsiz + 1;
02043       ninputs = *istk(ile);
02044       /*  
02045        *   ninputs=actual number of inputs, moutputs=actual number of outputs
02046        *   of thestring: checking mlhs=ninputs and mrhs=moutputs not done. 
02047        */
02048       ret = C2F(scifunction)(ifirst, &lf, mlhs, mrhs);
02049     } else {
02050       ifin = C2F(com).fin;
02051       ifun = C2F(com).fun;
02052       ret = C2F(scibuiltin)(ifirst, &ifun, &ifin, mlhs, mrhs);
02053     }
02054   } else {
02055     ret = C2F(sciops)(ifirst, &op, mlhs, mrhs);
02056   }
02057   return ret;
02058 }

Here is the call graph for this function:

Here is the caller graph for this function:

int C2F() setworksize ( integer number,
integer size 
)

Definition at line 1125 of file stack2.c.

References C2F, FALSE_, Get_Iname(), iadr, intersiz, istk, Lstk, Max, Nbvars, Rhs, size, Top, and TRUE_.

01126 {
01127   int lw1;
01128   char *fname = Get_Iname();
01129   if (*number > intersiz) {
01130     Scierror(999,"%s: (creatework) too many arguments in the stack edit stack.h and enlarge intersiz\r\n",
01131              fname);
01132     return FALSE_ ;
01133   }
01134   Nbvars = Max(*number,Nbvars);
01135   lw1 = *number + Top - Rhs;
01136   if (lw1 < 0) {
01137     Scierror(999,"%s: bad call to setworksize! (1rst argument)\r\n",
01138              fname);
01139     return FALSE_ ;
01140   }
01141   *istk(iadr(*Lstk(lw1)))=0;
01142   *Lstk(lw1+1) = *Lstk(lw1) + *size ;
01143   C2F(intersci).ntypes[*number - 1] = '$';
01144   C2F(intersci).iwhere[*number - 1] = *Lstk(lw1);
01145   C2F(intersci).lad[*number - 1] = 0; /* not to be used XXXX */ 
01146   return TRUE_; 
01147 }

Here is the call graph for this function:

void strcpy_tws ( char *  str1,
char *  str2,
int  len 
)

Definition at line 2765 of file stack2.c.

References i, and int.

02766 {
02767   int i; 
02768   for ( i =0 ; i  < (int)strlen(str2); i++ ) str1[i]=str2[i];
02769   for (i = strlen(str2) ; i < len ; i++) str1[i]=' ';
02770   str1[len-1] ='\0';
02771 }

integer C2F() vartype ( integer number  ) 

Definition at line 167 of file stack2.c.

References C2F, gettype(), number, Rhs, and Top.

00168 {
00169   integer ix1=  *number + Top - Rhs;
00170   return  C2F(gettype)(&ix1);
00171 } 

Here is the call graph for this function:


Variable Documentation

char arg_position[56] [static]

Definition at line 2808 of file stack2.c.

integer cx0 = 0 [static]

Definition at line 27 of file stack2.c.

integer cx1 = 1 [static]

Definition at line 26 of file stack2.c.

char Fname[nlgh+1] [static]

Definition at line 2790 of file stack2.c.

intersci_list* L_intersci [static]

Definition at line 3206 of file stack2.c.

Referenced by intersci_pop(), and intersci_push().

char* pos[] = {"first","second","third","fourth"} [static]

Definition at line 2807 of file stack2.c.

Referenced by _SetSelection(), ChangeForName1(), cngrncb(), ComputeC_format(), cre_smat_from_str_i(), CreSmatFromHist(), delbtn(), delete_node(), DoSearch(), drawStringInCell(), findopt(), getBoundsheets(), getouttb(), getStringBox(), getStringHorizontalSpace(), getStringVerticalSpace(), inprd(), InsertFileNamed(), instring(), int_objfscanf(), intreadxls(), isFittingInCell(), main(), OLE_sectorpos(), Replace(), sciGetScreenPosition(), sciSetLegendPos(), sp(), TextPutCh(), xls_open(), and xls_read().


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