stcreate.h File Reference

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

Go to the source code of this file.

Functions

int C2F() stcreate (integer *lw, integer *nz, integer *sz, integer *nf, char *fnames[], integer *retval)
int sttyp (int *ivt, char *job, int *nf, char *fnames[])
int creonevoid (integer *slw, integer *lw)
int crelistofvoids (integer *slw, integer *lw, integer *nels)


Function Documentation

int crelistofvoids ( integer slw,
integer lw,
integer nels 
)

Definition at line 94 of file stcreate.c.

References iadr, istk, and sadr.

Referenced by stcreate().

00095 {
00096   int il,k;
00097   il = iadr(*slw);
00098   *istk(il) = 15;
00099   *istk(il + 1) = *nels;
00100   *istk(il + 2) = 1;
00101   for (k=0; k<*nels; k++) *istk(il+3+k) = *istk(il+2+k) + 2;
00102   il += 3+*nels;
00103   il=iadr(sadr(il));
00104   for (k=0; k<*nels; k++) {
00105     *istk(il  )=1;
00106     *istk(il+1)=0;
00107     *istk(il+2)=0;
00108     *istk(il+3)=0;
00109     il += 4;
00110   };
00111   if ( ((il-iadr(*slw)) %2) ) il +=1;
00112   *lw =  sadr(il);
00113   return 0;
00114 }

Here is the caller graph for this function:

int creonevoid ( integer slw,
integer lw 
)

Definition at line 81 of file stcreate.c.

References iadr, istk, and sadr.

Referenced by stcreate().

00082 {
00083   int il;
00084   il = iadr(*slw);
00085   *istk(il  )=1;
00086   *istk(il+1)=0;
00087   *istk(il+2)=0;
00088   *istk(il+3)=0;
00089   il += 4;
00090   *lw = sadr(il);
00091   return 0;
00092 }

Here is the caller graph for this function:

int C2F() stcreate ( integer lw,
integer nz,
integer sz,
integer nf,
char *  fnames[],
integer retval 
)

Definition at line 13 of file stcreate.c.

References Bot, c1, c17, C2F, c4, creimati(), crelistofvoids(), creonevoid(), Err, error, iadr, icopy(), intersiz, istk, L, l, lr, Lstk, lw, memused, n1, retval(), Rhs, sadr, sttyp(), sz, and Top.

Referenced by mxCreateCellArray(), mxCreateStructArray(), and mxCreateStructMatrix().

00014 {
00015     integer next,k,lr,nels;
00016 
00017     static integer l;
00018     static integer l0, n1, il;
00019 
00020     *retval = 0;
00021     l0 = *Lstk(*lw);
00022 
00023     C2F(intersci).ntypes[*lw -Top + Rhs - 1] = '$';
00024     C2F(intersci).iwhere[*lw -Top + Rhs - 1] = *Lstk(*lw);
00025 
00026     if (*lw > intersiz) {
00027       Scierror(998,"Too many arguments in the stack edit stack.h and enlarge intersiz\r\n");
00028         return 1;
00029     }
00030     sttyp(&n1, "size", nf, fnames);
00031     
00032     *retval = 1;
00033 /*     create the mlist header */
00034     il = iadr(l0);
00035     Err = sadr(il+6) + n1 - *Lstk(Bot);
00036     if (Err > 0) {
00037         C2F(error)(&c17);
00038         return 1;
00039     }
00040     *istk(il) = 17;
00041     *istk(il+1) = 2+*nf;
00042     *istk(il + 2) = 1;
00043 /*     set mlist type ["st","dims","field1",...,"fieldnf"] */
00044     l = sadr(il+5+*nf);
00045     sttyp(istk(iadr(l)), "set", nf, fnames);
00046     *istk(il + 3) = *istk(il + 2) + n1;
00047     l += n1;
00048 /*     set dims entry (int32 matrix) */
00049 /*  if (!C2F(creimati)("stcreate", &l, &c4, nz, &c1, &lr, &c1,  12L)) return 1;  FD comment*/
00050     if (!C2F(creimati)("stcreate", &l, &c4, &c1, nz, &lr, &c1,  12L)) return 1;
00051     C2F(icopy)(nz,sz,&c1,istk(lr),&c1);
00052     n1 = sadr(iadr(l)+4) + memused(c4,*nz) - l;
00053     *istk(il + 4) = *istk(il + 3) + n1;
00054     l += n1;
00055     
00056 /*     set struct fields */
00057     nels=1;
00058     for (k=0; k< *nz;k++) nels=nels*sz[k];
00059     if (nels==1) {
00060     for (k=0; k< *nf;k++)
00061       {
00062         creonevoid(&l,&next);
00063         n1 = next - l;
00064         l += n1;
00065         *istk(il + 5 + k) = *istk(il + 4 + k) + n1;
00066       }
00067     }
00068     else {
00069     for (k=0; k< *nf;k++)
00070       {
00071         crelistofvoids(&l,&next,&nels);
00072         n1 = next - l;
00073         l += n1;
00074         *istk(il + 5 + k) = *istk(il + 4 + k) + n1;
00075       }
00076     }
00077     *Lstk(*lw+1)=l;
00078     return 1; 
00079 } 

Here is the call graph for this function:

Here is the caller graph for this function:

int sttyp ( int ivt,
char *  job,
int nf,
char *  fnames[] 
)

Definition at line 116 of file stcreate.c.

References C2F, cvstr(), l, and ls.

Referenced by stcreate().

00117 {
00118   static int l; int ls,k,shft,stp,Job;
00119 
00120     if (strcmp(job, "size") == 0) {
00121 /*        size of header = ["st","dims","f_1",...,"f_nf"] */
00122       ls=0;
00123       for ( k= 0; k < *nf; k++) ls += strlen(fnames[k]);
00124       ivt[0] = 4 + (2 +*nf) + 1 + 2 + 4 + ls;  /* 2 + *nf strings */
00125       /* if (ivt[0] % 2) ivt[0]++;  */
00126     } else {
00127 /*      header = row vector made of 2 + *nf strings */
00128         ivt[0] = 10;
00129         ivt[1] = 1;
00130         ivt[2] = 2 + *nf;
00131         ivt[3] = 0;
00132         ivt[4] = 1;
00133         stp=4;
00134         l = 5 + (2 + *nf);
00135 /*       string 1 =  "st" */
00136         shft=2;
00137         ivt[l] = 28;      /*  "s"   */
00138         ivt[l + 1] = 29;  /*  "t"   */
00139         ivt[stp+1] = ivt[stp] + shft;
00140         l += shft;stp++;
00141 /*        string 2 =  "dims" */
00142         shft=4;
00143         ivt[l] = 13;      /* "d"   */
00144         ivt[l + 1] = 18;  /* "i"   */
00145         ivt[l + 2] = 22;  /* "m"   */
00146         ivt[l + 3] = 28;  /* "s"   */
00147         ivt[stp+1] = ivt[stp] + shft;
00148         l += shft;stp++;
00149 /*        strings 3:2+nf = ["field_1","field_2","field_nf"]    */
00150         for (k=0; k < *nf; k++) {
00151         shft = strlen(fnames[k]);
00152         C2F(cvstr)(&shft,&ivt[l],fnames[k],(Job=0,&Job),shft);
00153         ivt[stp+1] = ivt[stp] + shft;
00154         l += shft;stp++;
00155         }
00156     }
00157     return 0;
00158 }

Here is the call graph for this function:

Here is the caller graph for this function:


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