libinter.c File Reference

#include <string.h>
#include "machine.h"
#include "MALLOC.h"
#include "../../../string/includes/men_Sutils.h"
#include "libinter.h"
#include "cerro.h"

Include dependency graph for libinter.c:

Go to the source code of this file.

Functions

int C2F (cvstr)
void C2F() ccharf (int *n, char **ip, int *op)
void C2F() cdouble (int *n, ip, double *op)
void C2F() cdoublef (int *n, ip, double *op)
void C2F() cint (int *n, ip, double *op)
void C2F() cintf (int *n, ip, double *op)
void C2F() cfloat (int *n, ip, double *op)
void C2F() cfloatf (int *n, ip, double *op)
void C2F() cbool (int *n, ip, int *op)
void C2F() cboolf (int *n, ip, int *op)
void cerro (char *str)
void Cout (char *str)
void C2F() cstringf (char ***ip, int *sciptr, int *m, int *n, int *max, int *ierr)
int C2F() stringc (int *sciptr, char ***cptr, int *ierr)
void C2F() dbl2cdbl (int *n, ip, double *op)
void C2F() freeptr (ip)
void C2F() int2cint (int *n, ip, integer *op)
SciSparseNewSparse (int *it, int *m, int *n, int *nel)
void FreeSparse (SciSparse *x)
int C2F() csparsef (SciSparse **x, int *mnel, int *icol, double *R, double *I)
void FreeRhsSVar (char **ptrStr)


Function Documentation

int C2F ( cvstr   ) 

Definition at line 11 of file libinter.c.

References cvstr(), F2C(), and i.

00018          : copy char ** to Scilab string code 
00019  *         converts ip      -> op    
00020  *                 char ** -> int * 
00021  *--------------------------------------------------------------*/
00022 
00023 void C2F(cchar)(int *n, char **ip,int *op)
00024 {
00025   int i = 0;
00026   F2C(cvstr)(n,op,*ip,&i,*n);
00027 }

Here is the call graph for this function:

void C2F() cbool ( int n,
ip  ,
int op 
)

Definition at line 140 of file libinter.c.

References i, ip, n, and op.

Referenced by createlistvarfromptr().

00144 {
00145   int i;
00146   for (i = 0; i < *n; i++)  op[i]= (*ip)[i];
00147 }

Here is the caller graph for this function:

void C2F() cboolf ( int n,
ip  ,
int op 
)

Definition at line 153 of file libinter.c.

References FREE, i, ip, n, and op.

00157 {
00158   int i;
00159   if ( *n > 0 ) {
00160     for (i = 0; i < *n; i++)
00161       op[i]= (*ip)[i];
00162     FREE((char *)(*ip));
00163   }
00164 }

void C2F() ccharf ( int n,
char **  ip,
int op 
)

Definition at line 35 of file libinter.c.

References cvstr(), F2C(), FREE, i, ip, n, and op.

00039 {
00040   int i = 0;
00041   if (*n > 0) {
00042     F2C(cvstr)(n,op,*ip,&i,*n);
00043     FREE(*ip);
00044   }
00045 }

Here is the call graph for this function:

void C2F() cdouble ( int n,
ip  ,
double *  op 
)

Definition at line 51 of file libinter.c.

References i, ip, n, and op.

Referenced by createcvarfromptr(), createlistcvarfromptr(), and createlistvarfromptr().

00055 {
00056   int i;
00057   for (i = 0; i < *n; i++) op[i]=(*ip)[i];
00058 }

Here is the caller graph for this function:

void C2F() cdoublef ( int n,
ip  ,
double *  op 
)

Definition at line 64 of file libinter.c.

References FREE, i, ip, n, and op.

00068 {
00069   int i;
00070   if ( *n >0 ) {
00071     for (i = 0; i < *n; i++)  op[i]=(*ip)[i];
00072     FREE((char *)(*ip));
00073   }
00074 }

void cerro ( char *  str  ) 

Definition at line 171 of file libinter.c.

References C2F, erro(), and int.

00172 {
00173   C2F(erro)(str, (unsigned int)(strlen(str) + 1));
00174 }

Here is the call graph for this function:

void C2F() cfloat ( int n,
ip  ,
double *  op 
)

Definition at line 110 of file libinter.c.

References i, ip, n, and op.

Referenced by createlistcvarfromptr(), and createlistvarfromptr().

00114 {
00115   int i;
00116   for (i = 0; i < *n; i++)  op[i]=(double)(*ip)[i];
00117 }

Here is the caller graph for this function:

void C2F() cfloatf ( int n,
ip  ,
double *  op 
)

Definition at line 123 of file libinter.c.

References FREE, i, ip, n, and op.

00127 {
00128   int i;
00129   if ( *n > 0 ) {
00130     for (i = 0; i < *n; i++)
00131       op[i]=(double)(*ip)[i];
00132     FREE((char *)(*ip));
00133   }
00134 }

void C2F() cint ( int n,
ip  ,
double *  op 
)

Definition at line 80 of file libinter.c.

References i, ip, n, and op.

Referenced by createcvarfromptr(), createlistcvarfromptr(), and createlistvarfromptr().

00084 {
00085   int i;
00086   for (i = 0; i < *n; i++)  op[i]=(double)(*ip)[i];
00087 }

Here is the caller graph for this function:

void C2F() cintf ( int n,
ip  ,
double *  op 
)

Definition at line 93 of file libinter.c.

References FREE, i, ip, n, and op.

00097 {
00098   int i;
00099   if ( *n > 0 ) {
00100     for (i = 0; i < *n; i++)
00101       op[i]=(double)(*ip)[i];
00102     FREE((char *)(*ip));
00103   }
00104 }

void Cout ( char *  str  ) 

Definition at line 180 of file libinter.c.

References C2F, int, l, and out().

00181 {
00182   C2F(out)(str,(unsigned int)(strlen(str) + 1));
00183 }

Here is the call graph for this function:

int C2F() csparsef ( SciSparse **  x,
int mnel,
int icol,
double *  R,
double *  I 
)

Definition at line 375 of file libinter.c.

References FreeSparse(), I, i, icol, mnel, R, and x.

00376 {
00377   int i;
00378   for ( i=0 ; i < (*x)->m ; i++) 
00379     mnel[i] = (*x)->mnel[i];
00380   for ( i=0 ; i < (*x)->nel ; i++) 
00381     {
00382       icol[i] = (*x)->icol[i];
00383       R[i] = (*x)->R[i];
00384       if ( (*x)->it == 1 )I[i] = (*x)->I[i];
00385     }
00386   FreeSparse(*x);
00387   return 0;
00388 }

Here is the call graph for this function:

void C2F() cstringf ( char ***  ip,
int sciptr,
int m,
int n,
int max,
int ierr 
)

Definition at line 192 of file libinter.c.

References cvstr(), F2C(), FREE, i, ie, ierr, ip, j, job, l, m, max, n, and sciptr.

Referenced by crestringmatfromc(), and lcrestringmatfromc().

00196 {
00197   int i,j,l,ie;
00198   int job=0;
00199   int *chars;
00200   *ierr=0;
00201   if (5 + *m * *n > *max) {
00202     *ierr = 1;
00203     return;
00204   }
00205   sciptr[0]=10;
00206   sciptr[1]=*m;
00207   sciptr[2]=*n;
00208   sciptr[3]=0;
00209   sciptr[4]=1;
00210   chars=&(sciptr[5 + *m * *n]);
00211   ie=0;
00212   for (j = 0; j < *n; j++) {
00213     for (i = 0; i < *m; i++) {
00214       l=(int)strlen((*ip)[ie]);
00215       sciptr[ie+5]=sciptr[ie+4]+l;
00216       if (5 + *m * *n + sciptr[ie+5] > *max) {
00217         *ierr = 1;
00218         return;
00219       }
00220       F2C(cvstr)(&l,&(chars[sciptr[ie+4]-1]),(*ip)[ie],&job,l);
00221       FREE((*ip)[ie]);
00222       ie++;
00223     }
00224   }
00225   FREE((char *)*ip);
00226 }

Here is the call graph for this function:

Here is the caller graph for this function:

void C2F() dbl2cdbl ( int n,
ip  ,
double *  op 
)

Definition at line 269 of file libinter.c.

References i, ip, n, and op.

00273 {
00274   int i;
00275   for (i = 0; i < *n; i++)  (*ip)[i]=op[i];
00276 }

void C2F() freeptr ( ip   ) 

Definition at line 282 of file libinter.c.

References FREE, and ip.

00284 { 
00285   if (ip) FREE((char *)(*ip));
00286 }

void FreeRhsSVar ( char **  ptrStr  ) 

Definition at line 390 of file libinter.c.

References FREE, i, and NULL.

00391 {
00392         int i=0;
00393 
00394         if (ptrStr)
00395         {
00396                 while ( ptrStr[i] != NULL) 
00397                 { 
00398                         FREE(ptrStr[i]);
00399                         i++;
00400                 };
00401                 FREE(ptrStr);
00402                 ptrStr=NULL;
00403         }
00404 };

void FreeSparse ( SciSparse x  ) 

FreeSparse : free memory associated to a sparse

Parameters:
x 

Definition at line 362 of file libinter.c.

References FREE, scisparse::I, scisparse::icol, scisparse::it, scisparse::mnel, and scisparse::R.

Referenced by csparsef().

00363 {
00364   if ( x->it == 1 ) FREE(x->I);
00365   FREE(x->R);
00366   FREE(x->icol);
00367   FREE(x->mnel);
00368   FREE(x);
00369 }

Here is the caller graph for this function:

void C2F() int2cint ( int n,
ip  ,
integer op 
)

Definition at line 292 of file libinter.c.

References i, ip, n, and op.

00296 {
00297   int i;
00298   for (i = 0; i < *n; i++)  (*ip)[i]=op[i];
00299 }

SciSparse* NewSparse ( int it,
int m,
int n,
int nel 
)

New Sparse matrix

Parameters:
it 
m 
n 
nel 
Returns:

Definition at line 309 of file libinter.c.

References FREE, scisparse::I, scisparse::icol, scisparse::it, scisparse::m, MALLOC, scisparse::mnel, scisparse::n, scisparse::nel, and scisparse::R.

Referenced by ext14ce().

00310 {
00311   SciSparse *loc;
00312   loc = (SciSparse *) MALLOC((unsigned) sizeof(SciSparse));
00313   if ( loc == (SciSparse *) 0)
00314     {
00315       return((SciSparse *) 0);
00316     }
00317   loc->m = *m;
00318   loc->n = *n;
00319   loc->it = *it;
00320   loc->nel = *nel;
00321   loc->mnel = (int*) MALLOC((unsigned) (*m)*sizeof(int));
00322   if ( loc->mnel == (int *) 0)
00323     {
00324       FREE(loc);
00325       return((SciSparse *) 0);
00326     }
00327   loc->icol = (int*) MALLOC((unsigned) (*nel)*sizeof(int));
00328   if ( loc->icol == (int *) 0)
00329     {
00330       FREE(loc->mnel);
00331       FREE(loc);
00332       return((SciSparse *) 0);
00333     }
00334   loc->R =  (double*) MALLOC((unsigned) (*nel)*sizeof(double));
00335   if ( loc->R == (double *) 0)
00336     {
00337       FREE(loc->icol);
00338       FREE(loc->mnel);
00339       FREE(loc);
00340       return((SciSparse *) 0);
00341     }
00342 
00343   if ( *it == 1) 
00344     {
00345       loc->I =  (double*) MALLOC((unsigned) (*nel)*sizeof(double));
00346       if ( loc->I == (double *) 0)
00347         {
00348           FREE(loc->R);
00349           FREE(loc->icol);
00350           FREE(loc->mnel);
00351           FREE(loc);
00352           return((SciSparse *) 0);
00353         }
00354     }
00355   return(loc);
00356 }

Here is the caller graph for this function:

int C2F() stringc ( int sciptr,
char ***  cptr,
int ierr 
)

Definition at line 235 of file libinter.c.

References cptr, i, ierr, MALLOC, nstring, p, ptrstrings, ScilabStr2C(), and sciptr.

Referenced by crestringv().

00239 {
00240   char **strings,*p;
00241   int li,ni,*SciS,i,nstring,*ptrstrings;
00242   
00243   *ierr=0;
00244   nstring=sciptr[1]*sciptr[2];
00245   strings=(char **) MALLOC((unsigned) (nstring * sizeof(char *)));
00246   if (strings==0) {
00247     *ierr=1; return 0;
00248   }
00249   li=1;
00250   ptrstrings=&(sciptr[4]);
00251   SciS=&(sciptr[5+nstring]);
00252   for ( i=1 ; i<nstring+1 ; i++) 
00253     {
00254       ni=ptrstrings[i]-li;
00255       li=ptrstrings[i];
00256       ScilabStr2C(&ni,SciS,&p,ierr);
00257       strings[i-1]=p;
00258       if ( *ierr == 1) return 0;
00259       SciS += ni;
00260     }
00261   *cptr=strings;
00262   return 0;
00263 }

Here is the call graph for this function:

Here is the caller graph for this function:


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