00001 #include <string.h>
00002 #include <stdio.h>
00003 #include "stack-c.h"
00004
00006 extern int ex2c __PARAMS((double *, int *,int *,double *, int *,int *,int *));
00007
00008
00009
00010
00011
00012 int intex2c(fname)
00013 char* fname;
00014 {
00015 int m1,n1,l1,ierr=0;
00017 static rhs_opts opts[]= { {-1,"v1","d",0,0,0},
00018 {-1,"v2","d",0,0,0},
00019 {-1,NULL,NULL,0,0}
00020 };
00021 int minrhs = 1,maxrhs = 1,minlhs=1,maxlhs=3,nopt,iopos;
00022
00023 nopt = NumOpt();
00024
00025 CheckRhs(minrhs,maxrhs+nopt) ;
00026 CheckLhs(minlhs,maxlhs) ;
00027
00030 GetRhsVar( 1, "c", &m1, &n1, &l1);
00031
00032 if ( get_optionals(fname,opts) == 0) return 0;
00033
00035 iopos=Rhs ;
00036 if ( opts[0].position == -1 ) {
00037 iopos++ ; opts[0].position = iopos;
00038 opts[0].m = opts[0].n = 1; opts[0].type = "d";
00039 CreateVar(opts[0].position,opts[0].type,&opts[0].m,&opts[0].n,&opts[0].l);
00040 *stk(opts[0].l)=99.0;
00041 }
00042 if ( opts[1].position == -1 ) {
00043 iopos++ ; opts[1].position = iopos;
00044 opts[1].m = opts[1].n = 1; opts[1].type = "d";
00045 CreateVar(opts[1].position,opts[1].type,&opts[1].m,&opts[1].n,&opts[1].l);
00046 *stk(opts[1].l)= 3;
00047 }
00048
00049 ex2c(stk(opts[0].l),&opts[0].m,&opts[0].n,
00050 stk(opts[1].l),&opts[1].m,&opts[1].n,&ierr);
00051
00052 if (ierr > 0)
00053 {
00054 Scierror(999,"%s: Internal error \r\n",fname);
00055 return 0;
00056 }
00058 LhsVar(1) = 1;
00059 LhsVar(2) = opts[0].position;
00060 LhsVar(3) = opts[1].position;
00061 return 0;
00062 }
00063
00064 int ex2c( a, ma,na, b,mb,nb,err)
00065 int *ma,*na,*mb,*nb,*err;
00066 double *a,*b;
00067 {
00068 int i;
00069 *err=0;
00070 for ( i= 0 ; i < (*ma)*(*na) ; i++) a[i] = 2*a[i] ;
00071 for ( i= 0 ; i < (*mb)*(*nb) ; i++) b[i] = 3*b[i] ;
00072 return(0);
00073 }
00074