#include <string.h>#include <stdio.h>#include <math.h>#include "machine.h"#include "scicos_block4.h"#include "intcscicos.h"#include "sci_mem_alloc.h"#include "stack-c.h"#include "sciprint.h"Include dependency graph for intcscicos.c:

Go to the source code of this file.
Definition at line 215 of file intcscicos.c.
References C2F, CheckLhs, CheckRhs, CreateVar, ctree4(), GetRhsVar, iadr, istk, iwhere, LhsVar, n, and nr.
00217 { 00218 int un=1,ipvec,nvec,mvec,noin,moin,ipoin,noinr,moinr,ipoinr; 00219 int nnd,mnd,ipnd,ntyp,mtyp,iptyp,ipr1,ipr2,n,nr,nn; 00220 00221 CheckRhs(5,5); 00222 CheckLhs(2,2); 00223 00224 GetRhsVar(1,"i",&nvec,&mvec,&ipvec); 00225 GetRhsVar(2,"i",&noin,&moin,&ipoin); 00226 GetRhsVar(3,"i",&noinr,&moinr,&ipoinr); 00227 GetRhsVar(4,"i",&nnd,&mnd,&ipnd); 00228 GetRhsVar(5,"i",&ntyp,&mtyp,&iptyp); 00229 n=nvec*mvec; 00230 nn=nnd*mnd; 00231 CreateVar(6,"i",&un,&nn,&ipr1); 00232 CreateVar(7,"i",&un,&nn,&ipr2); 00233 00234 ctree4(istk(ipvec),n,istk(ipnd),mnd,istk(iptyp),istk(ipoin), 00235 istk(ipoinr),istk(ipr1),istk(ipr2),&nr); 00236 00237 LhsVar(1)=6; 00238 LhsVar(2)=7; 00239 /* nbcols(6)=nr */ 00240 *istk(iadr(C2F(intersci).iwhere[5])+2)=nr; 00241 /* nbcols(7)=nr */ 00242 *istk(iadr(C2F(intersci).iwhere[6])+2)=nr; 00243 return 0; 00244 }
Here is the call graph for this function:

Definition at line 2168 of file intcscicos.c.
References C2F, createdata(), FALSE_, l, listentry(), Lstk, n, NULL, Rhs, stk, Top, TRUE_, and unsfdcopy().
Referenced by intgetscicosvarsc().
02169 { 02170 /* Local variablle definition*/ 02171 int ret,un=1; 02172 double *l; 02173 int n; 02174 02175 /* Test if we receive a NULL ptr header */ 02176 if (header==NULL) return FALSE_; 02177 02178 /* Get the start address of the i element of the input list*/ 02179 if ((l = (double *) listentry(header,i))==NULL) return FALSE_; 02180 02181 /* Compute the length of the i element in double word */ 02182 n = header[i+2]-header[i+1]; 02183 02184 /* Create empty data of a size n*sizeof(double) at the position lw */ 02185 if ((ret=C2F(createdata)(&lw, n*sizeof(double)))==FALSE_) return ret; 02186 02187 /* Copy the element i to position lw*/ 02188 C2F(unsfdcopy)(&n,l,&un,stk(*Lstk(lw + Top - Rhs)),&un); 02189 return TRUE_; 02190 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int createblklist | ( | scicos_block * | Blocks, | |
| int * | ierr, | |||
| int | flag_imp | |||
| ) |
Definition at line 2456 of file intcscicos.c.
References Blocks, buf, C2F, FREE, g, getscicosvarsfromimport(), scicos_block::insz, label, MALLOC, mklist(), mktlist(), mode, nblk, ng, scicos_block::nin, nout, scicos_block::nout, scicos_block::nrpar, nu, NULL, nv, scicos_block::nz, outptr, scicos_block::outsz, res, scicos_block::rpar, scierr(), str1, str2sci(), type, var2sci(), vvtosci(), scicos_block::work, x, xd, xptr, scicos_block::z, z, and zcptr.
02457 { 02458 /*local variable declaration*/ 02459 int k; 02460 int nu,mu,ny,my; 02461 int u_typ,y_typ; 02462 02463 /*variable used when imp_flag>=0*/ 02464 int nv,mv; /* length of data */ 02465 int nblk,ng; /* to store number of blocks and number of zero cross. */ 02466 void *ptr; /* ptr for data comming from import structure */ 02467 int *ptr_int; /* ptr to store ptr on integer */ 02468 double *ptr_double; /* ptr to store ptr on double */ 02469 int *xptr, *zcptr; /* to retrieve xptr by import and zcptr of scicos_blocks */ 02470 double *x,*xd,*g; /* ptr for x, xd and g for scicos_blocks */ 02471 02472 /* set length of block list -please update me- */ 02473 static int nblklst=31; 02474 /* set string of first element of scilab Blocks tlist -please update me- */ 02475 static char *str_blklst[]={ "scicos_block", "nevprt" , "funpt" , "type" , 02476 "scsptr" , "nz" , "z" , "nx" , 02477 "x" , "xd" , "res" , "nin" , 02478 "insz" , "inptr" , "nout" , "outsz" , 02479 "outptr" , "nevout" , "evout" , "nrpar" , 02480 "rpar" , "nipar" , "ipar" , "ng" , 02481 "g" , "ztyp" , "jroot" , "label" , 02482 "work" , "nmode" , "mode"}; 02483 02484 /* char ptr for str2sci - see below - */ 02485 char **str1; 02486 02487 02488 /* set nblk, x, xd ptr coming from import strucuture, 02489 * if flag_imp >=0 02490 */ 02491 if (flag_imp>=0) 02492 { 02493 /*retrieve nblk by import structure*/ 02494 strcpy(C2F(cha1).buf,"nblk"); 02495 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02496 if (*ierr==0) return 0; 02497 ptr_int = (int *) ptr; 02498 nblk = *ptr_int; 02499 02500 /* retrieve ng by import structure */ 02501 strcpy(C2F(cha1).buf,"ng"); 02502 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02503 ptr_int = (int *) ptr; /* cast void* ptr to int* ptr */ 02504 ng = *ptr_int; 02505 02506 /*retrieve xptr by import structure*/ 02507 strcpy(C2F(cha1).buf,"xptr"); 02508 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02509 if (*ierr==0) return 0; 02510 ptr_int = (int *) ptr; 02511 xptr = ptr_int; 02512 02513 /*retrieve zcptr by import structure*/ 02514 strcpy(C2F(cha1).buf,"zcptr"); 02515 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02516 ptr_int = (int *) ptr; 02517 zcptr = ptr_int; 02518 02519 /*retrieve x and xd by import structure*/ 02520 strcpy(C2F(cha1).buf,"x"); 02521 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02522 if (*ierr==0) return 0; 02523 ptr_double = (double *) ptr; 02524 x = ptr_double; 02525 xd = &x[xptr[nblk]-1]; 02526 02527 /*retrieve g by import structure*/ 02528 strcpy(C2F(cha1).buf,"g"); 02529 *ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 02530 ptr_double = (double *) ptr; 02531 g = ptr_double; 02532 } 02533 02534 /**************************** 02535 * create scilab tlist Blocks 02536 ****************************/ 02537 /* 1 - scicos_block */ 02538 str2sci(str_blklst,1,31); 02539 02540 /* 2 - nevprt */ 02541 *ierr=var2sci(&Blocks[0].nevprt,1,1,80); 02542 if (*ierr!=0) return 0; 02543 02544 /* 3 - funpt */ 02545 *ierr=var2sci(&Blocks[0].funpt,0,1,80); /* !!!! */ 02546 if (*ierr!=0) return 0; 02547 02548 /* 4 - type */ 02549 *ierr=var2sci(&Blocks[0].type,1,1,80); /* !!!! */ 02550 if (*ierr!=0) return 0; 02551 02552 /* 5 - scsptr */ 02553 *ierr=var2sci(&Blocks[0].scsptr,0,1,80); /* !!!! */ 02554 if (*ierr!=0) return 0; 02555 02556 /* 6 - nz */ 02557 *ierr=var2sci(&Blocks[0].nz,1,1,80); 02558 if (*ierr!=0) return 0; 02559 02560 /* 7 - z */ 02561 if(Blocks[0].scsptr>0) 02562 { 02563 C2F(vvtosci)(Blocks[0].z,&Blocks[0].nz); 02564 if (C2F(scierr)()!=0) return 0; 02565 } 02566 else 02567 { 02568 *ierr=var2sci(Blocks[0].z,Blocks[0].nz,1,10); 02569 if (*ierr!=0) return 0; 02570 } 02571 02572 /* 8 - nx */ 02573 *ierr=var2sci(&Blocks[0].nx,1,1,80); 02574 if (*ierr!=0) return 0; 02575 02576 /* 9 - x */ 02577 if (flag_imp>=0) *ierr=var2sci(&x[xptr[flag_imp]-1],Blocks[0].nx,1,10); 02578 else *ierr=var2sci(Blocks[0].x,Blocks[0].nx,1,10); 02579 if (*ierr!=0) return 0; 02580 02581 /* 10 - xd */ 02582 if (flag_imp>=0) *ierr=var2sci(&xd[xptr[flag_imp]-1],Blocks[0].nx,1,10); 02583 else *ierr=var2sci(Blocks[0].xd,Blocks[0].nx,1,10); 02584 if (*ierr!=0) return 0; 02585 02586 /* 11 - res */ 02587 *ierr=var2sci(Blocks[0].res,Blocks[0].nx,1,10); 02588 if (*ierr!=0) return 0; 02589 02590 /* 12 - nin */ 02591 *ierr=var2sci(&Blocks[0].nin,1,1,80); 02592 if (*ierr!=0) return 0; 02593 02594 /* 13 - insz */ 02595 *ierr=var2sci(Blocks[0].insz,3*Blocks[0].nin,1,80); 02596 if (*ierr!=0) return 0; 02597 02598 /* 14 - inptr */ 02599 for (k=0;k<Blocks[0].nin;k++) 02600 { 02601 nu=Blocks[0].insz[k]; /* retrieve number of rows */ 02602 mu=Blocks[0].insz[Blocks[0].nin+k]; /* retrieve number of cols */ 02603 u_typ=Blocks[0].insz[2*Blocks[0].nin+k]; /* retrieve type */ 02604 *ierr=var2sci(Blocks[0].inptr[k],nu,mu,u_typ); 02605 if (*ierr!=0) return 0; 02606 } 02607 C2F(mklist)(&Blocks[0].nin); /*create inptr list*/ 02608 02609 /* 15 - nout */ 02610 *ierr=var2sci(&Blocks[0].nout,1,1,80); 02611 if (*ierr!=0) return 0; 02612 02613 /* 16 - outsz */ 02614 *ierr=var2sci(Blocks[0].outsz,3*Blocks[0].nout,1,80); 02615 if (*ierr!=0) return 0; 02616 02617 /* 17 - outptr */ 02618 for (k=0;k<Blocks[0].nout;k++) 02619 { 02620 ny=Blocks[0].outsz[k]; /* retrieve number of rows */ 02621 my=Blocks[0].outsz[Blocks[0].nout+k]; /* retrieve number of cols */ 02622 y_typ=Blocks[0].outsz[2*Blocks[0].nout+k]; /* retrieve type */ 02623 *ierr=var2sci(Blocks[0].outptr[k],ny,my,y_typ); 02624 if (*ierr!=0) return 0; 02625 } 02626 C2F(mklist)(&Blocks[0].nout); /*create outptr list*/ 02627 02628 /* 18 - nevout */ 02629 *ierr=var2sci(&Blocks[0].nevout,1,1,80); 02630 if (*ierr!=0) return 0; 02631 02632 /* 19 - evout */ 02633 *ierr=var2sci(Blocks[0].evout,Blocks[0].nevout,1,10); 02634 if (*ierr!=0) return 0; 02635 02636 /* 20 - nrpar */ 02637 *ierr=var2sci(&Blocks[0].nrpar,1,1,80); 02638 if (*ierr!=0) return 0; 02639 02640 /* 21 - rpar */ 02641 if(Blocks[0].scsptr>0) 02642 { 02643 C2F(vvtosci)(Blocks[0].rpar,&Blocks[0].nrpar); 02644 if (C2F(scierr)()!=0) return 0; 02645 } 02646 else 02647 { 02648 *ierr=var2sci(Blocks[0].rpar,Blocks[0].nrpar,1,10); 02649 if (*ierr!=0) return 0; 02650 } 02651 02652 /* 22 - nipar */ 02653 *ierr=var2sci(&Blocks[0].nipar,1,1,80); 02654 if (*ierr!=0) return 0; 02655 02656 /* 23 - ipar */ 02657 *ierr=var2sci(Blocks[0].ipar,Blocks[0].nipar,1,80); 02658 if (*ierr!=0) return 0; 02659 02660 /* 24 - ng */ 02661 *ierr=var2sci(&Blocks[0].ng,1,1,80); 02662 if (*ierr!=0) return 0; 02663 02664 /* 25 - g */ 02665 if (flag_imp>=0) *ierr=var2sci(&g[zcptr[flag_imp]-1],Blocks[0].ng,1,10); 02666 else *ierr=var2sci(Blocks[0].g,Blocks[0].ng,1,10); 02667 if (*ierr!=0) return 0; 02668 02669 /* 26 - ztyp */ 02670 *ierr=var2sci(&Blocks[0].ztyp,1,1,80); 02671 if (*ierr!=0) return 0; 02672 02673 /* 27 - jroot */ 02674 *ierr=var2sci(Blocks[0].jroot,Blocks[0].ng,1,80); 02675 if (*ierr!=0) return 0; 02676 02677 /* 28 - label */ 02678 if ((str1=MALLOC(sizeof(char*))) ==NULL ) return 0; 02679 if ((str1[0]=MALLOC(sizeof(char)*(strlen(Blocks[0].label)+1))) ==NULL ) return 0; 02680 (str1[0])[strlen(Blocks[0].label)]='\0'; 02681 strncpy(str1[0],Blocks[0].label,strlen(Blocks[0].label)); 02682 str2sci(str1,1,1); 02683 FREE(str1[0]); 02684 FREE(str1); 02685 if (C2F(scierr)()!=0) return 0; 02686 02687 /* 29 - work*/ 02688 C2F(vvtosci)(*Blocks[0].work,(k=0,&k)); 02689 if (C2F(scierr)()!=0) return 0; 02690 02691 /* 30 - nmode*/ 02692 *ierr=var2sci(&Blocks[0].nmode,1,1,80); 02693 if (*ierr!=0) return 0; 02694 02695 /* 31 - mode */ 02696 *ierr=var2sci(Blocks[0].mode,Blocks[0].nmode,1,80); 02697 if (*ierr!=0) return 0; 02698 02699 C2F(mktlist)(&nblklst); /*create Blocks list*/ 02700 if (C2F(scierr)()!=0) return 0; 02701 02702 /*return 1 if succeeded */ 02703 return 1; 02704 }
Here is the call graph for this function:

| int intbuildouttb | ( | char * | fname | ) |
Definition at line 3280 of file intcscicos.c.
References CheckLhs, CheckRhs, sciintmat::D, FREE, GetRhsVar, i, I_CHAR, I_INT16, I_INT32, I_UCHAR, I_UINT16, I_UINT32, IC_CHAR, IC_INT16, IC_INT32, IC_UCHAR, IC_UINT16, IC_UINT32, ierr, sciintmat::it, j, m1, m2, MALLOC, n1, n2, NULL, stk, and VarType.
03282 { 03283 static int l1, m1, n1; 03284 static int l2, m2, n2; 03285 static int l3,n3=1; 03286 SciIntMat M1,M2,M3; 03287 03288 int n_lnksz,n_lnktyp; 03289 int *lnksz=NULL,*lnktyp=NULL; 03290 03291 double *ptr_d,*ptr_dc; 03292 int *ptr_i; 03293 short *ptr_s; 03294 char *ptr_c; 03295 int *ptr_ui; 03296 short *ptr_us; 03297 char *ptr_uc; 03298 03299 int nm,i,j,ierr=0; 03300 03301 static int minlhs=1, maxlhs=1, minrhs=2, maxrhs=2; 03302 03303 /*check number of lhs/rhs*/ 03304 CheckLhs(minlhs,maxlhs); 03305 CheckRhs(minrhs,maxrhs); 03306 03307 /*check type of Rhs 1*/ 03308 if (VarType(1)==1) 03309 { 03310 GetRhsVar(1, "d", &m1, &n1, &l1); 03311 } 03312 else if (VarType(1)==8) 03313 { 03314 GetRhsVar(1, "I", &m1, &n1, &M1); 03315 } 03316 else 03317 { 03318 Scierror(888,"%s : first argument must be double or int32.\n",fname); 03319 return 0; 03320 } 03321 /*check size of Rhs 1*/ 03322 if (m1==2) n_lnksz=n1; 03323 else if (n1==2) n_lnksz=m1; 03324 else 03325 { 03326 Scierror(888,"%s : bad dimension for first argument.\n",fname); 03327 return 0; 03328 } 03329 /*allocate lnksz*/ 03330 if ((lnksz=MALLOC(2*n_lnksz*sizeof(int)))==NULL) 03331 { 03332 Scierror(999,"%s : No more free memory.\n",fname); 03333 return 0; 03334 } 03335 03336 /*check type of Rhs 2*/ 03337 if (VarType(2)==1) 03338 { 03339 GetRhsVar(2, "d", &m2, &n2, &l2); 03340 } 03341 else if (VarType(2)==8) 03342 { 03343 GetRhsVar(2, "I", &m2, &n2, &M2); 03344 } 03345 else 03346 { 03347 Scierror(888,"%s : second argument must be double or int32.\n",fname); 03348 if (lnksz!=NULL) FREE(lnksz); 03349 return 0; 03350 } 03351 /*check size of Rhs 2*/ 03352 if (m2==1) n_lnktyp=n2; 03353 else if (n2==1) n_lnktyp=m2; 03354 else 03355 { 03356 Scierror(888,"%s : bad dimension for second argument.\n",fname); 03357 if (lnksz!=NULL) FREE(lnksz); 03358 return 0; 03359 } 03360 03361 /*cross size checking*/ 03362 if (n_lnksz!=n_lnktyp) 03363 { 03364 Scierror(888,"%s : first and second argument must have " 03365 "the same length.\n",fname); 03366 if (lnksz!=NULL) FREE(lnksz); 03367 return 0; 03368 } 03369 03370 /* Allocate lnktyp*/ 03371 if ((lnktyp=MALLOC(n_lnktyp*sizeof(int)))==NULL) 03372 { 03373 Scierror(999,"%s : No more free memory.\n",fname); 03374 if (lnksz!=NULL) FREE(lnksz); 03375 return 0; 03376 } 03377 03378 /*store rhs 1 in lnksz */ 03379 if ((m1==n1)&&(m2==m1)) m1=-1; /* this is done for matrix 2,2 */ 03380 if (VarType(1)==8) 03381 { 03382 switch (M1.it) 03383 { 03384 case I_CHAR : if (m1==2) 03385 { 03386 for(j=0;j<n_lnksz;j++) 03387 { 03388 lnksz[j]=(int) IC_CHAR(M1.D)[j*2]; 03389 lnksz[n_lnksz+j]=(int) IC_CHAR(M1.D)[2*j+1]; 03390 } 03391 } 03392 else 03393 { 03394 for(j=0;j<2*n_lnksz;j++) 03395 lnksz[j]=(int) IC_CHAR(M1.D)[j]; 03396 } 03397 break; 03398 03399 case I_INT16 : if (m1==2) 03400 { 03401 for(j=0;j<n_lnksz;j++) 03402 { 03403 lnksz[j]=(int) IC_INT16(M1.D)[j*2]; 03404 lnksz[n_lnksz+j]=(int) IC_INT16(M1.D)[2*j+1]; 03405 } 03406 } 03407 else 03408 { 03409 for(j=0;j<2*n_lnksz;j++) 03410 lnksz[j]=(int) IC_INT16(M1.D)[j]; 03411 } 03412 break; 03413 03414 case I_INT32 : if (m1==2) 03415 { 03416 for(j=0;j<n_lnksz;j++) 03417 { 03418 lnksz[j]=(int) IC_INT32(M1.D)[j*2]; 03419 lnksz[n_lnksz+j]=(int) IC_INT32(M1.D)[2*j+1]; 03420 } 03421 } 03422 else 03423 { 03424 for(j=0;j<2*n_lnksz;j++) 03425 lnksz[j]=(int) IC_INT32(M1.D)[j]; 03426 } 03427 break; 03428 03429 case I_UCHAR : if (m1==2) 03430 { 03431 for(j=0;j<n_lnksz;j++) 03432 { 03433 lnksz[j]=(int) IC_UCHAR(M1.D)[j*2]; 03434 lnksz[n_lnksz+j]=(int) IC_UCHAR(M1.D)[2*j+1]; 03435 } 03436 } 03437 else 03438 { 03439 for(j=0;j<2*n_lnksz;j++) 03440 lnksz[j]=(int) IC_UCHAR(M1.D)[j]; 03441 } 03442 break; 03443 03444 case I_UINT16 : if (m1==2) 03445 { 03446 for(j=0;j<n_lnksz;j++) 03447 { 03448 lnksz[j]=(int) IC_UINT16(M1.D)[j*2]; 03449 lnksz[n_lnksz+j]=(int) IC_UINT16(M1.D)[2*j+1]; 03450 } 03451 } 03452 else 03453 { 03454 for(j=0;j<2*n_lnksz;j++) 03455 lnksz[j]=(int) IC_UINT16(M1.D)[j]; 03456 } 03457 break; 03458 03459 case I_UINT32 : if (m1==2) 03460 { 03461 for(j=0;j<n_lnksz;j++) 03462 { 03463 lnksz[j]=(int) IC_UINT32(M1.D)[j*2]; 03464 lnksz[n_lnksz+j]=(int) IC_UINT32(M1.D)[2*j+1]; 03465 } 03466 } 03467 else 03468 { 03469 for(j=0;j<2*n_lnksz;j++) 03470 lnksz[j]=(int) IC_UINT32(M1.D)[j]; 03471 } 03472 break; 03473 } 03474 } 03475 else 03476 { 03477 if (m1==2) 03478 { 03479 for(j=0;j<n_lnksz;j++) 03480 { 03481 lnksz[j]=(int) ((double *) stk(l1))[j*2]; 03482 lnksz[n_lnksz+j]=(int) ((double *) stk(l1))[2*j+1]; 03483 } 03484 } 03485 else 03486 { 03487 for(j=0;j<2*n_lnksz;j++) 03488 lnksz[j]=(int) ((double *) stk(l1))[j]; 03489 } 03490 } 03491 03492 /*store rhs 2 in lnktyp */ 03493 if (VarType(2)==8) 03494 { 03495 switch (M2.it) 03496 { 03497 case I_CHAR : for(j=0;j<n_lnktyp;j++) 03498 lnktyp[j]=(int) IC_CHAR(M2.D)[j]; 03499 break; 03500 03501 case I_INT16 : for(j=0;j<n_lnktyp;j++) 03502 lnktyp[j]=(int) IC_INT16(M2.D)[j]; 03503 break; 03504 03505 case I_INT32 : for(j=0;j<n_lnktyp;j++) 03506 lnktyp[j]=(int) IC_INT32(M2.D)[j]; 03507 break; 03508 03509 case I_UCHAR : for(j=0;j<n_lnktyp;j++) 03510 lnktyp[j]=(int) IC_UCHAR(M2.D)[j]; 03511 break; 03512 03513 case I_UINT16 : for(j=0;j<n_lnktyp;j++) 03514 lnktyp[j]=(int) IC_UINT16(M2.D)[j]; 03515 break; 03516 03517 case I_UINT32 : for(j=0;j<n_lnktyp;j++) 03518 lnktyp[j]=(int) IC_UINT32(M2.D)[j]; 03519 break; 03520 } 03521 } 03522 else 03523 { 03524 for(j=0;j<n_lnktyp;j++) 03525 lnktyp[j]=(int) ((double *) stk(l2))[j]; 03526 } 03527 03528 /* build output list */ 03529 CreateVar(3,"l",&n_lnktyp,&n3,&l3); 03530 03531 for(i=0;i<n_lnktyp;i++) 03532 { 03533 nm=lnksz[i]*lnksz[i+n_lnktyp]; 03534 switch (lnktyp[i]) 03535 { 03536 case 1 : if ((ptr_d=MALLOC(nm*sizeof(double)))==NULL) 03537 { 03538 ierr=-1; 03539 break; 03540 } 03541 for (j=0;j<nm;j++) ptr_d[j]=0; 03542 CreateListVarFromPtr(3,i+1,"d",&lnksz[i],&lnksz[i+n_lnktyp], &ptr_d); 03543 FREE(ptr_d); 03544 break; 03545 03546 case 2 : if ((ptr_d=MALLOC(2*nm*sizeof(double)))==NULL) 03547 { 03548 ierr=-1; 03549 break; 03550 } 03551 for (j=0;j<2*nm;j++) ptr_d[j]=0; 03552 ptr_dc = &ptr_d[nm]; 03553 CreateListCVarFromPtr(3,i+1,"d",(j=1,&j),&lnksz[i],&lnksz[i+n_lnktyp],&ptr_d,&ptr_dc); 03554 FREE(ptr_d); 03555 break; 03556 03557 case 3 : if ((ptr_i=MALLOC(nm*sizeof(int)))==NULL) 03558 { 03559 ierr=-1; 03560 break; 03561 } 03562 for (j=0;j<nm;j++) ptr_i[j]=0; 03563 M3.m = lnksz[i]; 03564 M3.n = lnksz[i+n_lnktyp]; 03565 M3.it = 4; 03566 M3.l = -1; 03567 M3.D = ptr_i; 03568 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03569 FREE(ptr_i); 03570 break; 03571 03572 case 4 : if ((ptr_s=MALLOC(nm*sizeof(short)))==NULL) 03573 { 03574 ierr=-1; 03575 break; 03576 } 03577 for (j=0;j<nm;j++) ptr_s[j]=0; 03578 M3.m = lnksz[i]; 03579 M3.n = lnksz[i+n_lnktyp]; 03580 M3.it = 2; 03581 M3.l = -1; 03582 M3.D = ptr_s; 03583 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03584 FREE(ptr_s); 03585 break; 03586 03587 case 5 : if ((ptr_c=MALLOC(nm*sizeof(char)))==NULL) 03588 { 03589 ierr=-1; 03590 break; 03591 } 03592 for (j=0;j<nm;j++) ptr_c[j]=0; 03593 M3.m = lnksz[i]; 03594 M3.n = lnksz[i+n_lnktyp]; 03595 M3.it = 1; 03596 M3.l = -1; 03597 M3.D = ptr_c; 03598 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03599 FREE(ptr_c); 03600 break; 03601 03602 case 6 : if ((ptr_ui=MALLOC(nm*sizeof(unsigned int)))==NULL) 03603 { 03604 ierr=-1; 03605 break; 03606 } 03607 for (j=0;j<nm;j++) ptr_ui[j]=0; 03608 M3.m = lnksz[i]; 03609 M3.n = lnksz[i+n_lnktyp]; 03610 M3.it = 14; 03611 M3.l = -1; 03612 M3.D = ptr_ui; 03613 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03614 FREE(ptr_ui); 03615 break; 03616 03617 case 7 : if ((ptr_us=MALLOC(nm*sizeof(unsigned short)))==NULL) 03618 { 03619 ierr=-1; 03620 break; 03621 } 03622 for (j=0;j<nm;j++) ptr_us[j]=0; 03623 M3.m = lnksz[i]; 03624 M3.n = lnksz[i+n_lnktyp]; 03625 M3.it = 12; 03626 M3.l = -1; 03627 M3.D = ptr_us; 03628 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03629 FREE(ptr_us); 03630 break; 03631 03632 case 8 : if ((ptr_uc=MALLOC(nm*sizeof(unsigned char)))==NULL) 03633 { 03634 ierr=-1; 03635 break; 03636 } 03637 for (j=0;j<nm;j++) ptr_uc[j]=0; 03638 M3.m = lnksz[i]; 03639 M3.n = lnksz[i+n_lnktyp]; 03640 M3.it = 11; 03641 M3.l = -1; 03642 M3.D = ptr_uc; 03643 CreateListVarFromPtr(3,i+1,"I",&M3.m,&M3.n,&M3); 03644 FREE(ptr_uc); 03645 break; 03646 03647 default : if ((ptr_d=MALLOC(nm*sizeof(double)))==NULL) 03648 { 03649 ierr=-1; 03650 break; 03651 } 03652 for (j=0;j<nm;j++) ptr_d[j]=0; 03653 CreateListVarFromPtr(3,i+1,"d",&lnksz[i],&lnksz[i+n_lnktyp], &ptr_d); 03654 FREE(ptr_d); 03655 break; 03656 } 03657 03658 if (ierr==-1) 03659 { 03660 Scierror(999,"%s : No more free memory.\n",fname); 03661 FREE(lnksz); 03662 FREE(lnktyp); 03663 return 0; 03664 } 03665 } 03666 03667 LhsVar(1)=3; 03668 03669 FREE(lnksz); 03670 FREE(lnktyp); 03671 return 0; 03672 }
Definition at line 333 of file intcscicos.c.
References C2F, CALLOC, CheckLhs, CheckRhs, cord, cpass2(), CreateListVarFromPtr, CreateVar, CreateVarFromPtr, critev, cvstr(), evtspt, FREE, GetData(), GetRhsVar, i, inplnk, iord, istk, j, lc1, LhsVar, listentry(), long, m, m1, m2, MALLOC, Max1(), memcpy(), Message(), MlistGetFieldNumber(), modptr, n1, n2, nb, nblk, NULL, ok, oord, ordclk, ordptr, outlnk, pointi, REALLOC, tevts, unsfdcopy(), zcptr, and zord.
00336 { 00337 static int l1,l2,m1,m2,m3; 00338 static int n1,n2,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n43; 00339 static int n17,n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30; 00340 static int minlhs=5, maxlhs=5, minrhs=5, maxrhs=5; 00341 static int one=1,deux=2; 00342 static int n33,n34,n35,n36,n37,n38,n1111,n1313,n41,n42,*y40,l40,l39; 00343 int m31=8,n31=1,l31,n32=8; 00344 static int *header,*li,*le1,*le11,*le2,*le3,*le4,*le5,*le6,*le7,*le8,*le9; 00345 static int *le10,*le12,*le13,*header1,*lii,*le14,*le15; 00346 static int m,me12,ne2,ne3,ne4,ne5,ne6,ne7,ne8,ne9,ne11,ne12,ne71,ne81; 00347 static double *le66,*le77,*le88,*le1111,*le121,*le22,*le33,*le44,*le55,*le71; 00348 static double *le81,*le99,*xd0k,*lc1,*rpark,*le1414,*le1515; 00349 static int *le1010,*le111,*le1313,nc1,mc1,l33,l3,m4,*vecnull; 00350 static char *Str1[]={ "xcs","x","z","iz","tevts","evtspt","pointi","outtb"}; 00351 double *y1,*y2,*y4,*y17; 00352 int *y3,*y5,*y6,*y7,*y9,*y10,*y11,*y12,*y13,*y14,*y15,*y16,*y18,*y19,*y20,*y38,*y39; 00353 int *y21,*y22,*y23,*y24,*y25,*y26,*y27,*y28,*y29,*y30,*y31,*y32,*y33,*y34,*y35,*y41; 00354 static char *Str2[]={ "scs","funs","xptr","zptr","zcptr","inpptr","outptr","inplnk", 00355 "outlnk","lnkptr","rpar","rpptr","ipar","ipptr","clkptr","ordptr", 00356 "execlk","ordclk","cord","oord","zord","critev","nb","ztyp", 00357 "nblk","ndcblk","subscr","funtyp","iord","labels","modptr"}; 00358 int m33=31,n39=1,l32,n40=31; 00359 char **y36,**y8,*y37; 00360 int i,j,k,ok,zeros=0; 00361 int *bllst2,*bllst3,*bllst4,*bllst5,*bllst12,*bllst9,*nzcross,*nmode; 00362 int *bllst2ptr,*bllst3ptr,*bllst4ptr,*bllst112,*bllst6ptr,*bllst7ptr; 00363 int *bllst5ptr,*typ_x,*bllst8ptr,*bllst9ptr; 00364 int *bllst11ptr,*connectmat,*clkconnect; 00365 int *corinvec,*corinvptr,*evtspt,pointi,*outtb,*pointiptr; 00366 int *zcptr,*modptr,*nbptr,*nblkptr,*ndcblkptr; 00367 int *inplnk,*outlnk,*lnkptr,*ordptr; 00368 int *execlk,*ordclk,*cord,*oord,*zord,*iz0,*subscr; 00369 int *critev,nb,*ztyp,nblk,ndcblk,*iord,solver,*solverptr; 00370 double *bllst6,*bllst7,*bllst8,*bllst11,*tevts,*xcd0,*ppd; 00371 char **bllst111,**bllst10,**bllst13; 00372 /*unsigned long str_len;*/ 00373 int moinsun=-1, field_num; 00374 char *field_name; 00375 00376 xcd0=NULL; 00377 ppd=NULL; 00378 pointiptr=NULL; 00379 nbptr=NULL; 00380 nblkptr=NULL; 00381 ndcblkptr=NULL; 00382 /* Check number of inputs (rhs) and outputs (lhs) */ 00383 CheckRhs(minrhs,maxrhs) ; 00384 CheckLhs(minlhs,maxlhs) ; 00385 00386 header= (int*) GetData(1); 00387 m=header[1]; 00388 if ((bllst111=MALLOC(sizeof(char*)*(m+1))) ==NULL ) return 0; 00389 ((int*)bllst111)[0]=m; 00390 if ((bllst112=MALLOC(sizeof(int)*(m+1))) ==NULL ) return 0; 00391 bllst112[0]=m; 00392 if ((bllst2ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00393 bllst2ptr[0]=m+1; 00394 bllst2ptr[1]=1; 00395 if ((bllst2=MALLOC(sizeof(int))) ==NULL ) return 0; 00396 bllst2[0]=0; 00397 if ((bllst3ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00398 bllst3ptr[0]=m+1; 00399 bllst3ptr[1]=1; 00400 if ((bllst3=MALLOC(sizeof(int))) ==NULL ) return 0; 00401 bllst3[0]=0; 00402 if ((bllst4ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00403 bllst4ptr[0]=m+1; 00404 bllst4ptr[1]=1; 00405 if ((bllst4=MALLOC(sizeof(int))) ==NULL ) return 0; 00406 bllst4[0]=0; 00407 if ((bllst5ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00408 bllst5ptr[0]=m+1; 00409 bllst5ptr[1]=1; 00410 if ((bllst5=MALLOC(sizeof(int))) ==NULL ) return 0; 00411 bllst5[0]=0; 00412 if ((bllst6ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00413 bllst6ptr[0]=m+1; 00414 bllst6ptr[1]=1; 00415 if ((bllst6=MALLOC(sizeof(double))) ==NULL ) return 0; 00416 ((int*) bllst6)[0]=0; 00417 if ((bllst7ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00418 bllst7ptr[0]=m+1; 00419 bllst7ptr[1]=1; 00420 if ((bllst7=MALLOC(sizeof(double))) ==NULL ) return 0; 00421 ((int*) bllst7)[0]=0; 00422 if ((bllst8ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00423 bllst8ptr[0]=m+1; 00424 bllst8ptr[1]=1; 00425 if ((bllst8=MALLOC(sizeof(double))) ==NULL ) return 0; 00426 ((int*) bllst8)[0]=0; 00427 if ((bllst9ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00428 bllst9ptr[0]=m+1; 00429 bllst9ptr[1]=1; 00430 if ((bllst9=MALLOC(sizeof(int))) ==NULL ) return 0; 00431 bllst9[0]=0; 00432 if ((nmode=MALLOC(sizeof(int)*(m+1))) ==NULL ) return 0; 00433 nmode[0]=m; 00434 if ((nzcross=MALLOC(sizeof(int)*(m+1))) ==NULL ) return 0; 00435 nzcross[0]=m; 00436 if ((bllst10=(char**) MALLOC(sizeof(char *)*(m+1))) ==NULL ) return 0; 00437 ((int*) bllst10)[0]=m; 00438 if ((bllst11ptr=MALLOC(sizeof(int)*(m+2))) ==NULL ) return 0; 00439 bllst11ptr[0]=m+1; 00440 bllst11ptr[1]=1; 00441 if ((bllst11=MALLOC(sizeof(double))) ==NULL ) return 0; 00442 ((int*) bllst11)[0]=0; 00443 if ((bllst12=MALLOC(sizeof(int)*(m+m+1))) ==NULL ) return 0; 00444 bllst12[0]=m+m; 00445 if ((bllst13=MALLOC(sizeof(char *)*(m+1))) ==NULL ) return 0; 00446 ((int*) bllst13)[0]=m; 00447 if ((xcd0=(double*)MALLOC(sizeof(double))) == NULL) return 0; 00448 ((int*) xcd0)[0]=0; 00449 if ((typ_x=CALLOC(m+1,sizeof(int))) ==NULL ) return 0; 00450 typ_x[0]=m; 00451 00452 for (k=1; k <= m; k++) 00453 { 00454 li=(int*) listentry(header,k); /*le pointeur sur la kieme sous list (mlists)*/ 00455 /* Le rang du champs*/ 00456 /* MlistGetFieldNumber*/ 00457 00458 /* 1ier element de la list sim*/ 00459 if ((field_name=(char*) MALLOC(sizeof(char)*4)) ==NULL ) return 0; 00460 ((char*) field_name)[3]='\0'; 00461 strcpy (field_name,"sim"); 00462 field_num=MlistGetFieldNumber(li,field_name); 00463 le1=(int*) listentry(li,field_num); 00464 FREE(field_name); 00465 /*si sim est une list*/ 00466 if (le1[0] == 15) 00467 { 00468 le11=(int*) listentry(le1,1); /*sim(1)*/ 00469 if (le11[0] == 13) 00470 { 00471 if ((bllst111[k]=(char*) MALLOC(sizeof(char)*9)) ==NULL ) return 0; 00472 ((char*) bllst111[k])[8]='\0'; 00473 strcpy (bllst111[k],"sciblock"); 00474 bllst112[k]=3; 00475 } 00476 else 00477 { 00478 le111=((int *) (le11+6)); 00479 n1111=le11[5]-1; 00480 if ((bllst111[k]=(char*) MALLOC(sizeof(char)*(n1111+1))) ==NULL ) return 0; 00481 ((char*) bllst111[k])[n1111]='\0'; 00482 C2F(cvstr)(&n1111,le111,bllst111[k],&one,(unsigned long)strlen(bllst111[k])); 00483 00484 le12=(int*) listentry(le1,2); /*sim(2)*/ 00485 le121=((double *) (le12+4)); 00486 bllst112[k]=(int)le121[0]; 00487 } 00488 } 00489 else 00490 { 00491 le111=((int *) (le1+6)); 00492 bllst112[k]=0; 00493 n1111=le1[5]-1; 00494 if ((bllst111[k]=(char*) MALLOC(sizeof(char)*(n1111+1))) ==NULL ) return 0; 00495 ((char*) bllst111[k])[n1111]='\0'; 00496 C2F(cvstr)(&n1111,le111,bllst111[k],&one,(unsigned long)strlen(bllst111[k])); 00497 00498 } 00499 /* 2ieme element de la list in */ 00500 if ((field_name=(char*) MALLOC(sizeof(char)*3)) ==NULL ) return 0; 00501 ((char*) field_name)[2]='\0'; 00502 strcpy (field_name,"in"); 00503 field_num=MlistGetFieldNumber(li,field_name); 00504 FREE(field_name); 00505 le2=(int*) listentry(li,field_num); 00506 ne2=le2[1]; 00507 le22=((double *) (le2+4)); 00508 bllst2ptr[k+1]=bllst2ptr[k]+ne2; 00509 if ((bllst2=REALLOC(bllst2,sizeof(int)*(bllst2[0]+ne2+1))) ==NULL ) return 0; 00510 for (j=0; j< ne2; j++) 00511 { 00512 bllst2[bllst2[0]+j+1]=(int)le22[j]; 00513 } 00514 bllst2[0]=bllst2[0]+ne2; 00515 /* 3ieme element de la list out*/ 00516 if ((field_name=(char*) MALLOC(sizeof(char)*4)) ==NULL ) return 0; 00517 ((char*) field_name)[3]='\0'; 00518 strcpy (field_name,"out"); 00519 field_num=MlistGetFieldNumber(li,field_name); 00520 FREE(field_name); 00521 le3=(int*) listentry(li,field_num); 00522 ne3=le3[1]; 00523 le33=((double *) (le3+4)); 00524 bllst3ptr[k+1]=bllst3ptr[k]+ne3; 00525 if ((bllst3=REALLOC(bllst3,sizeof(int)*(bllst3[0]+ne3+1))) ==NULL ) return 0; 00526 for (j=0; j< ne3; j++) 00527 { 00528 bllst3[bllst3[0]+j+1]=(int)le33[j]; 00529 } 00530 bllst3[0]=bllst3[0]+ne3; 00531 /* 4ieme element de la list evtin*/ 00532 if ((field_name=(char*) MALLOC(sizeof(char)*6)) ==NULL ) return 0; 00533 ((char*) field_name)[5]='\0'; 00534 strcpy (field_name,"evtin"); 00535 field_num=MlistGetFieldNumber(li,field_name); 00536 FREE(field_name); 00537 le4=(int*) listentry(li,field_num); 00538 ne4=le4[1]; 00539 le44=((double *) (le4+4)); 00540 bllst4ptr[k+1]=bllst4ptr[k]+ne4; 00541 if ((bllst4=REALLOC(bllst4,sizeof(int)*(bllst4[0]+ne4+1))) ==NULL ) return 0; 00542 for (j=0; j< ne4; j++) 00543 { 00544 bllst4[bllst4[0]+j+1]=(int)le44[j]; 00545 } 00546 bllst4[0]=bllst4[0]+ne4; 00547 /* 5ieme element de la list evtout*/ 00548 if ((field_name=(char*) MALLOC(sizeof(char)*7)) ==NULL ) return 0; 00549 ((char*) field_name)[6]='\0'; 00550 strcpy (field_name,"evtout"); 00551 field_num=MlistGetFieldNumber(li,field_name); 00552 FREE(field_name); 00553 le5=(int*) listentry(li,field_num); 00554 ne5=le5[1]; 00555 le55=((double *) (le5+4)); 00556 bllst5ptr[k+1]=bllst5ptr[k]+ne5; 00557 if ((bllst5=REALLOC(bllst5,sizeof(int)*(bllst5[0]+ne5+1))) ==NULL ) return 0; 00558 for (j=0; j< ne5; j++) 00559 { 00560 bllst5[bllst5[0]+j+1]=(int)le55[j]; 00561 } 00562 bllst5[0]=bllst5[0]+ne5; 00563 /* 6ieme element de la list state*/ 00564 if ((field_name=(char*) MALLOC(sizeof(char)*6)) ==NULL ) return 0; 00565 ((char*) field_name)[5]='\0'; 00566 strcpy (field_name,"state"); 00567 field_num=MlistGetFieldNumber(li,field_name); 00568 FREE(field_name); 00569 le6=(int*) listentry(li,field_num); 00570 ne6=le6[1]; 00571 le66=((double *) (le6+4)); 00572 if (bllst112[k]<10000) 00573 { 00574 if ((xcd0=(double*)REALLOC(xcd0,sizeof(double)*(((int*) xcd0)[0]+ne6+1))) == NULL ) return 0; 00575 if ((bllst6=(double*)REALLOC(bllst6,sizeof(double)*(((int *) bllst6)[0]+ne6+1))) ==NULL ) return 0; 00576 for (j=0;j<ne6;j++) 00577 { 00578 xcd0[j+((int*) xcd0)[0]+1]=0; 00579 bllst6[((int *) bllst6)[0]+j+1]=le66[j]; 00580 } 00581 ((int*) xcd0)[0]=((int*) xcd0)[0]+ne6; 00582 ((int *) bllst6)[0]=((int *) bllst6)[0]+ne6; 00583 bllst6ptr[k+1]=bllst6ptr[k]+ne6; 00584 } 00585 else 00586 { 00587 if ((xcd0=(double*)REALLOC(xcd0,sizeof(double)*(((int*) xcd0)[0]+ne6/2+1))) == NULL ) return 0; 00588 if ((bllst6=(double*)REALLOC(bllst6,sizeof(double)*(((int *) bllst6)[0]+ne6/2+1))) ==NULL ) return 0; 00589 for (j=0; j < ne6/2; j++) 00590 { 00591 xcd0[j+1+((int*) xcd0)[0]]=le66[j+ne6/2]; 00592 bllst6[((int *) bllst6)[0]+j+1]=le66[j]; 00593 } 00594 ((int*) xcd0)[0]=((int*) xcd0)[0]+ne6/2; 00595 ((int *) bllst6)[0]=((int *) bllst6)[0]+ne6/2; 00596 bllst6ptr[k+1]=bllst6ptr[k]+ne6/2; 00597 } 00598 if ( ne6 != 0 ) typ_x[k]=1; 00599 /* 7ieme element de la list dstate et le 8ieme element de la list rpar*/ 00600 if ((field_name=(char*) MALLOC(sizeof(char)*7)) ==NULL ) return 0; 00601 ((char*) field_name)[6]='\0'; 00602 strcpy (field_name,"dstate"); 00603 field_num=MlistGetFieldNumber(li,field_name); 00604 FREE(field_name); 00605 le71=(double *) listentry(li,field_num); 00606 le7=(int*) listentry(li,field_num); 00607 ne7= le7[1]; 00608 le77=((double *) (le7+4)); 00609 00610 if ((field_name=(char*) MALLOC(sizeof(char)*5)) ==NULL ) return 0; 00611 ((char*) field_name)[4]='\0'; 00612 strcpy (field_name,"rpar"); 00613 field_num=MlistGetFieldNumber(li,field_name); 00614 FREE(field_name); 00615 le81=(double *) listentry(li,field_num); 00616 le8=(int*) listentry(li,field_num); 00617 ne8=le8[1]; 00618 le88=((double *) (le8+4)); 00619 if ( bllst112[k] == 3 || bllst112[k] == 5 || bllst112[k] == 10005) 00620 { 00621 if (ne7 != 0) 00622 { 00623 ne71=li[8+2]-li[8+1]; 00624 if ((xd0k=(double*)MALLOC(sizeof(double)*(ne71+1))) ==NULL ) return 0; 00625 ((int *) xd0k)[0]=ne71; 00626 00627 C2F(unsfdcopy)(&ne71,le71,&moinsun,(xd0k+1),&moinsun); 00628 bllst7ptr[k+1]=bllst7ptr[k]+ne71; 00629 if ((bllst7=REALLOC(bllst7,sizeof(double)*(((int *) bllst7)[0]+ne71+1))) ==NULL ) return 0; 00630 for (j=1; j< ne71+1; j++) 00631 { 00632 bllst7[((int *) bllst7)[0]+j]=xd0k[j]; 00633 } 00634 ((int *) bllst7)[0]=((int *) bllst7)[0]+ne71; 00635 FREE(xd0k); 00636 } 00637 else 00638 { 00639 bllst7ptr[k+1]=bllst7ptr[k]; 00640 } 00641 if (ne8 != 0) 00642 { 00643 ne81=li[9+2]-li[9+1]; 00644 if ((rpark=(double*)MALLOC(sizeof(double)*(ne81+1))) ==NULL ) return 0; 00645 ((int *) rpark)[0]=ne81; 00646 C2F(unsfdcopy)(&ne81,le81,&moinsun,(rpark+1),&moinsun); 00647 00648 bllst8ptr[k+1]=bllst8ptr[k]+ne81; 00649 if ((bllst8=REALLOC(bllst8,sizeof(double)*(((int *) bllst8)[0]+ne81+1))) ==NULL ) return 0; 00650 for (j=1; j< ne81+1; j++) 00651 { 00652 bllst8[((int *) bllst8)[0]+j]=rpark[j]; 00653 } 00654 ((int *) bllst8)[0]=((int *) bllst8)[0]+ne81; 00655 FREE(rpark); 00656 } 00657 else 00658 { 00659 bllst8ptr[k+1]=bllst8ptr[k]; 00660 } 00661 } 00662 else 00663 { 00664 bllst7ptr[k+1]=bllst7ptr[k]+ne7; 00665 if ((bllst7=REALLOC(bllst7,sizeof(double)*(((int *) bllst7)[0]+ne7+1))) ==NULL ) return 0; 00666 for (j=0; j< ne7; j++) 00667 { 00668 bllst7[((int *) bllst7)[0]+j+1]=le77[j]; 00669 } 00670 ((int *) bllst7)[0]=((int *) bllst7)[0]+ne7; 00671 00672 bllst8ptr[k+1]=bllst8ptr[k]+ne8; 00673 if ((bllst8=REALLOC(bllst8,sizeof(double)*(((int *) bllst8)[0]+ne8+1))) ==NULL ) return 0; 00674 for (j=0; j< ne8; j++) 00675 { 00676 bllst8[((int *) bllst8)[0]+j+1]=le88[j]; 00677 } 00678 ((int *) bllst8)[0]=((int *) bllst8)[0]+ne8; 00679 } 00680 /* 9ieme element de la list ipar*/ 00681 if ((field_name=(char*) MALLOC(sizeof(char)*5)) ==NULL ) return 0; 00682 ((char*) field_name)[4]='\0'; 00683 strcpy (field_name,"ipar"); 00684 field_num=MlistGetFieldNumber(li,field_name); 00685 FREE(field_name); 00686 le9=(int*) listentry(li,field_num); 00687 if (le9[0] == 1) 00688 { 00689 ne9=le9[1]; 00690 le99=((double *) (le9+4)); 00691 bllst9ptr[k+1]=bllst9ptr[k]+ne9; 00692 if ((bllst9=REALLOC(bllst9,sizeof(int)*(bllst9[0]+ne9+1))) ==NULL ) return 0; 00693 for (j=0; j< ne9; j++) 00694 { 00695 bllst9[bllst9[0]+j+1]=(int)le99[j]; 00696 } 00697 bllst9[0]=bllst9[0]+ne9; 00698 } 00699 else 00700 { 00701 bllst9ptr[k+1]=bllst9ptr[k]; 00702 } 00703 /* 10ieme element de la list typeblock*/ 00704 if ((field_name=(char*) MALLOC(sizeof(char)*10)) ==NULL ) return 0; 00705 ((char*) field_name)[9]='\0'; 00706 strcpy (field_name,"blocktype"); 00707 field_num=MlistGetFieldNumber(li,field_name); 00708 FREE(field_name); 00709 le10=(int*) listentry(li,field_num); 00710 le1010=((int *) (le10+6)); 00711 if ((bllst10[k]=(char*) MALLOC(sizeof(char)*2)) ==NULL ) return 0; 00712 ((char*) bllst10[k])[1]='\0'; 00713 C2F(cvstr)(&one,le1010,bllst10[k],&one,(unsigned long)strlen(bllst10[k])); 00714 /* 11ieme element de la list firing*/ 00715 if ((field_name=(char*) MALLOC(sizeof(char)*7)) ==NULL ) return 0; 00716 ((char*) field_name)[6]='\0'; 00717 strcpy (field_name,"firing"); 00718 field_num=MlistGetFieldNumber(li,field_name); 00719 FREE(field_name); 00720 le11=(int*) listentry(li,field_num); 00721 ne11=le11[2]; 00722 le1111=((double *) (le11+4)); 00723 bllst11ptr[k+1]=bllst11ptr[k]+ne11; 00724 if ((bllst11=REALLOC(bllst11,sizeof(double)*(((int *) bllst11)[0]+ne11+1))) ==NULL ) return 0; 00725 for (j=0; j< ne11; j++) 00726 { 00727 bllst11[((int *) bllst11)[0]+j+1]=le1111[j]; 00728 } 00729 ((int *) bllst11)[0]=((int *) bllst11)[0]+ne11; 00730 /* 12ieme element de la list dep_ut*/ 00731 if ((field_name=(char*) MALLOC(sizeof(char)*7)) ==NULL ) return 0; 00732 ((char*) field_name)[6]='\0'; 00733 strcpy (field_name,"dep_ut"); 00734 field_num=MlistGetFieldNumber(li,field_name); 00735 FREE(field_name); 00736 le12=(int*) listentry(li,field_num); 00737 ne12=le12[1]; 00738 me12=le12[2]; 00739 /*le1212=((double *) (le12+3));*/ 00740 bllst12[k]=le12[3]; 00741 bllst12[k+m]=le12[4]; 00742 /* 13ieme element de la list label*/ 00743 if ((field_name=(char*) MALLOC(sizeof(char)*6)) ==NULL ) return 0; 00744 ((char*) field_name)[5]='\0'; 00745 strcpy (field_name,"label"); 00746 field_num=MlistGetFieldNumber(li,field_name); 00747 FREE(field_name); 00748 le13=(int*) listentry(li,field_num); 00749 le1313=((int *) (le13+6)); 00750 00751 n1313=le13[5]-1; 00752 if ((bllst13[k]=(char*) MALLOC(sizeof(char)*(n1313+1))) ==NULL ) return 0; 00753 ((char*) bllst13[k])[n1313]='\0'; 00754 C2F(cvstr)(&n1313,le1313,bllst13[k],&one,(unsigned long)strlen(bllst13[k])); 00755 /* 14ieme element de la list nzcross*/ 00756 if ((field_name=(char*) MALLOC(sizeof(char)*8)) ==NULL ) return 0; 00757 ((char*) field_name)[7]='\0'; 00758 strcpy (field_name,"nzcross"); 00759 field_num=MlistGetFieldNumber(li,field_name); 00760 FREE(field_name); 00761 le14=(int*) listentry(li,field_num); 00762 le1414=((double *) (le14+4)); 00763 nzcross[k]=(int)le1414[0]; 00764 /* 15ieme element de la list nmode*/ 00765 if ((field_name=(char*) MALLOC(sizeof(char)*6)) ==NULL ) return 0; 00766 ((char*) field_name)[5]='\0'; 00767 strcpy (field_name,"nmode"); 00768 field_num=MlistGetFieldNumber(li,field_name); 00769 FREE(field_name); 00770 le15=(int*) listentry(li,field_num); 00771 le1515=((double *) (le15+4)); 00772 nmode[k]=(int)le1515[0]; 00773 } 00774 00775 GetRhsVar(2, "i", &m1, &n1, &l1); 00776 GetRhsVar(3, "i", &m2, &n2, &l2); 00777 if ((connectmat=MALLOC((m1*n1+1)*sizeof(int))) ==NULL ) return 0; 00778 connectmat[0]=m1*n1; 00779 for(i=0;i<n1;i++) 00780 { 00781 for(j=1;j<m1+1;j++) 00782 { 00783 connectmat[j+i*m1]=*istk(l1+j+i*m1-1); 00784 } 00785 } 00786 if ((clkconnect=MALLOC((m2*n2+1)*sizeof(int))) ==NULL ) return 0; 00787 clkconnect[0]=m2*n2; 00788 for(i=0;i<n2;i++) 00789 { 00790 for(j=1;j<m2+1;j++) 00791 { 00792 clkconnect[j+i*m2]=*istk(l2+j+i*m2-1); 00793 } 00794 } 00795 00796 if ((corinvec=MALLOC(sizeof(int))) ==NULL ) return 0; 00797 corinvec[0]=0; 00798 header1= (int*) GetData(4); 00799 m3=header1[1]; 00800 if ((corinvptr=MALLOC(sizeof(int)*(m3+2))) ==NULL ) return 0; 00801 corinvptr[0]=m3+1; 00802 corinvptr[1]=1; 00803 for (k=1; k <= m3; k++) 00804 { 00805 lii=(int*) listentry(header1,k); /*le pointeur sur la kieme vecteur*/ 00806 lc1=((double *) (lii+4)); 00807 nc1=lii[1]; 00808 mc1=lii[2]; 00809 if ((corinvec=REALLOC(corinvec,sizeof(int)*(corinvec[0]+nc1*mc1+1))) ==NULL ) return 0; 00810 for (j=0; j< nc1*mc1; j++) 00811 { 00812 corinvec[corinvec[0]+j+1]=(int)lc1[j]; 00813 } 00814 corinvec[0]=corinvec[0]+nc1*mc1; 00815 corinvptr[k+1]=corinvptr[k]+nc1*mc1; 00816 00817 } 00818 00819 GetRhsVar(5, "i", &one, &m4, &l3); 00820 solver=*istk(l3); 00821 00822 cpass2(&bllst111,&bllst112,&bllst2,&bllst3,&bllst4,&bllst5,&bllst9,&bllst10,&bllst11, 00823 &bllst12,&bllst13,&nmode,&nzcross,&bllst2ptr,&bllst3ptr,&bllst4ptr,&bllst5ptr,&bllst6ptr,&bllst9ptr,&typ_x, 00824 &bllst11ptr,&connectmat,&clkconnect,&corinvec,&corinvptr, 00825 &iz0,&tevts,&evtspt,&pointi,&outtb,&zcptr,&modptr,&outlnk,&inplnk, 00826 &lnkptr,&ordptr,&execlk,&ordclk,&cord,&oord,&zord,&critev,&nb,&ztyp, 00827 &nblk,&ndcblk,&subscr,&iord,&ok); 00828 if (!ok) 00829 { 00830 CreateVar(11,"i", &one, &zeros, &l31); 00831 CreateVar(12,"i", &one, &zeros, &l32); 00832 CreateVar(13,"i", &one, &zeros, &l33); 00833 CreateVar(14,"i", &one, &zeros, &l39); 00834 CreateVar(15,"i", &one, &zeros, &l40); 00835 LhsVar(1) = 11; 00836 LhsVar(2) = 12; 00837 LhsVar(3) = 13; 00838 LhsVar(4) = 14; 00839 LhsVar(5) = 15; 00840 return 0; 00841 } 00842 if (nb > nblk) 00843 { 00844 if ((bllst8ptr=REALLOC(bllst8ptr,sizeof(int)*(nb+2))) ==NULL ) return 0; 00845 bllst8ptr[0]=nb+1; 00846 if ((bllst7ptr=REALLOC(bllst7ptr,sizeof(int)*(nb+2))) ==NULL ) return 0; 00847 bllst7ptr[0]=nb+1; 00848 if ((bllst6ptr=REALLOC(bllst6ptr,sizeof(int)*(nb+2))) ==NULL ) return 0; 00849 bllst6ptr[0]=nb+1; 00850 for (i=nblk+1; i<nb+1; i++) 00851 { 00852 00853 bllst8ptr[i+1]=bllst8ptr[i]; 00854 bllst7ptr[i+1]=bllst7ptr[i]; 00855 bllst6ptr[i+1]=bllst6ptr[i]; 00856 } 00857 } 00858 if ((Max1(bllst112)>10000) && (solver==0)) 00859 { 00860 Message("Diagram contains implicit blocks, compiling for implicit Solver"); 00861 solver=100; 00862 } 00863 if (solver==100) 00864 { 00865 if ((bllst6=(double*)REALLOC(bllst6,sizeof(double)*(((int*) bllst6)[0]+((int*) xcd0)[0]+1))) == NULL ) return 0; 00866 ppd=(double *)&bllst6[1+((int*) bllst6)[0]]; 00867 ppd=memcpy(ppd,&xcd0[1],sizeof(double)*(((int*) xcd0)[0])); 00868 ((int*) bllst6)[0]=((int*) bllst6)[0]+((int*) xcd0)[0]; 00869 } 00870 if (xcd0) FREE(xcd0); 00871 /******************* state **************************/ 00872 00873 if ((pointiptr=MALLOC(sizeof(int))) ==NULL ) return 0; 00874 pointiptr[0]=pointi; 00875 y1 = (double*) (bllst6+1); 00876 y2 = (double*) (bllst7+1); 00877 n4=((int*) bllst6)[0]; 00878 n5=((int*) bllst7)[0]; 00879 if (!iz0) 00880 { 00881 if ((iz0=MALLOC(sizeof(int))) ==NULL ) return 0; 00882 iz0[0]=0; 00883 } 00884 y3=(int*) (iz0+1); 00885 n6=iz0[0]; 00886 y4 = (double*) (tevts+1); 00887 y5=(int*) (evtspt+1); 00888 y6=pointiptr; 00889 y7=(int*) (outtb+1); 00890 n7=(int) tevts[0]; 00891 n8= evtspt[0]; 00892 n9= outtb[0]; 00893 CreateVar(6,"t", &m31, &n31, &l31); 00894 CreateListVarFromPtr(6,1,"S", &one, &n32, Str1); 00895 CreateListVarFromPtr(6,2,"d", &n4, &one, &y1); 00896 CreateListVarFromPtr(6,3,"d", &n5, &one, &y2); 00897 CreateListVarFromPtr(6,4,"i", &n6, &one, &y3); 00898 CreateListVarFromPtr(6,5,"d", &n7, &one, &y4); 00899 CreateListVarFromPtr(6,6,"i", &n8, &one, &y5); 00900 CreateListVarFromPtr(6,7,"i", &one, &one, &y6); 00901 CreateListVarFromPtr(6,8,"i", &n9, &one, &y7); 00902 LhsVar(1) = 6; 00903 FREE(iz0); 00904 FREE(tevts); 00905 FREE(evtspt); 00906 FREE(outtb); 00907 /********************** sim *****************/ 00908 CreateVar(7,"t", &m33, &n39, &l32); 00909 CreateListVarFromPtr(7,1,"S", &one, &n40, Str2); 00910 y8=(char**) (bllst111+1); 00911 n10=(int) bllst111[0]; 00912 y9=(int*) (bllst6ptr+1); 00913 n11=bllst6ptr[0]; 00914 y10=(int*) (bllst7ptr+1); 00915 n12=bllst7ptr[0]; 00916 y11=(int*) (zcptr+1); 00917 n13=zcptr[0]; 00918 y41=(int*) (modptr+1); 00919 n43=modptr[0]; 00920 y12=(int*) (bllst2ptr+1); 00921 n14=bllst2ptr[0]; 00922 y13=(int*) (bllst3ptr+1); 00923 n15=bllst3ptr[0]; 00924 y14=(int*) (inplnk+1); 00925 n16=inplnk[0]; 00926 y15=(int*) (outlnk+1); 00927 n17=outlnk[0]; 00928 y16=(int*) (lnkptr+1); 00929 n18=lnkptr[0]; 00930 y17=(double*) (bllst8+1); 00931 n19=((int*) bllst8)[0]; 00932 y18=(int*) (bllst8ptr+1); 00933 n20=bllst8ptr[0]; 00934 y19=(int*) (bllst9+1); 00935 n21=bllst9[0]; 00936 y20=(int*) (bllst9ptr+1); 00937 n22=bllst9ptr[0]; 00938 y21=(int*) (bllst5ptr+1); 00939 n23=bllst5ptr[0]; 00940 y22=(int*) (ordptr+1); 00941 n24=ordptr[0]; 00942 y23=(int*) (execlk+1); 00943 n25=execlk[0]/2; 00944 y24=(int*) (ordclk+1); 00945 n26=ordclk[0]/2; 00946 if (!cord) 00947 { 00948 if ((cord=MALLOC(sizeof(int))) ==NULL ) return 0; 00949 cord[0]=0; 00950 } 00951 y25=(int*) (cord+1); 00952 n27=cord[0]/2; 00953 if (!oord) 00954 { 00955 if ((oord=MALLOC(sizeof(int))) ==NULL ) return 0; 00956 oord[0]=0; 00957 } 00958 y26=(int*) (oord+1); 00959 n28=oord[0]/2; 00960 if (!zord) 00961 { 00962 if ((zord=MALLOC(sizeof(int))) ==NULL ) return 0; 00963 zord[0]=0; 00964 } 00965 y27=(int*) (zord+1); 00966 n29=zord[0]/2; 00967 y28=(int*) (critev+1); 00968 n30=critev[0]; 00969 if ((nbptr=MALLOC(sizeof(int))) ==NULL ) return 0; 00970 nbptr[0]=nb; 00971 y29=nbptr; 00972 y30=(int*) (ztyp+1); 00973 n33=ztyp[0]; 00974 if ((nblkptr=MALLOC(sizeof(int))) ==NULL ) return 0; 00975 nblkptr[0]=nblk; 00976 y31=nblkptr; 00977 if ((ndcblkptr=MALLOC(sizeof(int))) ==NULL ) return 0; 00978 ndcblkptr[0]=ndcblk; 00979 y32=ndcblkptr; 00980 if (!subscr) 00981 { 00982 if ((subscr=MALLOC(sizeof(int))) ==NULL ) return 0; 00983 subscr[0]=0; 00984 } 00985 y33=(int*) (subscr+1); 00986 n34=subscr[0]/2; 00987 y34=(int*) (bllst112+1); 00988 n35=bllst112[0]; 00989 if (!iord) 00990 { 00991 if ((iord=MALLOC(sizeof(int))) ==NULL ) return 0; 00992 iord[0]=0; 00993 } 00994 y35=(int*) (iord+1); 00995 n36=iord[0]/2; 00996 y36=(char**) (bllst13+1); 00997 n37=(int) bllst13[0]; 00998 if ((vecnull=MALLOC(sizeof(int))) ==NULL ) return 0; 00999 y38=(int*) (vecnull+1); 01000 n41=0; 01001 01002 CreateListVarFromPtr(7,2,"i", &n41, &one, &y38); 01003 CreateListVarFromPtr(7,3,"i", &n11, &one, &y9); 01004 CreateListVarFromPtr(7,4,"i", &n12,&one, &y10); 01005 CreateListVarFromPtr(7,5,"i", &n13, &one, &y11); 01006 CreateListVarFromPtr(7,6,"i", &n14,&one, &y12); 01007 CreateListVarFromPtr(7,7,"i", &n15,&one, &y13); 01008 CreateListVarFromPtr(7,8,"i", &n16, &one, &y14); 01009 CreateListVarFromPtr(7,9,"i", &n17, &one, &y15); 01010 CreateListVarFromPtr(7,10,"i", &n18, &one, &y16); 01011 CreateListVarFromPtr(7,11,"d", &n19,&one, &y17); 01012 CreateListVarFromPtr(7,12,"i", &n20, &one, &y18); 01013 CreateListVarFromPtr(7,13,"i", &n21, &one, &y19); 01014 CreateListVarFromPtr(7,14,"i", &n22, &one, &y20); 01015 CreateListVarFromPtr(7,15,"i", &n23, &one, &y21); 01016 CreateListVarFromPtr(7,16,"i", &n24, &one, &y22); 01017 CreateListVarFromPtr(7,17,"i", &n25, &deux, &y23); 01018 CreateListVarFromPtr(7,18,"i", &n26, &deux, &y24); 01019 CreateListVarFromPtr(7,19,"i", &n27, &deux, &y25); 01020 CreateListVarFromPtr(7,20,"i", &n28, &deux,&y26); 01021 CreateListVarFromPtr(7,21,"i", &n29, &deux, &y27); 01022 CreateListVarFromPtr(7,22,"i", &n30, &one, &y28); 01023 CreateListVarFromPtr(7,23,"i", &one, &one, &y29); 01024 CreateListVarFromPtr(7,24,"i", &n33, &one, &y30); 01025 CreateListVarFromPtr(7,25,"i", &one, &one, &y31); 01026 CreateListVarFromPtr(7,26,"i", &one, &one, &y32); 01027 CreateListVarFromPtr(7,27,"i", &n34, &one, &y33); 01028 CreateListVarFromPtr(7,28,"i", &n35,&one, &y34); 01029 CreateListVarFromPtr(7,29,"i", &n36, &deux, &y35); 01030 CreateListVarFromPtr(7,30,"S", &n37, &one, y36); 01031 CreateListVarFromPtr(7,31,"i", &n43, &one, &y41); 01032 LhsVar(2) = 7; 01033 01034 FREE(zcptr); 01035 FREE(modptr); 01036 FREE(inplnk); 01037 FREE(outlnk); 01038 FREE(lnkptr); 01039 FREE(ordptr); 01040 FREE(execlk); 01041 FREE(ordclk); 01042 FREE(cord); 01043 FREE(oord); 01044 FREE(zord); 01045 FREE(critev); 01046 FREE(ztyp); 01047 FREE(subscr); 01048 FREE(iord); 01049 FREE(bllst112); 01050 FREE(bllst2); 01051 FREE(bllst2ptr); 01052 FREE(bllst3); 01053 FREE(bllst3ptr); 01054 FREE(bllst4); 01055 FREE(bllst4ptr); 01056 FREE(bllst5); 01057 FREE(bllst5ptr); 01058 FREE(bllst6); 01059 FREE(bllst6ptr); 01060 FREE(bllst7); 01061 FREE(bllst7ptr); 01062 FREE(bllst8); 01063 FREE(bllst8ptr); 01064 FREE(bllst9); 01065 FREE(bllst9ptr); 01066 for(i = 1; i < ((int*) bllst10)[0]+1; i++) 01067 FREE(bllst10[i]); 01068 FREE(bllst10); 01069 FREE(bllst11); 01070 FREE(bllst11ptr); 01071 FREE(bllst12); 01072 for(i = 1; i < ((int*) bllst13)[0]+1; i++) 01073 FREE(bllst13[i]); 01074 FREE(bllst13); 01075 FREE(nzcross); 01076 FREE(nmode); 01077 if(ndcblkptr) FREE(ndcblkptr); 01078 if (pointiptr) FREE(pointiptr); 01079 if (nbptr) FREE(nbptr); 01080 if (nblkptr) FREE(nblkptr); 01081 FREE(connectmat); 01082 FREE(vecnull); 01083 01084 CreateVar(8,"l", &n10, &one, &l33); 01085 for (i=0; i < n10; i++) 01086 { 01087 n38=(int)strlen(y8[i]); 01088 y37=*(y8+i); 01089 CreateListVarFromPtr(8,i+1,"c", &n38, &one, &y37); 01090 } 01091 LhsVar(3) = 8; 01092 for (i = 1; i <= nb; i++) 01093 FREE(bllst111[i]); 01094 FREE(bllst111); 01095 01096 if ((solverptr=MALLOC(sizeof(int))) ==NULL ) return 0; 01097 solverptr[0]=solver; 01098 y39=solverptr; 01099 CreateVarFromPtr(9, "i", &one, &one, &y39); 01100 LhsVar(4) = 9; 01101 FREE(solverptr); 01102 01103 CreateVar(10,"l", &nb, &one, &l40); 01104 for (i=1; i < nb+1; i++) 01105 { 01106 y40=(int*) (corinvec+corinvptr[i]); 01107 n42=corinvptr[i+1]-corinvptr[i]; 01108 CreateListVarFromPtr(10,i,"i", &one, &n42, &y40); 01109 } 01110 LhsVar(5) = 10; 01111 FREE(corinvec); 01112 FREE(corinvptr); 01113 return 0; 01114 }
Here is the call graph for this function:

Definition at line 3217 of file intcscicos.c.
References C2F, CheckLhs, CreateVar, curblk, I_INT32, istk, j, and LhsVar.
03220 { 03221 /*********************** 03222 * variables declaration 03223 ***********************/ 03224 /* address of the data of the output parameter */ 03225 int l1; 03226 /* local counter variable */ 03227 int j,k; 03228 /* definition of min/max output argument */ 03229 static int minlhs=1, maxlhs=1; 03230 03231 /************************** 03232 * Check number of outputs 03233 **************************/ 03234 CheckLhs(minlhs,maxlhs); 03235 03236 /************************ 03237 * Create int32 variable 03238 ************************/ 03239 /* define type of integer */ 03240 l1 = I_INT32; 03241 /* Create int32 variable at the top addr. of the stack */ 03242 CreateVar(1,"I",(j=1,&j),(k=1,&k),&l1); 03243 /* Store value of C2F(curblk).kfun at the l1 address in istk */ 03244 *istk(l1) = C2F(curblk).kfun; 03245 03246 /* return the value stored at Top address to lhs variable */ 03247 LhsVar(1) = 1; 03248 03249 /* return 0 as default value */ 03250 return 0; 03251 }
Definition at line 118 of file intcscicos.c.
References CheckLhs, CheckRhs, CreateVar, GetData(), LhsVar, Lstk, Rhs, stk, and Top.
00122 { 00123 int un,l3,k; 00124 int size1;int size2; 00125 int *header1;int *header2; 00126 CheckRhs(2,2); 00127 CheckLhs(1,1); 00128 header1 = GetData(1); 00129 header2 = GetData(2); 00130 CreateVar(3,"d",(un=1,&un),(un=1,&un),&l3); 00131 LhsVar(1) = 3; 00132 size1=2*(*Lstk(Top-Rhs+2)-*Lstk(Top-Rhs+1)); 00133 size2=2*(*Lstk(Top-Rhs+3)-*Lstk(Top-Rhs+2)); 00134 00135 if (size1 != size2) { 00136 *stk(l3)=1; 00137 return 0; 00138 } 00139 for (k=0; k<size1; k++) { 00140 if (header1[k] != header2[k]) { 00141 *stk(l3)=1; 00142 return 0; 00143 } 00144 *stk(l3)=0; 00145 00146 } 00147 return 0; 00148 }
Here is the call graph for this function:

Definition at line 82 of file intcscicos.c.
References CheckLhs, CheckRhs, comp_size(), CreateVar, duplicata(), GetRhsVar, LhsVar, m1, m2, n, n1, n2, and stk.
00092 { 00093 int m1,m2,m3,n1,n2,n3,l1,l2,l3,n; 00094 CheckRhs(2,2); 00095 CheckLhs(1,1); 00096 GetRhsVar(1,"d",&m1,&n1,&l1); 00097 GetRhsVar(2,"d",&m2,&n2,&l2); 00098 n=m1*n1; 00099 if (n==0) { 00100 m3=0; 00101 CreateVar(3, "d", &m3, &m3, &l3); 00102 LhsVar(1) = 3; 00103 return 0; 00104 } 00105 if (n!=m2*n2) 00106 { 00107 Scierror(999,"%s: 1st and 2nd argument must have equal size \r\n",fname); 00108 return 0; 00109 } 00110 comp_size(stk(l2),&n3,n); 00111 m3=1; 00112 CreateVar(3, "d", &n3, &m3, &l3); 00113 duplicata(&n,stk(l1),stk(l2),stk(l3),&n3); 00114 LhsVar(1) = 3; 00115 return 0; 00116 }
Here is the call graph for this function:

Definition at line 2739 of file intcscicos.c.
References buf, C2F, CheckRhs, CopyVarFromlistentry(), createblklist(), CreateVar, cvstr(), FALSE_, FREE, g, GetData(), getscicosvarsfromimport(), i, I_INT32, ierr, il_sim_save, il_state_save, istk, j, LhsVar, m1, MALLOC, mklist(), mktlist(), n1, nblk, ng, NULL, nv, outtb_el::pos, Rhs, sciprint(), stk, str2sci(), Top, TRUE_, x, xd, xptr, and zcptr.
02742 { 02743 /************************************ 02744 * variables and constants définition 02745 ************************************/ 02746 /* auxilary variables for dimension and address */ 02747 int m1,n1; /* dimension of input character string */ 02748 int *il_str; /* address of the description of the input parameter */ 02749 int *l_str; /* address of the data of the input parameter */ 02750 int l_tmp; /* temp variables to store address */ 02751 int *il_tmp; 02752 02753 /* definition of min/max input/output argument */ 02754 static int minrhs=0, maxrhs=1; 02755 02756 /* auxilary variables */ 02757 int nv,mv; /* length of data */ 02758 void *ptr; /* ptr for data comming from import structure */ 02759 int *ptr_int; /* ptr to store ptr on integer */ 02760 double *ptr_dd; /* ptr to store ptr on double */ 02761 scicos_block *ptr_scsblk; /* ptr to store ptr of scicos_block structure */ 02762 outtb_el *ptr_elem; /* ptr to store ptr of outtb_el structure */ 02763 int nblk,ng; /* to store number of blocks and number of zero cross. */ 02764 int *xptr, *zcptr; /* to store xptr and zcptr of scicos_blocks */ 02765 double *x,*xd,*g; /* ptr for x, xd and g for scicos_blocks */ 02766 02767 int ierr; /* error flag */ 02768 int errc; /* error flag for ceateblklst */ 02769 int ptr_pos; /* to store position in scilab string object */ 02770 int Topsave; /* to save the Top position */ 02771 02772 int sz_str; /* local variabe to store size of string */ 02773 int i,j,k; /* local counter variable */ 02774 02775 /* number of entries -please update me- */ 02776 static int nentries=60; 02777 /* define accepted entries of getscicosvars -please update me- */ 02778 static char *entry[]={ "x" , "nx" , "xptr" , "zcptr" , "z" , 02779 "nz" , "zptr" , "rpar" , "rpptr" , "ipar" , 02780 "ipptr" , "outtb" , "inpptr" , "outptr" , "inplnk" , 02781 "outlnk" , "subs" , "tevts" , "evtspt" , "pointi" , 02782 "iord" , "oord" , "zord" , "funtyp" , "ztyp" , 02783 "cord" , "ordclk" , "clkptr" , "ordptr" , "critev" , 02784 "mod" , "nmod" , "iz" , "nblk" , "izptr" , 02785 "outtbptr" , "outtbsz" , "outtbtyp" , "nlnk" , "nsubs" , 02786 "nevts" , "niord" , "noord" , "nzord" , "funptr" , 02787 "ncord" , "nordptr" , "iwa" , "blocks" , "ng" , 02788 "g" , "t0" , "tf" , "Atol" , "rtol" , 02789 "ttol" , "deltat" , "hmax" , "nelem" , "outtb_elem"}; 02790 02791 char **dyn_char; /* for allocation of first entry in tlist */ 02792 02793 /**************************************** 02794 * Check number of inputs and outputs Rhs 02795 ****************************************/ 02796 CheckRhs(minrhs,maxrhs); 02797 02798 /* Display usage of getscicosvars function if Rhs==0 */ 02799 if (Rhs==0) 02800 { 02801 sciprint("\ngetscicosvars : utility function to retrieve\n" 02802 " scicos arrays during simulation.\n\n" 02803 "Usage : [myvar]=getscicosvars([\"str1\";\"str2\";...]);\n\n" 02804 "- myvar : an int32 or double matrix or a Tlist.\n" 02805 "- [\"str1\";\"str2\",...] is a string matrix\n" 02806 " that must be informed with the following values :\n"); 02807 02808 /* display allowed entries */ 02809 i=0; 02810 for (j=0;j<nentries;j++) 02811 { 02812 if (j==nentries-1) sciprint("\"%s\" ",entry[j]); 02813 else sciprint("\"%s\", ",entry[j]); 02814 i++; 02815 if (i==6) {sciprint("\n");i=0;} 02816 } 02817 sciprint("\n"); 02818 return 0; 02819 } 02820 02821 /******************* 02822 * Check str (rhs 1) 02823 *******************/ 02824 il_str = (int *) GetData(1); /* get ptr of integer header of rsh 1 */ 02825 if(il_str[0]!=10) /* Check if input argument is a character string matrix */ 02826 { 02827 Scierror(55,"%s : First argument must be a string.\n",fname); 02828 C2F(iop).err=1; 02829 return 0; 02830 } 02831 02832 /*retrieve dimension of input string matrix*/ 02833 m1 = il_str[1]; /* number of row */ 02834 n1 = il_str[2]; /* number of column */ 02835 02836 /*Create header of Tlist*/ 02837 if ((dyn_char=MALLOC((1+m1*n1)*sizeof(char *)))==NULL) 02838 { 02839 Scierror(999,"%s : No more memory.\n",fname); 02840 return 0; 02841 } 02842 02843 /* Type of list is scicosvar */ 02844 if ((dyn_char[0]=MALLOC((strlen("scicosvar")+1)*sizeof(char)))==NULL) 02845 { 02846 FREE(dyn_char); 02847 Scierror(999,"%s : No more memory.\n",fname); 02848 return 0; 02849 } 02850 else strcpy(dyn_char[0],"scicosvar"); 02851 02852 /*Check string matrix */ 02853 for (j=0;j<m1*n1;j++) 02854 { 02855 sz_str = il_str[5+j]-il_str[4+j]; /* store the length of str */ 02856 /*get current position in the istk*/ 02857 if (j==0) 02858 ptr_pos=5+m1*n1; 02859 else 02860 ptr_pos += il_str[5+j-1]-il_str[4+j-1]; 02861 l_str = &il_str[ptr_pos]; /* get ptr of rsh 1 */ 02862 /* codetoascii convertion */ 02863 C2F(cha1).buf[0]=' '; 02864 C2F(cvstr)(&sz_str,&l_str[0],&C2F(cha1).buf[0],(i=1,&i),sz_str); 02865 C2F(cha1).buf[sz_str]='\0'; 02866 /* search if string is in accordance with entry*/ 02867 ierr=TRUE_; 02868 for (i=0;i<nentries;i++) 02869 { 02870 if (strcmp(C2F(cha1).buf,entry[i]) == 0) 02871 { 02872 /* Store string in header of Tlist */ 02873 if ((dyn_char[j+1]=MALLOC(sizeof(char)*strlen(entry[i])+1))==NULL) 02874 { 02875 FREE(dyn_char); 02876 Scierror(999,"%s : No more memory.\n",fname); 02877 return 0; 02878 } 02879 else strcpy(dyn_char[j+1],entry[i]); 02880 02881 ierr=FALSE_; 02882 break; 02883 } 02884 } 02885 /* if failed then display an error message and exit*/ 02886 if (ierr==TRUE_) 02887 { 02888 FREE(dyn_char); 02889 Scierror(999,"%s : Undefined field in string matrix position : %d.\n",fname,j+1); 02890 return 0; 02891 } 02892 } 02893 02894 /* store dyn_char on stack*/ 02895 if (n1*m1>1) str2sci(dyn_char,1,n1*m1+1); 02896 02897 /* return asked array */ 02898 for (j=0;j<m1*n1;j++) 02899 { 02900 sz_str = il_str[5+j]-il_str[4+j]; /* store the length of str */ 02901 /*get current position in the istk of the string*/ 02902 if (j==0) 02903 ptr_pos=5+m1*n1; 02904 else 02905 ptr_pos += il_str[5+j-1]-il_str[4+j-1]; 02906 l_str = &il_str[ptr_pos]; /* get ptr of rsh 1 */ 02907 /* codetoascii convertion */ 02908 C2F(cha1).buf[0]=' '; 02909 C2F(cvstr)(&sz_str,&l_str[0],&C2F(cha1).buf[0],(i=1,&i),sz_str); 02910 C2F(cha1).buf[sz_str]='\0'; 02911 02912 /***************************************************************************** 02913 * entries that can be retrieve by il_state_save, il_sim_save global variable 02914 *****************************************************************************/ 02915 if (strcmp(C2F(cha1).buf,"x") == 0) /* retrieve continuous state */ 02916 ierr=CopyVarFromlistentry(j+2,il_state_save,2); 02917 else if (strcmp(C2F(cha1).buf,"xptr") == 0) /* retrieve ptr of continuous state */ 02918 ierr=CopyVarFromlistentry(j+2,il_sim_save,3); 02919 else if (strcmp(C2F(cha1).buf,"zcptr") == 0) /* retrieve ptr of zero crossing array */ 02920 ierr=CopyVarFromlistentry(j+2,il_sim_save,5); 02921 else if (strcmp(C2F(cha1).buf,"z") == 0) /* retrieve discrete state */ 02922 ierr=CopyVarFromlistentry(j+2,il_state_save,3); 02923 else if (strcmp(C2F(cha1).buf,"zptr") == 0) /* retrieve ptr of discrete state */ 02924 ierr=CopyVarFromlistentry(j+2,il_sim_save,4); 02925 else if (strcmp(C2F(cha1).buf,"rpar") == 0) /* retrieve rpar */ 02926 ierr=CopyVarFromlistentry(j+2,il_sim_save,10); 02927 else if (strcmp(C2F(cha1).buf,"rpptr") == 0) /* retrieve ptr of rpar */ 02928 ierr=CopyVarFromlistentry(j+2,il_sim_save,11); 02929 else if (strcmp(C2F(cha1).buf,"ipar") == 0) /* retrieve ipar */ 02930 ierr=CopyVarFromlistentry(j+2,il_sim_save,12); 02931 else if (strcmp(C2F(cha1).buf,"ipptr") == 0) /* retrieve ptr of ipar */ 02932 ierr=CopyVarFromlistentry(j+2,il_sim_save,13); 02933 else if (strcmp(C2F(cha1).buf,"outtb") == 0) /* retrieve outtb */ 02934 ierr=CopyVarFromlistentry(j+2,il_state_save,8); 02935 else if (strcmp(C2F(cha1).buf,"inpptr") == 0) /* retrieve number of input ports */ 02936 ierr=CopyVarFromlistentry(j+2,il_sim_save,6); 02937 else if (strcmp(C2F(cha1).buf,"outptr") == 0) /* retrieve number of output ports */ 02938 ierr=CopyVarFromlistentry(j+2,il_sim_save,7); 02939 else if (strcmp(C2F(cha1).buf,"inplnk") == 0) /* retrieve link number of input ports */ 02940 ierr=CopyVarFromlistentry(j+2,il_sim_save,8); 02941 else if (strcmp(C2F(cha1).buf,"outlnk") == 0) /* retrieve link number of output ports */ 02942 ierr=CopyVarFromlistentry(j+2,il_sim_save,9); 02943 else if (strcmp(C2F(cha1).buf,"subs") == 0) /* retrieve subscr */ 02944 ierr=CopyVarFromlistentry(j+2,il_sim_save,26); 02945 else if (strcmp(C2F(cha1).buf,"tevts") == 0) /* retrieve tevts */ 02946 ierr=CopyVarFromlistentry(j+2,il_state_save,5); 02947 else if (strcmp(C2F(cha1).buf,"evtspt") == 0) /* retrieve evtspt */ 02948 ierr=CopyVarFromlistentry(j+2,il_state_save,6); 02949 else if (strcmp(C2F(cha1).buf,"pointi") == 0) /* retrieve pointi */ 02950 ierr=CopyVarFromlistentry(j+2,il_state_save,7); 02951 else if (strcmp(C2F(cha1).buf,"iord") == 0) /* retrieve iord */ 02952 ierr=CopyVarFromlistentry(j+2,il_sim_save,28); 02953 else if (strcmp(C2F(cha1).buf,"oord") == 0) /* retrieve oord */ 02954 ierr=CopyVarFromlistentry(j+2,il_sim_save,19); 02955 else if (strcmp(C2F(cha1).buf,"zord") == 0) /* retrieve zord */ 02956 ierr=CopyVarFromlistentry(j+2,il_sim_save,20); 02957 else if (strcmp(C2F(cha1).buf,"funtyp") == 0) /* retrieve funtyp */ 02958 ierr=CopyVarFromlistentry(j+2,il_sim_save,27); 02959 else if (strcmp(C2F(cha1).buf,"ztyp") == 0) /* retrieve ztyp */ 02960 ierr=CopyVarFromlistentry(j+2,il_sim_save,23); 02961 else if (strcmp(C2F(cha1).buf,"cord") == 0) /* retrieve cord */ 02962 ierr=CopyVarFromlistentry(j+2,il_sim_save,18); 02963 else if (strcmp(C2F(cha1).buf,"ordclk") == 0) /* retrieve ordclk */ 02964 ierr=CopyVarFromlistentry(j+2,il_sim_save,17); 02965 else if (strcmp(C2F(cha1).buf,"clkptr") == 0) /* retrieve clkptr */ 02966 ierr=CopyVarFromlistentry(j+2,il_sim_save,14); 02967 else if (strcmp(C2F(cha1).buf,"ordptr") == 0) /* retrieve ordptr */ 02968 ierr=CopyVarFromlistentry(j+2,il_sim_save,15); 02969 else if (strcmp(C2F(cha1).buf,"critev") == 0) /* retrieve critev */ 02970 ierr=CopyVarFromlistentry(j+2,il_sim_save,21); 02971 02972 /************************************************* 02973 * integer variables coming from import structure 02974 *************************************************/ 02975 else if ((strcmp(C2F(cha1).buf,"mod") == 0) || /* retrieve mode */ 02976 (strcmp(C2F(cha1).buf,"nmod") == 0) || /* retrieve nmode */ 02977 (strcmp(C2F(cha1).buf,"iz") == 0) || /* label integer code of blocks */ 02978 (strcmp(C2F(cha1).buf,"nblk") == 0) || /* number of block */ 02979 (strcmp(C2F(cha1).buf,"izptr") == 0) || /* label integer code of blocks ptr*/ 02980 (strcmp(C2F(cha1).buf,"outtbptr") == 0) || /* outtb ptr */ 02981 (strcmp(C2F(cha1).buf,"outtbsz") == 0) || /* outtb size */ 02982 (strcmp(C2F(cha1).buf,"outtbtyp") == 0) || /* outtb type */ 02983 (strcmp(C2F(cha1).buf,"nlnk") == 0) || /* number of link */ 02984 (strcmp(C2F(cha1).buf,"nsubs") == 0) || /* length of nsubs */ 02985 (strcmp(C2F(cha1).buf,"nevts") == 0) || /* length of evtspt & tevts */ 02986 (strcmp(C2F(cha1).buf,"niord") == 0) || /* length of iord */ 02987 (strcmp(C2F(cha1).buf,"noord") == 0) || /* length of oord */ 02988 (strcmp(C2F(cha1).buf,"nzord") == 0) || /* length of zord */ 02989 (strcmp(C2F(cha1).buf,"funptr") == 0) || /* retrieve function ptr */ 02990 (strcmp(C2F(cha1).buf,"ncord") == 0) || /* retrieve ncord */ 02991 (strcmp(C2F(cha1).buf,"nordptr") == 0) || /* retrieve nordptr */ 02992 (strcmp(C2F(cha1).buf,"iwa") == 0) || /* retrieve iwa */ 02993 (strcmp(C2F(cha1).buf,"ng") == 0) || /* retrieve ng */ 02994 (strcmp(C2F(cha1).buf,"nx") == 0) || /* retrieve nx */ 02995 (strcmp(C2F(cha1).buf,"nz") == 0) || /* retrieve nz */ 02996 (strcmp(C2F(cha1).buf,"nelem") == 0) /* retrieve nelem */ 02997 ) 02998 { 02999 /* retrieve dims and prt of asked array with getscicosvarsfromimport */ 03000 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03001 03002 /* check ierr flag */ 03003 if (ierr==TRUE_) 03004 { 03005 l_tmp = I_INT32; /* define type of integer */ 03006 CreateVar(j+2,"I",&nv,&mv,&l_tmp); /* Create int32 variable at the top+j+1 addr. of the stack */ 03007 il_tmp = (int *) istk(l_tmp); /* Store value of address of istk(l_tmp) in il_tmp */ 03008 ptr_int = (int *) ptr; /* cast void* ptr to int* ptr */ 03009 for (i=0;i<nv*mv;i++) il_tmp[i] = ptr_int[i]; /* copy returned array in istk */ 03010 } 03011 } 03012 03013 /************************************************* 03014 * double variables coming from import structure 03015 *************************************************/ 03016 else if ((strcmp(C2F(cha1).buf,"g") == 0) || /* retrieve g */ 03017 (strcmp(C2F(cha1).buf,"t0") == 0) || /* retrieve t0 */ 03018 (strcmp(C2F(cha1).buf,"tf") == 0) || /* retrieve tf */ 03019 (strcmp(C2F(cha1).buf,"Atol") == 0) || /* retrieve Atol */ 03020 (strcmp(C2F(cha1).buf,"rtol") == 0) || /* retrieve rtol */ 03021 (strcmp(C2F(cha1).buf,"ttol") == 0) || /* retrieve ttol */ 03022 (strcmp(C2F(cha1).buf,"deltat") == 0) || /* retrieve deltat */ 03023 (strcmp(C2F(cha1).buf,"hmax") == 0) /* retrieve hmax */ 03024 ) 03025 { 03026 /* retrieve dims and prt of asked array with getscicosvarsfromimport */ 03027 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03028 03029 /* check ierr flag */ 03030 if (ierr==TRUE_) 03031 { 03032 ptr_dd = (double *) ptr; 03033 CreateVar(j+2,"d",&nv,&mv,&l_tmp); /* Create double variable at the top+j+1 addr. of the stack */ 03034 for (i=0;i<nv*mv;i++) *stk(l_tmp+i) = ptr_dd[i]; /* copy returned array in istk */ 03035 } 03036 } 03037 03038 /************************************************* 03039 * scicos_block ptr coming from import structure 03040 *************************************************/ 03041 else if ((strcmp(C2F(cha1).buf,"blocks") == 0) 03042 ) 03043 { 03044 /* retrieve scicos_block prt of asked array with getscicosvarsfromimport */ 03045 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03046 03047 /* check ierr flag */ 03048 if (ierr==TRUE_) 03049 { 03050 /* store ptr in ptrscs_blk */ 03051 ptr_scsblk = (scicos_block *) ptr; 03052 03053 /* retrieve nblk by import structure */ 03054 strcpy(C2F(cha1).buf,"nblk"); 03055 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03056 ptr_int = (int *) ptr; /* cast void* ptr to int* ptr */ 03057 nblk = *ptr_int; 03058 03059 /* retrieve ng by import structure */ 03060 strcpy(C2F(cha1).buf,"ng"); 03061 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03062 ptr_int = (int *) ptr; /* cast void* ptr to int* ptr */ 03063 ng = *ptr_int; 03064 03065 /*retrieve xptr by import structure*/ 03066 strcpy(C2F(cha1).buf,"xptr"); 03067 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03068 ptr_int = (int *) ptr; 03069 xptr = ptr_int; 03070 03071 /*retrieve zcptr by import structure*/ 03072 strcpy(C2F(cha1).buf,"zcptr"); 03073 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03074 ptr_int = (int *) ptr; 03075 zcptr = ptr_int; 03076 03077 /*retrieve x and xd by import structure*/ 03078 strcpy(C2F(cha1).buf,"x"); 03079 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03080 ptr_dd = (double *) ptr; 03081 x = ptr_dd; 03082 xd = &x[xptr[nblk]-1]; 03083 03084 /*retrieve g by import structure*/ 03085 strcpy(C2F(cha1).buf,"g"); 03086 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03087 ptr_dd = (double *) ptr; 03088 g = ptr_dd; 03089 03090 /* store blklst on stack */ 03091 Topsave=Top; /* save Top counter */ 03092 Top=Top-Rhs+1+j; /* adjust Top counter */ 03093 03094 for (k=0;k<nblk;k++) 03095 {/* for each block, call createblklist */ 03096 03097 /* set flag_imp <0 for createblklst */ 03098 i=-1; 03099 03100 /* the following test is done in order to know if block k 03101 * have been already called with callf in scicos.c 03102 */ 03103 if (ptr_scsblk[k].nx!=0) 03104 { 03105 if (ptr_scsblk[k].x!=&x[xptr[k]-1]) 03106 { 03107 /*fprintf(stderr,"k=%d,X,xd Non initialisé\n",k);*/ 03108 /* set flag_imp=k for createblklst <0 */ 03109 i=k; 03110 } 03111 } 03112 if (ptr_scsblk[k].ng!=0) 03113 { 03114 if ((ptr_scsblk[k].g!=&g[zcptr[k]-1]) && (ptr_scsblk[k].g!=&x[xptr[k]-1])) 03115 { 03116 /*fprintf(stderr,"k=%d,g Non initialisé\n",k);*/ 03117 /* set flag_imp=k for createblklst <0 */ 03118 i=k; 03119 } 03120 } 03121 /* call createblklist */ 03122 ierr=createblklist(&ptr_scsblk[k], &errc,i); 03123 03124 /* if an error occurs in createblklist */ 03125 if (ierr==FALSE_) 03126 { 03127 Top=Topsave; 03128 break; 03129 } 03130 } 03131 /* if success, create a list of Typed list scicos_block */ 03132 if (ierr==TRUE_) 03133 { 03134 C2F(mklist)(&nblk); 03135 Top=Topsave; /* adjust Top counter */ 03136 CreateVar(j+2,"l",&nblk,(i=1,&i),&l_tmp); /* this is done to inform common intersci */ 03137 } 03138 03139 } 03140 } 03141 03142 /******************************************* 03143 * outtb_elem coming from import structure 03144 *******************************************/ 03145 else if ((strcmp(C2F(cha1).buf,"outtb_elem") == 0)) /* retrieve outtb_eleme */ 03146 { 03147 /* retrieve dims and prt of asked array with getscicosvarsfromimport */ 03148 ierr=getscicosvarsfromimport(C2F(cha1).buf,&ptr,&nv,&mv); 03149 03150 /* check ierr flag */ 03151 if (ierr==TRUE_) 03152 { 03153 l_tmp = I_INT32; /* define type of integer */ 03154 CreateVar(j+2,"I",&nv,&mv,&l_tmp); /* Create int32 variable at the top+j+1 addr. of the stack */ 03155 il_tmp = (int *) istk(l_tmp); /* Store value of address of istk(l_tmp) in il_tmp */ 03156 ptr_elem = (outtb_el *) ptr; /* cast void* ptr to int* ptr */ 03157 for (i=0;i<nv;i++) /* copy returned array in istk */ 03158 { 03159 il_tmp[i] = ptr_elem[i].lnk + 1; /* +1 is for the connection with outtb list */ 03160 il_tmp[nv+i] = ptr_elem[i].pos + 1; 03161 } 03162 } 03163 } 03164 03165 /* if input argument doesn't match with any accepted string 03166 * then display an error message. 03167 */ 03168 else 03169 { 03170 Scierror(999,"%s : Undefined field.\n",fname); 03171 FREE(dyn_char); 03172 return 0; 03173 } 03174 03175 /* if return a FALSE_ value in 03176 * error flag then display an error message. 03177 */ 03178 if(ierr!=TRUE_) 03179 { 03180 Scierror(999,"%s : Error.\n",fname); 03181 FREE(dyn_char); 03182 return 0; 03183 } 03184 } 03185 /********************** 03186 * Create lsh argument 03187 **********************/ 03188 /* create a tlist if number of string in rhs 1 is >1*/ 03189 if (j>1) 03190 { 03191 Top=Top+j; 03192 j++; 03193 C2F(mktlist)(&j); 03194 Top=Top-1; 03195 CreateVar(2,"t",&j,(i=1,&i),&l_tmp); /* this is done to inform common intersci */ 03196 } 03197 03198 /* put new variable in lsh argument */ 03199 LhsVar(1)=2; 03200 03201 /* end */ 03202 FREE(dyn_char); 03203 return 0; 03204 }
Here is the call graph for this function:

Definition at line 263 of file intcscicos.c.
References CheckLhs, CheckRhs, CreateVar, get_phase_simulation(), istk, and LhsVar.
00267 { 00268 int un,l1; 00269 CheckRhs(-1,0); 00270 CheckLhs(1,1); 00271 CreateVar(1,"i",(un=1,&un),(un=1,&un),&l1); 00272 *istk(l1)=get_phase_simulation(); 00273 LhsVar(1)=1; 00274 return 0; 00275 }
Here is the call graph for this function:

Definition at line 1187 of file intcscicos.c.
References __PARAMS, buf, C2F, CheckDims, CheckLhs, CheckRhs, CheckScalar, curblk, cvstr(), ddt, err, err1, fin, FREE, fun, funnum(), funs(), GetData(), i, iadr, ierr, ifun, il_sim_save, il_state_save, int, istk, inter_s_::itflag, iwhere, inter_s_::iwhere, j, kfun, lad, inter_s_::lad, inter_s_::ladc, Lhs, LhsVar, lhsvar, inter_s_::lhsvar, listentry(), Lstk, m1, m2, MALLOC, n2, inter_s_::nbcols, nblk, inter_s_::nbrows, Nbvars, inter_l::nbvars, nelem, nlnk, nsiz, ntypes, inter_s_::ntypes, NULL, outtb_elem, outtbptr, outtbsz, outtbtyp, outtb_el::pos, REALLOC, Rhs, sadr, scicos(), inter_l::state, and Top.
01190 { 01191 /********************************************* 01192 * external structure and function declaration 01193 *********************************************/ 01194 /*declaration of funnum (in scicos.c)*/ 01195 extern int C2F(funnum) __PARAMS((char *fname)); 01196 01197 /************************************ 01198 * variables and constants définition 01199 ************************************/ 01200 static int id[nsiz]; 01201 01202 /*declaration of static structure*/ 01203 static struct {integer idb;} C2F(dbcos); /*declaration of dbcos*/ 01204 01205 typedef struct inter_s_ 01206 { 01207 int iwhere,nbrows,nbcols,itflag,ntypes,lad,ladc,lhsvar; 01208 } intersci_state ; 01209 01210 typedef struct inter_l 01211 { 01212 intersci_state *state ; 01213 int nbvars; 01214 } intersci_list ; 01215 intersci_list *loc; 01216 intersci_state *new ; 01217 01218 /* declaration of outtb_elem */ 01219 outtb_el *outtb_elem=NULL; 01220 static int nelem; 01221 01222 /*auxilary variables for dimension and address*/ 01223 static int m1; /*state*/ 01224 static int *il_state; 01225 static int m1e2,n1e2; /*state.x*/ 01226 static int *il_state_x; 01227 static double *l_state_x; 01228 static int m1e3,n1e3; /*state.z*/ 01229 static int *il_state_z; 01230 static double *l_state_z; 01231 static int m1e4,n1e4; /*state.iz*/ 01232 static int *il_state_iz; 01233 static double *l_state_iz; 01234 static int m1e5,n1e5; /*state.tevts*/ 01235 static int *il_state_tevts; 01236 static double *l_state_tevts; 01237 static int m1e6,n1e6; /*state.evtspt*/ 01238 static int *il_state_evtspt; 01239 static int *l_state_evtspt; 01240 static int m1e7,n1e7; /*state.pointi*/ 01241 static int *il_pointi; 01242 static int *l_pointi; 01243 static int *il_state_outtb; /*state.outtb*/ 01244 static int nlnk; 01245 static void **outtbptr; 01246 static int *outtbsz; 01247 static int *outtbtyp; 01248 01249 static int m2,n2; /*tcur*/ 01250 static int *il_tcur; 01251 static double *l_tcur; 01252 01253 static int m3,n3; /*tf*/ 01254 static int *il_tf; 01255 static double *l_tf; 01256 01257 static int m4,n4,l4,il4; /*sim*/ 01258 static int *il_sim; 01259 static int l4e2,il4e2; /*sim.funs*/ 01260 static int *il_sim_fun; 01261 static int nblk; 01262 static int m4e3,n4e3; /*sim.xptr*/ 01263 static int *il_sim_xptr; 01264 static int *l_sim_xptr; 01265 static int m4e4,n4e4; /*sim.zptr*/ 01266 static int *il_sim_zptr; 01267 static int *l_sim_zptr; 01268 static int m4e5,n4e5; /*sim.zcptr*/ 01269 static int *il_sim_zcptr; 01270 static int *l_sim_zcptr; 01271 static int m4e6,n4e6; /*sim.inpptr*/ 01272 static int *il_sim_inpptr; 01273 static int *l_sim_inpptr; 01274 static int m4e7,n4e7; /*sim.outptr*/ 01275 static int *il_sim_outptr; 01276 static int *l_sim_outptr; 01277 static int m4e8,n4e8; /*sim.inplnk*/ 01278 static int *il_sim_inplnk; 01279 static int *l_sim_inplnk; 01280 static int m4e9,n4e9; /*sim.outlnk*/ 01281 static int *il_sim_outlnk; 01282 static int *l_sim_outlnk; 01283 static int m4e10,n4e10; /*sim.rpar*/ 01284 static int *il_sim_rpar; 01285 static double *l_sim_rpar; 01286 static int m4e11,n4e11; /*sim.rpptr*/ 01287 static int *il_sim_rpptr; 01288 static int *l_sim_rpptr; 01289 static int m4e12,n4e12; /*sim.ipar*/ 01290 static int *il_sim_ipar; 01291 static int *l_sim_ipar; 01292 static int m4e13,n4e13; /*sim.ipptr*/ 01293 static int *il_sim_ipptr; 01294 static int *l_sim_ipptr; 01295 static int m4e14,n4e14; /*sim.clkptr*/ 01296 static int *il_sim_clkptr; 01297 static int *l_sim_clkptr; 01298 static int m4e15,n4e15; /*sim.ordptr*/ 01299 static int *il_sim_ordptr; 01300 static int *l_sim_ordptr; 01301 static int m4e16,n4e16; /*sim.execlk*/ 01302 static int *il_sim_execlk; 01303 static int *l_sim_execlk; 01304 static int m4e17,n4e17; /*sim.ordclk*/ 01305 static int *il_sim_ordclk; 01306 static int *l_sim_ordclk; 01307 static int m4e18,n4e18; /*sim.cord*/ 01308 static int *il_sim_cord; 01309 static int *l_sim_cord; 01310 static int m4e19,n4e19; /*sim.oord*/ 01311 static int *il_sim_oord; 01312 static int *l_sim_oord; 01313 static int m4e20,n4e20; /*sim.zord*/ 01314 static int *il_sim_zord; 01315 static int *l_sim_zord; 01316 static int m4e21,n4e21; /*sim.critev*/ 01317 static int *il_sim_critev; 01318 static int *l_sim_critev; 01319 static int m4e22,n4e22; /*sim.nb*/ 01320 static int *il_sim_nb; 01321 static int *l_sim_nb; 01322 static int m4e23,n4e23; /*sim.ztyp*/ 01323 static int *il_sim_ztyp; 01324 static int *l_sim_ztyp; 01325 static int m4e24,n4e24; /*sim.nblk*/ 01326 static int *il_sim_nblk; 01327 static int *l_sim_nblk; 01328 static int m4e25,n4e25; /*sim.ndcblk*/ 01329 static int *il_sim_ndcblk; 01330 static int *l_sim_ndcblk; 01331 static int m4e26,n4e26; /*sim.subscr*/ 01332 static int *il_sim_subscr; 01333 static int *l_sim_subscr; 01334 static int m4e27,n4e27; /*sim.funtyp*/ 01335 static int *il_sim_funtyp; 01336 static int *l_sim_funtyp; 01337 static int m4e28,n4e28; /*sim.iord*/ 01338 static int *il_sim_iord; 01339 static int *l_sim_iord; 01340 static int m4e29,n4e29; /*sim.labels*/ 01341 static int *il_sim_lab; 01342 static int *il_sim_labptr; 01343 static int *l_sim_lab; 01344 static int m4e30,n4e30; /*sim.modptr*/ 01345 static int *il_sim_modptr; 01346 static int *l_sim_modptr; 01347 01348 static int m5,n5; /*str*/ 01349 static int *il_str; 01350 static int *l_str; 01351 static int flag; 01352 01353 static int m6,n6; /*tol*/ 01354 static int *il_tol; 01355 static double *l_tol; 01356 01357 /*auxilary variables*/ 01358 static double simpar[7]; 01359 static int solver; 01360 static int *lfunpt; /*for function table*/ 01361 static int lf,ilf,ifun; /*for function table*/ 01362 static int ierr,istate; /*error variable of scicos.c*/ 01363 01364 /*local variable*/ 01365 int *subheader; /*pointer to get address of a subvariable in a list*/ 01366 int i,j,k; /*local counter variable*/ 01367 int sz_str; /*local variable to store size of string*/ 01368 int err_check; /*local variable for cross var. checking dimension*/ 01369 01370 /*definition of min/max input/output argument*/ 01371 static int minlhs=1, maxlhs=2, minrhs=6, maxrhs=6; 01372 01373 /************************************* 01374 * Check number of inputs and outputs 01375 *************************************/ 01376 CheckRhs(minrhs,maxrhs); 01377 CheckLhs(minlhs,maxlhs); 01378 01379 /**************** 01380 * state (rhs 1) 01381 ****************/ 01382 il_state = (int *) GetData(1); 01383 il_state_save = il_state; /* make a copy of il_state in a global variabe */ 01384 if(il_state[0]!=16) /*Check if state is a tlist*/ 01385 { 01386 Scierror(56,"%s : First argument must be a Tlist.\n",fname); 01387 C2F(iop).err=1; 01388 return 0; 01389 } 01390 m1 = il_state[1]; 01391 01392 /*2 : state.x */ 01393 il_state_x = (int *) (listentry(il_state,2)); 01394 l_state_x = (double *) (il_state_x+4); 01395 m1e2 = il_state_x[1]; 01396 n1e2 = il_state_x[2]; 01397 01398 /*3 : state.z */ 01399 il_state_z = (int *) (listentry(il_state,3)); 01400 l_state_z = (double *) (il_state_z+4); 01401 m1e3 = il_state_z[1]; 01402 n1e3 = il_state_z[2]; 01403 01404 /*4 : state.iz */ 01405 il_state_iz = (int *) (listentry(il_state,4)); 01406 l_state_iz = (double *) (il_state_iz+4); 01407 m1e4 = il_state_iz[1]; 01408 n1e4 = il_state_iz[2]; 01409 01410 /*5 : state.tevts */ 01411 il_state_tevts = (int *) (listentry(il_state,5)); 01412 l_state_tevts = (double *) (il_state_tevts+4); 01413 m1e5 = il_state_tevts[1]; 01414 n1e5 = il_state_tevts[2]; 01415 01416 /*6 : state.evtspt */ 01417 il_state_evtspt = (int *) (listentry(il_state,6)); 01418 l_state_evtspt = (int *) (il_state_evtspt+4); 01419 m1e6 = il_state_evtspt[1]; 01420 n1e6 = il_state_evtspt[2]; 01421 01422 /*7 : state.pointi */ 01423 il_pointi = (int *) (listentry(il_state,7)); 01424 l_pointi = (int *) (il_pointi+4); 01425 m1e7 = il_pointi[1]; 01426 n1e7 = il_pointi[2]; 01427 01428 /*8 : state.outtb */ 01429 il_state_outtb = (int *) (listentry(il_state,8)); 01430 if(il_state_outtb[0]!=15) /*check if il_state_outtb is a list*/ 01431 { 01432 Scierror(56,"%s : outtb element of state must be a list.\n",fname); 01433 C2F(iop).err=4; 01434 return 0; 01435 } 01436 nlnk = il_state_outtb[1]; /*nlnk is the dimension of the list state_louttb*/ 01437 01438 /*************** 01439 * tcur (rhs 2) 01440 ***************/ 01441 il_tcur = (int *) GetData(2); 01442 if(il_tcur[0]!=1) /*Check if tcur is a real or complex matrix*/ 01443 { 01444 Scierror(53,"%s : Second argument must be a scalar.\n",fname); 01445 C2F(iop).err=2; 01446 return 0; 01447 } 01448 l_tcur = (double *) (il_tcur+4); 01449 m2 = il_tcur[1]; 01450 n2 = il_tcur[2]; 01451 CheckScalar(2,m2,n2); 01452 CheckDims(2,m2,n2,1,1); 01453 01454 /************* 01455 * tf (rhs 3) 01456 *************/ 01457 il_tf = (int *) GetData(3); 01458 if(il_tf[0]!=1) /*Check if tf is a real or complex matrix*/ 01459 { 01460 Scierror(53,"%s : Third argument must be a scalar.\n",fname); 01461 C2F(iop).err=3; 01462 return 0; 01463 } 01464 l_tf = (double *) (il_tf+4); 01465 m3 = il_tf[1]; 01466 n3 = il_tf[2]; 01467 CheckScalar(3,m3,n3); 01468 CheckDims(3,m3,n3,1,1); 01469 01470 /************* 01471 * sim (rhs 4) 01472 *************/ 01473 il_sim = (int *) GetData(4); 01474 if(il_sim[0]!=16) /*Check if sim is a tlist*/ 01475 { 01476 Scierror(56,"%s : Fourth argument must be a Tlist.\n",fname); 01477 C2F(iop).err=4; 01478 return 0; 01479 } 01480 m4 = il_sim[1]; 01481 n4 = il_sim[2]; 01482 il_sim_save = il_sim; /* make a copy of il_sim in a global variabe */ 01483 01484 /*2 : sim.funs*/ 01485 il_sim_fun = (int *) (listentry(il_sim,2)); 01486 if(il_sim_fun[0]!=15) /*check if sim.funs is a list*/ 01487 { 01488 Scierror(56,"%s : Second element of sim must be a list.\n",fname); 01489 C2F(iop).err=4; 01490 return 0; 01491 } 01492 nblk = il_sim_fun[1]; /*nblk is the dimension of the list sim.funs*/ 01493 01494 /*3 : sim.xptr */ 01495 il_sim_xptr = (int *) (listentry(il_sim,3)); 01496 m4e3 = il_sim_xptr[1]; 01497 n4e3 = il_sim_xptr[2]; 01498 l_sim_xptr = (int *) (il_sim_xptr+4); 01499 01500 /*4 : sim.zptr */ 01501 il_sim_zptr = (int *) (listentry(il_sim,4)); 01502 m4e4 = il_sim_zptr[1]; 01503 n4e4 = il_sim_zptr[2]; 01504 l_sim_zptr = (int *) (il_sim_zptr+4); 01505 01506 /*5 : sim.zcptr */ 01507 il_sim_zcptr = (int *) (listentry(il_sim,5)); 01508 m4e5 = il_sim_zcptr[1]; 01509 n4e5 = il_sim_zcptr[2]; 01510 l_sim_zcptr = (int *) (il_sim_zcptr+4); 01511 01512 /*6 : sim.inpptr */ 01513 il_sim_inpptr = (int *) (listentry(il_sim,6)); 01514 m4e6 = il_sim_inpptr[1]; 01515 n4e6 = il_sim_inpptr[2]; 01516 l_sim_inpptr = (int *) (il_sim_inpptr+4); 01517 01518 /*7 : sim.outptr */ 01519 il_sim_outptr = (int *) (listentry(il_sim,7)); 01520 m4e7 = il_sim_outptr[1]; 01521 n4e7 = il_sim_outptr[2]; 01522 l_sim_outptr = (int *) (il_sim_outptr+4); 01523 01524 /*8 : sim.inplnk */ 01525 il_sim_inplnk = (int *) (listentry(il_sim,8)); 01526 m4e8 = il_sim_inplnk[1]; 01527 n4e8 = il_sim_inplnk[2]; 01528 l_sim_inplnk = (int *) (il_sim_inplnk+4); 01529 01530 /*9 : sim.outlnk */ 01531 il_sim_outlnk = (int *) (listentry(il_sim,9)); 01532 m4e9 = il_sim_outlnk[1]; 01533 n4e9 = il_sim_outlnk[2]; 01534 l_sim_outlnk = (int *) (il_sim_outlnk+4); 01535 01536 /*10 : sim.rpar */ 01537 il_sim_rpar = (int *) (listentry(il_sim,10)); 01538 m4e10 = il_sim_rpar[1]; 01539 n4e10 = il_sim_rpar[2]; 01540 l_sim_rpar = (double *) (il_sim_rpar+4); 01541 01542 /*11 : sim.rpptr */ 01543 il_sim_rpptr = (int *) (listentry(il_sim,11)); 01544 m4e11 = il_sim_rpptr[1]; 01545 n4e11 = il_sim_rpptr[2]; 01546 l_sim_rpptr = (int *) (il_sim_rpptr+4); 01547 01548 /*12 : sim.ipar */ 01549 il_sim_ipar = (int *) (listentry(il_sim,12)); 01550 m4e12 = il_sim_ipar[1]; 01551 n4e12 = il_sim_ipar[2]; 01552 l_sim_ipar = (int *) (il_sim_ipar+4); 01553 01554 /*13 : sim.ipptr */ 01555 il_sim_ipptr = (int *) (listentry(il_sim,13)); 01556 m4e13 = il_sim_ipptr[1]; 01557 n4e13 = il_sim_ipptr[2]; 01558 l_sim_ipptr = (int *) (il_sim_ipptr+4); 01559 01560 /*14 : sim.clkptr */ 01561 il_sim_clkptr = (int *) (listentry(il_sim,14)); 01562 m4e14 = il_sim_clkptr[1]; 01563 n4e14 = il_sim_clkptr[2]; 01564 l_sim_clkptr = (int *) (il_sim_clkptr+4); 01565 01566 /*15 : sim.ordptr */ 01567 il_sim_ordptr = (int *) (listentry(il_sim,15)); 01568 m4e15 = il_sim_ordptr[1]; 01569 n4e15 = il_sim_ordptr[2]; 01570 l_sim_ordptr = (int *) (il_sim_ordptr+4); 01571 01572 /*16 : sim.execlk */ 01573 il_sim_execlk = (int *) (listentry(il_sim,16)); 01574 m4e16 = il_sim_execlk[1]; 01575 n4e16 = il_sim_execlk[2]; 01576 l_sim_execlk = (int *) (il_sim_execlk+4); 01577 01578 /*17 : sim.ordclk */ 01579 il_sim_ordclk = (int *) (listentry(il_sim,17)); 01580 m4e17 = il_sim_ordclk[1]; 01581 n4e17 = il_sim_ordclk[2]; 01582 l_sim_ordclk = (int *) (il_sim_ordclk+4); 01583 01584 /*18 : sim.cord */ 01585 il_sim_cord = (int *) (listentry(il_sim,18)); 01586 m4e18 = il_sim_cord[1]; 01587 n4e18 = il_sim_cord[2]; 01588 l_sim_cord = (int *) (il_sim_cord+4); 01589 01590 /*19 : sim.oord */ 01591 il_sim_oord = (int *) (listentry(il_sim,19)); 01592 m4e19 = il_sim_oord[1]; 01593 n4e19 = il_sim_oord[2]; 01594 l_sim_oord = (int *) (il_sim_oord+4); 01595 01596 /*20 : sim.zord */ 01597 il_sim_zord = (int *) (listentry(il_sim,20)); 01598 m4e20 = il_sim_zord[1]; 01599 n4e20 = il_sim_zord[2]; 01600 l_sim_zord = (int *) (il_sim_zord+4); 01601 01602 /*21 : sim.critev */ 01603 il_sim_critev = (int *) (listentry(il_sim,21)); 01604 m4e21 = il_sim_critev[1]; 01605 n4e21 = il_sim_critev[2]; 01606 l_sim_critev = (int *) (il_sim_critev+4); 01607 01608 /*22 : sim.nb */ 01609 il_sim_nb = (int *) (listentry(il_sim,22)); 01610 m4e22 = il_sim_nb[1]; 01611 n4e22 = il_sim_nb[2]; 01612 l_sim_nb = (int *) (il_sim_nb+4); 01613 if (l_sim_nb[0]!=nblk) /*value of nb must be equal to nblk*/ 01614 { 01615 Scierror(42,"%s : Incompatible sim.nb RHS parameter.\n",fname); 01616 return 0; 01617 } 01618 01619 /*23 : sim.ztyp */ 01620 il_sim_ztyp = (int *) (listentry(il_sim,23)); 01621 m4e23 = il_sim_ztyp[1]; 01622 n4e23 = il_sim_ztyp[2]; 01623 l_sim_ztyp = (int *) (il_sim_ztyp+4); 01624 01625 /*24 : sim.nblk */ 01626 il_sim_nblk = (int *) (listentry(il_sim,24)); 01627 m4e24 = il_sim_nblk[1]; 01628 n4e24 = il_sim_nblk[2]; 01629 l_sim_nblk = (int *) (il_sim_nblk+4); 01630 01631 /*25 : sim.ndcblk */ 01632 il_sim_ndcblk = (int *) (listentry(il_sim,25)); 01633 m4e25 = il_sim_ndcblk[1]; 01634 n4e25 = il_sim_ndcblk[2]; 01635 l_sim_ndcblk = (int *) (il_sim_ndcblk+4); 01636 01637 /*26 : sim.subscr */ 01638 il_sim_subscr = (int *) (listentry(il_sim,26)); 01639 m4e26 = il_sim_subscr[1]; 01640 n4e26 = il_sim_subscr[2]; 01641 l_sim_subscr = (int *) (il_sim_subscr+4); 01642 01643 /*27 : sim.funtyp */ 01644 il_sim_funtyp = (int *) (listentry(il_sim,27)); 01645 m4e27 = il_sim_funtyp[1]; 01646 n4e27 = il_sim_funtyp[2]; 01647 l_sim_funtyp = (int *) (il_sim_funtyp+4); 01648 01649 /*28 : sim.iord */ 01650 il_sim_iord = (int *) (listentry(il_sim,28)); 01651 m4e28 = il_sim_iord[1]; 01652 n4e28 = il_sim_iord[2]; 01653 l_sim_iord = (int *) (il_sim_iord+4); 01654 01655 /*29 : sim.labels */ 01656 il_sim_lab = (int *) (listentry(il_sim,29)); 01657 m4e29 = il_sim_lab[1]; 01658 n4e29 = il_sim_lab[2]; 01659 il_sim_labptr = &il_sim_lab[4]; /*get address-1 of first pointer in labels*/ 01660 l_sim_lab = (int *) (il_sim_lab+m4e29+5); /*get address of first string in labels*/ 01661 01662 /*30 : sim.modptr */ 01663 il_sim_modptr = (int *) (listentry(il_sim,30)); 01664 m4e30 = il_sim_modptr[1]; 01665 n4e30 = il_sim_modptr[2]; 01666 l_sim_modptr= (int *) (il_sim_modptr+4); 01667 01668 /************* 01669 * str (rhs 5) 01670 *************/ 01671 il_str = (int *) GetData(5); 01672 m5 = il_str[1]; 01673 n5 = il_str[2]; 01674 l_str = (int *) (il_str+6); 01675 CheckDims(5,m5,n5,m5,1); 01676 01677 sz_str=il_str[5]-1; /*store the length of str*/ 01678 C2F(cha1).buf[0]=' '; 01679 C2F(cvstr)(&sz_str,&l_str[0],&C2F(cha1).buf[0],(j=1,&j),sz_str); /*codetoascii*/ 01680 C2F(cha1).buf[sz_str]='\0'; 01681 if (strcmp(C2F(cha1).buf,"start") == 0) flag=1; 01682 else if (strcmp(C2F(cha1).buf,"run") == 0) flag=2; 01683 else if (strcmp(C2F(cha1).buf,"finish") == 0) flag=3; 01684 else if (strcmp(C2F(cha1).buf,"linear") == 0) flag=4; 01685 else 01686 { 01687 Scierror(44,"%s : Fifth argument is incorrect.\n",fname); 01688 C2F(iop).err=5; 01689 return 0; 01690 } 01691 01692 /************* 01693 * tol (rhs 6) 01694 *************/ 01695 il_tol = (int *) GetData(6); 01696 l_tol = (double *) (il_tol+4); 01697 m6 = il_tol[1]; 01698 n6 = il_tol[2]; 01699 m6 = m6*n6; 01700 if (m6<4) /*Check if tol has a minimun of four elements*/ 01701 { 01702 Scierror(89,"%s : Sixth argument must have at least four elements.\n",fname); 01703 C2F(iop).err=6; 01704 return 0; 01705 } 01706 else if(m6>7) /*Check if tol has a maximum of seven elements*/ 01707 { 01708 Scierror(89,"%s : Sixth argument must have a maximum of seven elements.\n",fname); 01709 C2F(iop).err=6; 01710 return 0; 01711 } 01712 01713 /****************** 01714 * set simpar array 01715 ******************/ 01716 if (m6==4) {for(i=0;i<4;i++) simpar[i]=l_tol[i];simpar[4]=0;simpar[5]=0;simpar[6]=0;} 01717 else if (m6==5) {for(i=0;i<5;i++) simpar[i]=l_tol[i];simpar[5]=0;simpar[6]=0;} 01718 else if (m6==6) {for(i=0;i<6;i++) simpar[i]=l_tol[i];simpar[6]=0;} 01719 else for(i=0;i<7;i++) simpar[i]=l_tol[i]; 01720 solver=(int)simpar[5]; /*set solver variable*/ 01721 01722 /****************************** 01723 * cross variable size checking 01724 ******************************/ 01725 err_check = 0; 01726 if (m1e5!=m1e6) err_check=1; /*tevts vs evtspt*/ 01727 else if (m4e3!=m4e4) err_check=2; /*xptr vs zptr*/ 01728 else if (m4e3!=m4e5) err_check=3; /*xptr vs zcptr*/ 01729 else if (m4e3!=m4e6) err_check=4; /*xptr vs npptr*/ 01730 else if (m4e3!=m4e7) err_check=5; /*xptr vs outptr*/ 01731 else if (m4e3!=m4e11) err_check=6; /*xptr vs rpptr*/ 01732 else if (m4e3!=m4e13) err_check=7; /*xptr vs ipptr*/ 01733 else if (m4e3!=m4e14) err_check=8; /*xptr vs clkptr*/ 01734 else if ((n4e17!=2)&(m4e17!=0)) err_check=9; /*sim.ordclk*/ 01735 else if ((n4e18!=2)&(m4e18!=0)) err_check=10; /*sim.cord*/ 01736 else if ((n4e19!=2)&(m4e19!=0)) err_check=11; /*sim.oord*/ 01737 else if ((n4e20!=2)&(m4e20!=0)) err_check=12; /*sim.zord*/ 01738 else if ((n4e28!=2)&(m4e28!=0)) err_check=13; /*sim.iord*/ 01739 if (err_check!=0) 01740 { 01741 /* please write an error table here */ 01742 Scierror(42,"%s : error in cross variable size checking : %d\n",\ 01743 fname,err_check); 01744 return 0; 01745 } 01746 01747 /******************************* 01748 * set function table for blocks 01749 *******************************/ 01750 il4 = iadr(*Lstk(Top-Rhs+4)); /*sim*/ 01751 l4 = sadr(il4+m4+3); 01752 il4e2 = iadr(l4+*istk(il4+3)-1); 01753 l4e2 = sadr(il4e2+nblk+3); 01754 lf = l4e2; /*first element of the list sim.funs*/ 01755 /*define new variable lfunpt*/ 01756 if ((lfunpt=(int *) MALLOC(nblk*sizeof(int))) ==NULL ) 01757 { 01758 return 0; 01759 } 01760 01761 /*for each block*/ 01762 for (i=0;i<nblk;i++) 01763 { 01764 ilf=iadr(lf); /*should be removed later*/ 01765 subheader=(int *)(listentry(il_sim_fun,i+1)); 01766 /*Block is defined by a scilab function*/ 01767 if ((subheader[0]==11)|(subheader[0]==13)) lfunpt[i]=-lf; 01768 /*Block is defined by a function described by a characater strings*/ 01769 else if(subheader[0]==10) 01770 { 01771 sz_str=subheader[5]-1; /*store the length of function name*/ 01772 C2F(cha1).buf[0]=' '; 01773 C2F(cvstr)(&sz_str,&subheader[6],&C2F(cha1).buf[0],(j=1,&j),sz_str); /*codetoascii*/ 01774 C2F(cha1).buf[sz_str]='\0'; 01775 ifun=C2F(funnum)(C2F(cha1).buf); /*search associated function number of function name*/ 01776 /*Block is defined by a C or Fortran function*/ 01777 if (ifun>0) lfunpt[i]=ifun; 01778 /*Block is defined by a predefined scilab function*/ 01779 else 01780 { 01781 C2F(namstr)(id,&subheader[6],&sz_str,(j=0,&j)); 01782 C2F(com).fin=0; 01783 C2F(funs)(id); 01784 if ((C2F(com).fun==-1)|(C2F(com).fun==-2)) lfunpt[i]=-*Lstk(C2F(com).fin); 01785 else 01786 { 01787 C2F(curblk).kfun=i+1; 01788 Scierror(888,"%s : unknown block : %s\n",fname,C2F(cha1).buf); 01789 FREE(lfunpt); 01790 return 0; 01791 } 01792 } 01793 } 01794 else 01795 { 01796 C2F(iop).err=4; 01797 Scierror(44,"%s : error\n",fname); 01798 FREE(lfunpt); 01799 return 0; 01800 } 01801 lf=lf+*istk(il4e2+3+i)-*istk(il4e2+i+2); 01802 } 01803 01804 /******************************* 01805 * set outtbptr,outtbsz,outtbtyp 01806 *******************************/ 01807 /*Allocation of outtbptr*/ 01808 if ((outtbptr=(void **) MALLOC(nlnk*sizeof(void *)))==NULL ) 01809 { 01810 FREE(lfunpt); 01811 return 0; 01812 } 01813 /*Allocation of outtbsz*/ 01814 if ((outtbsz=(int *) MALLOC(nlnk*2*sizeof(int)))==NULL ) 01815 { 01816 FREE(outtbptr); 01817 FREE(lfunpt); 01818 return 0; 01819 } 01820 /*Allocation of outtbtyp*/ 01821 if ((outtbtyp=(int *) MALLOC(nlnk*sizeof(int)))==NULL ) 01822 { 01823 FREE(outtbsz); 01824 FREE(outtbptr); 01825 FREE(lfunpt); 01826 return 0; 01827 } 01828 01829 /*initalize nelem*/ 01830 nelem=0; 01831 01832 /*set vectors of outtb*/ 01833 for (j=0;j<nlnk;j++) /*for each link*/ 01834 { 01835 subheader=(int *)(listentry(il_state_outtb,j+1)); /*get header of outtbl(j+1)*/ 01836 outtbsz[j*2]=subheader[1]; /*store dimensions*/ 01837 outtbsz[(j*2)+1]=subheader[2]; 01838 01839 switch (subheader[0]) /*store type and address*/ 01840 { 01841 /*matrix of double*/ 01842 case 1 : switch (subheader[3]) 01843 { 01844 case 0 : outtbtyp[j]=10; /*double real matrix*/ 01845 outtbptr[j]=(double *)(subheader+4); 01846 break; 01847 01848 case 1 : outtbtyp[j]=11; /*double complex matrix*/ 01849 outtbptr[j]=(double *)(subheader+4); 01850 break; 01851 01852 default : Scierror(888,\ 01853 "%s : error. Type %d of double scalar matrix not yet supported.\n",\ 01854 fname,subheader[3]); 01855 FREE(outtbptr); 01856 FREE(outtbtyp); 01857 FREE(outtbsz); 01858 FREE(lfunpt); 01859 if (outtb_elem!=NULL) FREE(outtb_elem); 01860 break; 01861 } 01862 break; 01863 01864 /*matrix of integers*/ 01865 case 8 : switch (subheader[3]) 01866 { 01867 case 1 : outtbtyp[j]=81; /*int8*/ 01868 outtbptr[j]=(char *)(subheader+4); 01869 break; 01870 01871 case 2 : outtbtyp[j]=82; /*int16*/ 01872 outtbptr[j]=(short *)(subheader+4); 01873 break; 01874 01875 case 4 : outtbtyp[j]=84; /*int32*/ 01876 outtbptr[j]=(long *)(subheader+4); 01877 break; 01878 01879 case 11 : outtbtyp[j]=811; /*uint8*/ 01880 outtbptr[j]=(unsigned char *)(subheader+4); 01881 break; 01882 01883 case 12 : outtbtyp[j]=812; /*uint16*/ 01884 outtbptr[j]=(unsigned short *)(subheader+4); 01885 break; 01886 01887 case 14 : outtbtyp[j]=814; /*uint32*/ 01888 outtbptr[j]=(unsigned long *)(subheader+4); 01889 break; 01890 01891 default : Scierror(888,\ 01892 "%s : error. Type %d of integer scalar matrix not yet supported.\n",\ 01893 fname,subheader[3]); 01894 FREE(outtbptr); 01895 FREE(outtbtyp); 01896 FREE(outtbsz); 01897 FREE(lfunpt); 01898 if (outtb_elem!=NULL) FREE(outtb_elem); 01899 break; 01900 } 01901 break; 01902 01903 01904 default : Scierror(888,"%s : error. Type %d not yet supported.\n",fname,subheader[0]); 01905 FREE(outtbptr); 01906 FREE(outtbtyp); 01907 FREE(outtbsz); 01908 FREE(lfunpt); 01909 if (outtb_elem!=NULL) FREE(outtb_elem); 01910 return 0; 01911 break; 01912 } 01913 01914 /* store lnk and pos in outtb_elem */ 01915 k=nelem; 01916 nelem+=outtbsz[j*2]*outtbsz[(j*2)+1]; 01917 if ((outtb_elem=(outtb_el *) REALLOC(outtb_elem,nelem*sizeof(outtb_el)))==NULL) 01918 { 01919 Scierror(999,"%s : No more free memory.\n",fname); 01920 FREE(outtbptr); 01921 FREE(outtbtyp); 01922 FREE(outtbsz); 01923 FREE(lfunpt); 01924 if (outtb_elem!=NULL) FREE(outtb_elem); 01925 return 0; 01926 } 01927 for (i=0;i<outtbsz[j*2]*outtbsz[(j*2)+1];i++) 01928 { 01929 outtb_elem[k+i].lnk=j; 01930 outtb_elem[k+i].pos=i; 01931 } 01932 } 01933 01934 /******************************** 01935 * save intersci common 01936 * see intersci_push in stack2.c 01937 ********************************/ 01938 Nbvars = Rhs; /*because of the use of getdata*/ 01939 new = MALLOC(Rhs*sizeof(intersci_state)); 01940 if (new == NULL) 01941 { 01942 FREE(outtbptr); 01943 FREE(outtbtyp); 01944 FREE(outtbsz); 01945 FREE(lfunpt); 01946 FREE(outtb_elem); 01947 return 0; 01948 } 01949 loc = MALLOC(sizeof(intersci_list)); 01950 if (loc == NULL) 01951 { 01952 FREE(outtbptr); 01953 FREE(outtbtyp); 01954 FREE(outtbsz); 01955 FREE(lfunpt); 01956 FREE(outtb_elem); 01957 FREE(new); 01958 return 0; 01959 } 01960 loc->state = new; 01961 loc->nbvars = Nbvars; 01962 for (i=0;i<Rhs;i++) 01963 { 01964 loc->state[i].iwhere = C2F(intersci).iwhere[i]; 01965 loc->state[i].ntypes = C2F(intersci).ntypes[i]; 01966 loc->state[i].lad = C2F(intersci).lad[i]; 01967 loc->state[i].lhsvar = C2F(intersci).lhsvar[i]; 01968 } 01969 01970 /************************ 01971 * call scicos simulator 01972 ************************/ 01973 if (C2F(iop).ddt!=0) C2F(dbcos).idb=1; /*debug mode if ddt=0*/ 01974 01975 /* Calling sequence : 01976 * int C2F(scicos) 01977 * (x_in, xptr_in, z__, work,zptr,modptr_in, iz, izptr, t0_in, tf_in, tevts_in, 01978 * evtspt_in, nevts, pointi_in, outtbptr_in, outtbsz_in, outtbtyp_in, nlnk1, 01979 * funptr, funtyp_in, inpptr_in, outptr_in, 01980 * inplnk_in, outlnk_in, rpar, rpptr, ipar, ipptr, clkptr_in, 01981 * ordptr_in, nordptr1, ordclk_in, cord_in, ncord1, iord_in, niord1, oord_in, noord1, 01982 * zord_in, nzord1, critev_in, nblk1, ztyp, zcptr_in, subscr, nsubs, simpar, 01983 * flag__, ierr_out) 01984 * 01985 * double *x_in,*z__; 01986 * void **work; 01987 * integer *modptr_in; 01988 * integer *xptr_in; 01989 * integer *zptr, *iz, *izptr; 01990 * double *t0_in, *tf_in, *tevts_in; 01991 * integer *evtspt_in, *nevts, *pointi_in; 01992 * void **outtbptr_in; 01993 * integer *outtbsz_in; 01994 * integer *outtbtyp_in; 01995 * integer *nlnk1, *funptr, *funtyp_in, *inpptr_in, *outptr_in; 01996 * integer *inplnk_in, *outlnk_in; 01997 * double *rpar; 01998 * integer *rpptr, *ipar, *ipptr, *clkptr_in, *ordptr_in, *nordptr1; 01999 * integer *ordclk_in, *cord_in, *ncord1, *iord_in, *niord1, *oord_in; 02000 * integer *noord1, *zord_in, *nzord1, *critev_in, *nblk1, *ztyp, *zcptr_in; 02001 * integer *subscr, *nsubs; 02002 * double *simpar; 02003 * integer *flag__, *ierr_out; 02004 */ 02005 02006 C2F(scicos)(l_state_x,l_sim_xptr,l_state_z, \ 02007 l_state_iz,l_sim_zptr, \ 02008 l_sim_modptr, \ 02009 l_sim_lab,il_sim_labptr,l_tcur,l_tf,l_state_tevts, \ 02010 l_state_evtspt,&m1e5,l_pointi,outtbptr,outtbsz,outtbtyp,outtb_elem,&nelem,&nlnk, \ 02011 lfunpt,l_sim_funtyp,l_sim_inpptr, \ 02012 l_sim_outptr,l_sim_inplnk,l_sim_outlnk, \ 02013 l_sim_rpar,l_sim_rpptr, \ 02014 l_sim_ipar,l_sim_ipptr,l_sim_clkptr, \ 02015 l_sim_ordptr,&m4e15, \ 02016 l_sim_ordclk,l_sim_cord,&m4e18, \ 02017 l_sim_iord,&m4e28, \ 02018 l_sim_oord,&m4e19,l_sim_zord, &m4e20, \ 02019 l_sim_critev,&nblk,l_sim_ztyp,l_sim_zcptr, \ 02020 l_sim_subscr,&m4e26,simpar,&flag,&ierr); 02021 02022 C2F(dbcos).idb=0; /*return in normal mode*/ 02023 02024 /****************************** 02025 * retrieve intersci common 02026 * see intersci_pop in stack2.c 02027 ******************************/ 02028 Nbvars = loc->nbvars; 02029 for (i=0;i<Rhs;i++) 02030 { 02031 C2F(intersci).iwhere[i] = loc->state[i].iwhere ; 02032 C2F(intersci).ntypes[i] = loc->state[i].ntypes ; 02033 C2F(intersci).lad[i] = loc->state[i].lad ; 02034 C2F(intersci).lhsvar[i] = loc->state[i].lhsvar ; 02035 } 02036 FREE(loc->state); 02037 FREE(loc); 02038 02039 /********************** 02040 * Free allocated array 02041 **********************/ 02042 FREE(outtbptr); 02043 FREE(outtbtyp); 02044 FREE(outtbsz); 02045 FREE(lfunpt); 02046 FREE(outtb_elem); 02047 02048 /************************************* 02049 * switch to appropriate message error 02050 *************************************/ 02051 if (ierr>0) 02052 { 02053 switch (ierr) 02054 { 02055 case 1 : strcpy(C2F(cha1).buf,"scheduling problem"); 02056 C2F(curblk).kfun=0; 02057 break; 02058 02059 case 2 : strcpy(C2F(cha1).buf,"input to zero-crossing stuck on zero"); 02060 C2F(curblk).kfun=0; 02061 break; 02062 02063 case 3 : strcpy(C2F(cha1).buf,"event conflict"); 02064 C2F(curblk).kfun=0; 02065 break; 02066 02067 case 4 : strcpy(C2F(cha1).buf,"algrebraic loop detected"); 02068 C2F(curblk).kfun=0; 02069 break; 02070 02071 case 5 : strcpy(C2F(cha1).buf,"cannot allocate memory"); 02072 C2F(curblk).kfun=0; 02073 break; 02074 02075 case 6 : strcpy(C2F(cha1).buf,"a block has been called with input out of its domain"); 02076 break; 02077 02078 case 7 : strcpy(C2F(cha1).buf,"singularity in a block"); 02079 break; 02080 02081 case 8 : strcpy(C2F(cha1).buf,"block produces an internal error"); 02082 break; 02083 02084 case 20 : strcpy(C2F(cha1).buf,"initial conditions not converging"); 02085 C2F(curblk).kfun=0; 02086 break; 02087 02088 case 21 : sprintf(C2F(cha1).buf, "cannot allocate memory in block=%d", \ 02089 C2F(curblk).kfun); 02090 C2F(curblk).kfun=0; 02091 break; 02092 02093 case 22 : strcpy(C2F(cha1).buf,"sliding mode condition, cannot integrate"); 02094 C2F(curblk).kfun=0; 02095 break; 02096 02097 default : if(ierr>=1000) 02098 strcpy(C2F(cha1).buf,"unknown or erroneous block"); 02099 else if (ierr>=100) 02100 { 02101 istate=-(ierr-100); 02102 sprintf(C2F(cha1).buf, "integration problem istate=%d",istate); 02103 C2F(curblk).kfun=0; 02104 } 02105 else 02106 { 02107 strcpy(C2F(cha1).buf,"scicos unexpected error,please report..."); 02108 C2F(curblk).kfun=0; 02109 } 02110 break; 02111 } 02112 if (! (C2F(errgst).err1>0||C2F(iop).err>0)) 02113 { 02114 Scierror(888,"%s\n",C2F(cha1).buf); 02115 C2F(curblk).kfun=0; 02116 C2F(com).fun=0; /*set common fun=0 (this disable bug in debug mode)*/ 02117 return 0; 02118 } 02119 } 02120 02121 if (C2F(iop).err>0) return 0; 02122 02123 C2F(curblk).kfun=0; 02124 C2F(com).fun=0; 02125 02126 /********************* 02127 * return Lsh variable 02128 *********************/ 02129 if (Lhs>=1) LhsVar(1) = 1; /*return state in LhsVar(1)*/ 02130 if (Lhs==2) LhsVar(2) = 2; /*return tcur in LhsVar(2)*/ 02131 02132 /* end */ 02133 return 0; 02134 }
Here is the call graph for this function:

Definition at line 291 of file intcscicos.c.
References CheckRhs, GetRhsVar, istk, LhsVar, and set_block_error().
00293 : algebriques, +1 differentielles) */ 00294 char *fname; 00295 unsigned long fname_len; 00296 { 00297 int un,l1; 00298 CheckRhs(1,1); 00299 GetRhsVar(1,"i",(un=1,&un),(un=1,&un),&l1); 00300 set_block_error(*istk(l1)); 00301 LhsVar(1)=0; 00302 return 0; 00303 }
Here is the call graph for this function:

Definition at line 277 of file intcscicos.c.
References CheckRhs, GetRhsVar, istk, LhsVar, m1, and set_pointer_xproperty().
00279 : algebriques, +1 differentielles) */ 00280 char *fname; 00281 unsigned long fname_len; 00282 { 00283 int un,l1,m1; 00284 CheckRhs(1,1); 00285 GetRhsVar(1,"i",&m1,(un=1,&un),&l1); 00286 set_pointer_xproperty(istk(l1)); 00287 LhsVar(1)=0; 00288 return 0; 00289 }
Here is the call graph for this function:

Definition at line 68 of file intcscicos.c.
References CheckLhs, CheckRhs, CreateVar, get_scicos_time(), LhsVar, and stk.
00072 { 00073 int un,l1; 00074 CheckRhs(-1,0); 00075 CheckLhs(1,1); 00076 CreateVar(1,"d",(un=1,&un),(un=1,&un),&l1); 00077 *stk(l1)=get_scicos_time(); 00078 LhsVar(1)=1; 00079 return 0; 00080 }
Here is the call graph for this function:

Definition at line 150 of file intcscicos.c.
References C2F, CheckLhs, CheckRhs, CreateVar, ctree2(), GetRhsVar, iadr, istk, iwhere, LhsVar, and n.
00154 { 00155 int un=1,ipvec,nvec,mvec,noin,moin,ipoin,noinr,moinr,ipoinr; 00156 int ndep,mdep,ipdep,ndepuptr,mdepuptr,ipdepuptr,ipord,ipok,n,nord; 00157 00158 CheckRhs(5,5); 00159 CheckLhs(2,2); 00160 00161 GetRhsVar(1,"i",&nvec,&mvec,&ipvec); 00162 GetRhsVar(2,"i",&noin,&moin,&ipoin); 00163 GetRhsVar(3,"i",&noinr,&moinr,&ipoinr); 00164 GetRhsVar(4,"i",&ndep,&mdep,&ipdep); 00165 GetRhsVar(5,"i",&ndepuptr,&mdepuptr,&ipdepuptr); 00166 n=nvec*mvec; 00167 CreateVar(6,"i",&n,&un,&ipord); 00168 CreateVar(7,"i",&un,&un,&ipok); 00169 00170 ctree2(istk(ipvec),n,istk(ipdep),istk(ipdepuptr),istk(ipoin),istk(ipoinr), 00171 istk(ipord),&nord,istk(ipok)); 00172 *istk(iadr(C2F(intersci).iwhere[5])+1)=nord; 00173 00174 LhsVar(1)=6; 00175 LhsVar(2)=7; 00176 00177 return 0; 00178 }
Here is the call graph for this function:

Definition at line 180 of file intcscicos.c.
References C2F, CheckLhs, CheckRhs, CreateVar, ctree3(), GetRhsVar, iadr, istk, iwhere, LhsVar, and n.
00184 { 00185 int un=1,ipvec,nvec,mvec,ntyp,mtyp,iptyp,nbex,mbex,ipbex; 00186 int ndep,mdep,ipdep,ndepuptr,mdepuptr,ipdepuptr,ipord,ipok,n,nord; 00187 int nbop,mbop,ipbop,nbln,mbln,ipbln,nblr,mblr,ipblr; 00188 00189 CheckRhs(8,8); 00190 CheckLhs(2,2); 00191 00192 GetRhsVar(1,"i",&nvec,&mvec,&ipvec); 00193 GetRhsVar(2,"i",&ndep,&mdep,&ipdep); 00194 GetRhsVar(3,"i",&ndepuptr,&mdepuptr,&ipdepuptr); 00195 GetRhsVar(4,"i",&ntyp,&mtyp,&iptyp); 00196 GetRhsVar(5,"i",&nbex,&mbex,&ipbex); 00197 GetRhsVar(6,"i",&nbop,&mbop,&ipbop); 00198 GetRhsVar(7,"i",&nbln,&mbln,&ipbln); 00199 GetRhsVar(8,"i",&nblr,&mblr,&ipblr); 00200 00201 n=nvec*mvec; 00202 CreateVar(9,"i",&n,&un,&ipord); 00203 CreateVar(10,"i",&un,&un,&ipok); 00204 00205 ctree3(istk(ipvec),n,istk(ipdep),istk(ipdepuptr),istk(iptyp),istk(ipbex), 00206 istk(ipbop),istk(ipbln),istk(ipblr),istk(ipord),&nord,istk(ipok)); 00207 *istk(iadr(C2F(intersci).iwhere[8])+1)=nord; 00208 00209 LhsVar(1)=9; 00210 LhsVar(2)=10; 00211 00212 return 0; 00213 }
Here is the call graph for this function:

Definition at line 247 of file intcscicos.c.
References CheckLhs, CheckRhs, CreateVarFromPtr, LhsVar, n_pointer_xproperty, and pointer_xproperty.
00249 : algebriques, +1 differentielles) */ 00250 char *fname; 00251 unsigned long fname_len; 00252 { 00253 int un; 00254 extern int* pointer_xproperty; 00255 extern int n_pointer_xproperty; 00256 CheckRhs(-1,0); 00257 CheckLhs(1,1); 00258 CreateVarFromPtr(1,"i",&n_pointer_xproperty,(un=1,&un),&pointer_xproperty); 00259 LhsVar(1)=1; 00260 return 0; 00261 }
Definition at line 46 of file intcscicos.c.
References C2F, cvstr(), listentry(), Min, retval(), and str.
Referenced by intcpass2().
00047 { 00048 int nf, longueur, istart, k, ilocal, retval; 00049 int *headerstr; 00050 static char str[24]; 00051 00052 headerstr = listentry(ptr,1); 00053 nf=headerstr[1]*headerstr[2]-1; /* number of fields */ 00054 retval=-1; 00055 for (k=0; k<nf; k++) { 00056 longueur=Min(headerstr[6+k]-headerstr[5+k],24); /* size of kth fieldname */ 00057 istart=5+nf+headerstr[5+k]; /* start of kth fieldname code */ 00058 /* istart=8+headerstr[4+nf+k]; */ 00059 C2F(cvstr)(&longueur, &headerstr[istart], str, (ilocal=1, &ilocal),longueur); 00060 str[longueur]='\0'; 00061 if (strcmp(string, str) == 0) { 00062 retval=k+2; 00063 break;} 00064 } 00065 return retval; 00066 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2224 of file intcscicos.c.
References Bot, err, iadr, int, istk, j, l, Lstk, sadr, stk, and Top.
02225 { 02226 /************************************ 02227 * variables and constants définition 02228 ************************************/ 02229 /*counter and address variable declaration*/ 02230 int nm,il,l,j,err; 02231 02232 /*define all type of accepted ptr */ 02233 double *x_d,*ptr_d; 02234 char *x_c,*ptr_c; 02235 unsigned char *x_uc,*ptr_uc; 02236 short *x_s,*ptr_s; 02237 unsigned short *x_us,*ptr_us; 02238 int *x_i,*ptr_i; 02239 unsigned int *x_ui,*ptr_ui; 02240 long *x_l,*ptr_l; 02241 unsigned long *x_ul,*ptr_ul; 02242 02243 /* Check if the stack is not full */ 02244 if (Top >= Bot) 02245 { 02246 err = 1; 02247 return err; 02248 } 02249 else 02250 { 02251 Top = Top + 1; 02252 il = iadr(*Lstk(Top)); 02253 l = sadr(il+4); 02254 } 02255 02256 /* set number of double needed to store data */ 02257 if (typ_var==10) nm=n*m; /*double real matrix*/ 02258 else if (typ_var==11) nm=n*m*2; /*double real matrix*/ 02259 else if (typ_var==80) nm=(int)(ceil((n*m)/2)+1); /*int*/ 02260 else if (typ_var==81) nm=(int)(ceil((n*m)/8)+1); /*int8*/ 02261 else if (typ_var==82) nm=(int)(ceil((n*m)/4)+1); /*int16*/ 02262 else if (typ_var==84) nm=(int)(ceil((n*m)/2)+1); /*int32*/ 02263 else if (typ_var==800) nm=(int)(ceil((n*m)/2)+1); /*uint*/ 02264 else if (typ_var==811) nm=(int)(ceil((n*m)/8)+1); /*uint8*/ 02265 else if (typ_var==812) nm=(int)(ceil((n*m)/4)+1); /*uint16*/ 02266 else if (typ_var==814) nm=(int)(ceil((n*m)/2)+1); /*uint32*/ 02267 else nm=n*m; /*double real matrix*/ 02268 02269 /*check if there is free space for new data*/ 02270 err = l + nm - *Lstk(Bot); 02271 if (err > 0) 02272 { 02273 err = 2; 02274 return err; 02275 } 02276 02277 /************************** 02278 * store data on the stack 02279 *************************/ 02280 switch (typ_var) /*for each type of data*/ 02281 { 02282 case 10 : /* set header */ 02283 *istk(il) = 1; /*double real matrix*/ 02284 *istk(il+1) = n; 02285 *istk(il+2) = m; 02286 *istk(il+3) = 0; 02287 x_d = (double *) x; 02288 ptr_d = (double *) stk(l); 02289 for (j=0;j<m*n;j++) ptr_d[j] = x_d[j]; 02290 break; 02291 02292 case 11 : /* set header */ 02293 *istk(il) = 1; /*double complex matrix*/ 02294 *istk(il+1) = n; 02295 *istk(il+2) = m; 02296 *istk(il+3) = 1; 02297 x_d = (double *) x; 02298 ptr_d = (double *) stk(l); 02299 for (j=0;j<2*m*n;j++) ptr_d[j] = x_d[j]; 02300 break; 02301 02302 case 80 : /* set header */ 02303 *istk(il) = 8; /*int*/ 02304 *istk(il+1) = n; 02305 *istk(il+2) = m; 02306 *istk(il+3) = 4; 02307 x_i = (int *) x; 02308 for (j=0;j<m*n;j++) 02309 { 02310 ptr_i = (int *) istk(il+4); 02311 ptr_i[j] = x_i[j]; 02312 } 02313 break; 02314 02315 case 81 : /* set header */ 02316 *istk(il) = 8; /*int8*/ 02317 *istk(il+1) = n; 02318 *istk(il+2) = m; 02319 *istk(il+3) = 1; 02320 x_c = (char *) x; 02321 for (j=0;j<m*n;j++) 02322 { 02323 ptr_c = (char *) istk(il+4); 02324 ptr_c[j] = x_c[j]; 02325 } 02326 break; 02327 02328 case 82 : /* set header */ 02329 *istk(il) = 8; /*int16*/ 02330 *istk(il+1) = n; 02331 *istk(il+2) = m; 02332 *istk(il+3) = 2; 02333 x_s = (short *) x; 02334 for (j=0;j<m*n;j++) 02335 { 02336 ptr_s = (short *) istk(il+4); 02337 ptr_s[j] = x_s[j]; 02338 } 02339 break; 02340 02341 case 84 : /* set header */ 02342 *istk(il) = 8; /*int32*/ 02343 *istk(il+1) = n; 02344 *istk(il+2) = m; 02345 *istk(il+3) = 4; 02346 x_l = (long *) x; 02347 for (j=0;j<m*n;j++) 02348 { 02349 ptr_l = (long *) istk(il+4); 02350 ptr_l[j] = x_l[j]; 02351 } 02352 break; 02353 02354 case 800 : /* set header */ 02355 *istk(il) = 8; /*uint*/ 02356 *istk(il+1) = n; 02357 *istk(il+2) = m; 02358 *istk(il+3) = 14; 02359 x_ui = (unsigned int *) x; 02360 for (j=0;j<m*n;j++) 02361 { 02362 ptr_ui = (unsigned int *) istk(il+4); 02363 ptr_ui[j] = x_ui[j]; 02364 } 02365 break; 02366 02367 case 811 : /* set header */ 02368 *istk(il) = 8; /*uint8*/ 02369 *istk(il+1) = n; 02370 *istk(il+2) = m; 02371 *istk(il+3) = 11; 02372 x_uc = (unsigned char *) x; 02373 for (j=0;j<m*n;j++) 02374 { 02375 ptr_uc = (unsigned char *) istk(il+4); 02376 ptr_uc[j] = x_uc[j]; 02377 } 02378 break; 02379 02380 case 812 : /* set header */ 02381 *istk(il) = 8; /*uint16*/ 02382 *istk(il+1) = n; 02383 *istk(il+2) = m; 02384 *istk(il+3) = 12; 02385 x_us = (unsigned short *) x; 02386 for (j=0;j<m*n;j++) 02387 { 02388 ptr_us = (unsigned short *) istk(il+4); 02389 ptr_us[j] = x_us[j]; 02390 } 02391 break; 02392 02393 case 814 : /* set header */ 02394 *istk(il) = 8; /*uint32*/ 02395 *istk(il+1) = n; 02396 *istk(il+2) = m; 02397 *istk(il+3) = 14; 02398 x_ul = (unsigned long *) x; 02399 for (j=0;j<m*n;j++) 02400 { 02401 ptr_ul = (unsigned long *) istk(il+4); 02402 ptr_ul[j] = x_ul[j]; 02403 } 02404 break; 02405 02406 default : /* set header */ 02407 *istk(il) = 1; /*double real matrix*/ 02408 *istk(il+1) = n; 02409 *istk(il+2) = m; 02410 *istk(il+3) = 0; 02411 x_d = (double *) x; 02412 for (j=0;j<m*n;j++) 02413 { 02414 ptr_d = (double *) stk(il+4); 02415 ptr_d[j] = x_d[j]; 02416 } 02417 break; 02418 } 02419 02420 /* set value in lstk */ 02421 *Lstk(Top+1) = l + nm; 02422 02423 /*return error flag = 0 */ 02424 err = 0; 02425 return 0; 02426 }
1.5.1