out-e.c File Reference

#include <stdlib.h>
#include "intersci-n.h"

Include dependency graph for out-e.c:

Go to the source code of this file.

Data Structures

struct  OutRhsTab

Functions

void OutCOLUMN (FILE *f, VARPTR var, int insidelist, int nel)
void OutROW (FILE *f, VARPTR var, int insidelist, int nel)
void OutVECTOR (FILE *f, VARPTR var, int insidelist, int nel)
void OutMATRIX (FILE *f, VARPTR var, int insidelist, int nel)
void OutSCALAR (FILE *f, VARPTR var, int insidelist, int nel)
void OutCommon (FILE *f, VARPTR var, int insidelist, int nel)
void OutBMATRIX (FILE *f, VARPTR var, int insidelist, int nel)
void OutSTRING (FILE *f, VARPTR var, int insidelist, int nel)
void OutLIST (FILE *f, VARPTR var, int insidelist, int nel)
void OutLISTarg (FILE *f, VARPTR var, VARPTR var1, int insidelist, int nel)
void OutSPARSE (FILE *f, VARPTR var, int insidelist, int nel)
void OutIMATRIX (FILE *f, VARPTR var, int insidelist, int nel)
void OutPOLYNOM (FILE *f, VARPTR var, int insidelist, int nel)
void OutPOINTER (FILE *f, VARPTR var, int insidelist, int nel)
void OutSTRINGMAT (FILE *f, VARPTR var, int insidelist, int nel)
void OutANY (FILE *f, VARPTR var, int insidelist, int nel)
void WriteVariableOutput (FILE *f, VARPTR var, int convert, int insidelist, int nel)

Variables

int icre
int indent
int pass
static char str [MAXNAM]
static char str1 [MAXNAM]
static char str2 [MAXNAM]
static char str3 [MAXNAM]
static char str4 [MAXNAM]
static char str5 [MAXNAM]
static char strR [MAXNAM]
static char strc [MAXNAM]
static char strit [MAXNAM]
OutRhsTab OUTRHSTAB []


Function Documentation

void OutANY ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 368 of file out-e.c.

References var.

00369 {
00370   printf("output variable \"%s\" cannot have type\n",
00371          var->name);
00372   printf("  \"WORK\", \"LIST\", \"TLIST\", \"SEQUENCE\" or \"ANY\"\n");
00373   exit(1);
00374 }

void OutBMATRIX ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 99 of file out-e.c.

References Forname2Int(), OutCommon(), str1, str2, var, and variables.

00100 {
00101   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00102   strcpy(str2,Forname2Int(variables[var->el[1]-1],0));
00103   OutCommon(f,var,insidelist,nel);
00104 }

Here is the call graph for this function:

void OutCOLUMN ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 21 of file out-e.c.

References AddDeclare1(), DEC_INT, Forname2Int(), OutCommon(), str1, str2, var, and variables.

00022 {
00023   strcpy(str2,"un");
00024   AddDeclare1(DEC_INT,"un=1");
00025   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));  
00026   OutCommon(f,var,insidelist,nel);
00027 }

Here is the call graph for this function:

void OutCommon ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 60 of file out-e.c.

References AddDeclare(), DEC_INT, Fprintf(), GetExistOutVar(), i1, icre, indent, SGetForTypeAbrev(), var::stack_position, str1, str2, str3, var, and variables.

Referenced by OutBMATRIX(), OutCOLUMN(), OutMATRIX(), OutROW(), OutSCALAR(), OutSTRING(), and OutVECTOR().

00061 {
00062   int i1= var->stack_position;
00063   if (var->list_el ==0 )
00064     sprintf(str3,"l%d",i1);
00065   else
00066     sprintf(str3,"l%de%d",i1,var->list_el);
00067   if ( insidelist != 0)
00068     {
00070       int iout = GetExistOutVar();
00071       VARPTR vout = variables[iout -1];
00072       AddDeclare(DEC_INT,"lrs");
00073       Fprintf(f,indent,"CreateListVarFrom(%d,%d,\"%s\",&%s,&%s,&lrs,&%s);\n",
00074               vout->stack_position,nel,SGetForTypeAbrev(var),
00075               (str1[0] == '&' ) ? str1+1: str1,
00076               (str2[0] == '&' ) ? str2+1: str2,
00077               str3);
00078     }
00079   else
00080     {
00081       /* var is not outputed inside a list but var can be a list 
00082          element */
00083       if ( var->list_el != 0) 
00084         {
00085           AddDeclare(DEC_INT,"lrs");
00086           Fprintf(f,indent,"CreateVarFrom(%d,\"%s\",&%s,&%s,&lrs,&%s);\n",
00087                   icre,SGetForTypeAbrev(var),
00088                   (str1[0] == '&' ) ? str1+1: str1,
00089                   (str2[0] == '&' ) ? str2+1: str2,
00090                   str3);
00091           Fprintf(f,indent,"LhsVar(%d)=%d;\n",var->out_position,icre);
00092           icre++;
00093         }
00094     }
00095 }

Here is the call graph for this function:

Here is the caller graph for this function:

void OutIMATRIX ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 252 of file out-e.c.

References AddDeclare(), DEC_INT, Forname2Int(), Fprintf(), GetExistOutVar(), i1, icre, indent, SGetForTypeAbrev(), var::stack_position, str1, str2, str3, str4, str5, var, and variables.

00253 {
00254   int i1= var->stack_position;
00255   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00256   strcpy(str2,Forname2Int(variables[var->el[1]-1],0));
00257   strcpy(str3,Forname2Int(variables[var->el[2]-1],0));
00258   if (var->list_el ==0 )
00259     {
00260       sprintf(str4,"lr%d",i1);
00261       sprintf(str5,"lc%d",i1);
00262     }
00263   else
00264     {
00265       sprintf(str4,"lr%de%d",i1,var->list_el);
00266       sprintf(str5,"lc%de%d",i1,var->list_el);
00267     }
00268   if ( insidelist != 0)
00269     {
00271       int iout = GetExistOutVar();
00272       VARPTR vout = variables[iout -1];
00273       AddDeclare(DEC_INT,"lrs");
00274       Fprintf(f,indent,"CreateListCVar(%d,%d,\"%s\",%s,%s,%s,&lrs,&lcs,%s,%s);\n",
00275               vout->stack_position,nel,SGetForTypeAbrev(var),
00276               str3,str1,str2,str4,str5);
00277     }
00278   else
00279     {
00280       /* var is not outputed inside a list but var can be a list 
00281          element */
00282       if ( var->list_el != 0) 
00283         {
00284           AddDeclare(DEC_INT,"lrs");
00285           Fprintf(f,indent,"CreateCVarFrom(%d,\"%s\",%s,%s,%s,&lrs,&lcs,%s,%s);\n",
00286                   icre,SGetForTypeAbrev(var),
00287                   str3,str1,str2,str4,str5);
00288           Fprintf(f,indent,"LhsVar(%d)=%d;\n",var->out_position,icre);
00289           icre++;
00290         }
00291     }
00292 }

Here is the call graph for this function:

void OutLIST ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 116 of file out-e.c.

References var::list_el, var::list_name, nVariable, OutLISTarg(), var::present, var, and variables.

00117 {
00118   if ( insidelist != 0)
00119     {
00120       printf("can't output an argument of type list if the global\n");
00121       printf("output is a list\n");
00122       exit(1);
00123     }
00124   else 
00125     {
00126       int k;
00127       VARPTR var1;
00129       for (k = 0; k < nVariable ; k++) 
00130         {
00131           var1 = variables[k];
00132           if ((var1->list_el != 0) &&
00133               (strcmp(var1->list_name,var->name) == 0) &&
00134               var1->present)
00135             {
00136               OutLISTarg(f,var,var1,insidelist,nel);
00137             }
00138         }
00139     }
00140 }

Here is the call graph for this function:

void OutLISTarg ( FILE *  f,
VARPTR  var,
VARPTR  var1,
int  insidelist,
int  nel 
)

Definition at line 144 of file out-e.c.

References AddDeclare1(), BMATRIX, COLUMN, DEC_INT, DOUBLE, var::el, var::for_type, Forname2Int(), Fprintf(), indent, var::list_el, MATRIX, ROW, SCALAR, SGetForTypeAbrev(), var::stack_position, str1, str2, STRING, var::type, variables, and VECTOR.

Referenced by OutLIST().

00145 {
00146   switch ( var1->type) 
00147     {
00148     case BMATRIX :
00149       /* nothing to do */
00150       break;
00151     case ROW :
00152     case VECTOR:
00153       if ( var1->for_type != DOUBLE )
00154         {
00155           strcpy(str1,"un");
00156           AddDeclare1(DEC_INT,"un=1");
00157           strcpy(str2,Forname2Int(variables[var1->el[0]-1],0));
00158           Fprintf(f,indent,"ConvertData(\"%s\",%s*%s,l%de%d);\n",
00159                   SGetForTypeAbrev(var1),str1,str2,
00160                   var1->stack_position,  var1->list_el);
00161         }
00162       break;
00163     case COLUMN:
00164       strcpy(str2,"un");
00165       AddDeclare1(DEC_INT,"un=1");
00166       strcpy(str1,Forname2Int(variables[var1->el[0]-1],0));
00167       Fprintf(f,indent,"ConvertData(\"%s\",%s*%s,l%de%d);\n",
00168               SGetForTypeAbrev(var1),str1,str2,
00169               var1->stack_position,  var1->list_el);
00170       break;
00171     case MATRIX :
00172 
00173       if ( var1->for_type != DOUBLE )
00174         {
00175           strcpy(str1,Forname2Int(variables[var1->el[0]-1],0));
00176           strcpy(str2,Forname2Int(variables[var1->el[1]-1],0));
00177           Fprintf(f,indent,"ConvertData(\"%s\",%s*%s,l%de%d);\n",
00178                   SGetForTypeAbrev(var1),str1,str2,
00179                   var1->stack_position,  var1->list_el);
00180         }
00181       break;
00182     case SCALAR : 
00183       if ( var1->for_type != DOUBLE )
00184         {
00185           strcpy(str2,"un");
00186           strcpy(str1,"un");
00187           AddDeclare1(DEC_INT,"un=1");
00188           Fprintf(f,indent,"ConvertData(\"%s\",%s*%s,l%de%d);\n",
00189                   SGetForTypeAbrev(var1),str1,str2,
00190                   var1->stack_position,  var1->list_el);
00191         }
00192       break;
00193     case STRING:
00194       strcpy(str1,Forname2Int(variables[var1->el[0]-1],0));
00195       Fprintf(f,indent,"ConvertData(\"c\",%s,l%de%d);\n",
00196               str1,var1->stack_position,var1->list_el);
00197       break;
00198     default:
00199       printf("OutLIST : List output : unfinished \n");
00200       break;
00201     }
00202 }

Here is the call graph for this function:

Here is the caller graph for this function:

void OutMATRIX ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 45 of file out-e.c.

References Forname2Int(), OutCommon(), str1, str2, var, and variables.

00046 {
00047   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00048   strcpy(str2,Forname2Int(variables[var->el[1]-1],0));
00049   OutCommon(f,var,insidelist,nel);
00050 }

Here is the call graph for this function:

void OutPOINTER ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 326 of file out-e.c.

References SGetSciType(), and var.

00327 {
00328   if ( insidelist != 0)
00329     {
00330       printf(" %s in output list : not implemented ;",SGetSciType(var->type));
00331     }
00332   else 
00333     {
00334 
00335     }
00336 }

Here is the call graph for this function:

void OutPOLYNOM ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 296 of file out-e.c.

References AddDeclare(), DEC_LOGICAL, DOUBLE, Forname2Int(), Fprintf(), indent, INT, REAL, str, str1, var, and variables.

00297 {
00298   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00299   if ( insidelist != 0)
00300     {
00301       AddDeclare(DEC_LOGICAL,"listcreopoly");
00302       Fprintf(f,indent,"if(.not.listcreopoly(fname,top,%d,lw,0,%s,name%s,namel%s,lrs,lcs)) return\n",nel,str1,str,str);
00303     }
00304   else 
00305     {
00306       AddDeclare(DEC_LOGICAL,"creonepoly");
00307       Fprintf(f,indent,"if(.not.creonepoly(fname,top,0,%s,name%s,namel%s,lrs,lcs)) return\n",str1,str,str);
00308     }
00309   switch (var->for_type) {
00310   case INT:
00311     Fprintf(f,indent,"call int2db(%s,stk(%s),-1,stk(lrs),-1)\n",
00312             str1,str);
00313     break;
00314   case DOUBLE:
00315     Fprintf(f,indent,"call dcopy(%s,stk(%s),1,stk(lrs),1)\n",
00316             str1,str);
00317     break;
00318   case REAL:
00319     Fprintf(f,indent,"call rea2db(%s,stk(%s),-1,stk(lrs),-1)\n",
00320             str1,str);
00321     break;
00322   }
00323 }

Here is the call graph for this function:

void OutROW ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 29 of file out-e.c.

References AddDeclare1(), DEC_INT, Forname2Int(), OutCommon(), str1, str2, var, and variables.

00030 {
00031   strcpy(str1,"un");
00032   AddDeclare1(DEC_INT,"un=1");
00033   strcpy(str2,Forname2Int(variables[var->el[0]-1],0));
00034   OutCommon(f,var,insidelist,nel);
00035 }

Here is the call graph for this function:

void OutSCALAR ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 52 of file out-e.c.

References AddDeclare1(), DEC_INT, OutCommon(), str1, str2, and var.

00053 {
00054   strcpy(str1,"un");
00055   strcpy(str2,"un");
00056   AddDeclare1(DEC_INT,"un=1");
00057   OutCommon(f,var,insidelist,nel);
00058 }

Here is the call graph for this function:

void OutSPARSE ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 213 of file out-e.c.

References Forname2Int(), Fprintf(), GetExistOutVar(), i1, icre, indent, var::stack_position, str1, str2, str5, var, and variables.

00214 {
00215   int i1= var->stack_position;
00216   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00217   strcpy(str2,Forname2Int(variables[var->el[1]-1],0));
00218   if (var->list_el ==0 )
00219     {
00220       sprintf(str5,"%d",i1);
00221     }
00222   else
00223     {
00224       sprintf(str5,"%de%d",i1,var->list_el);
00225     }
00226   if ( insidelist != 0)
00227     {
00229       int iout = GetExistOutVar();
00230       VARPTR vout = variables[iout -1];
00231       Fprintf(f,indent,"CreateListVarFromPtr(%d,%d,\"s\",&%s,&%s,&S%s);\n",
00232               vout->stack_position,nel,str1,str2,str5);
00233     }
00234   else
00235     {
00236       /* var is not outputed inside a list but var can be a list 
00237          element */
00238       if ( var->list_el != 0) 
00239         {
00240           Fprintf(f,indent,"CreateVarFromPtr(%d,\"s\",&%s,&%s,&S%s);\n",
00241                   icre,str1,str2,str5);
00242           Fprintf(f,indent,"LhsVar(%d)=%d;\n",var->out_position,icre);
00243           icre++;
00244         }
00245     }
00246 }

Here is the call graph for this function:

void OutSTRING ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 107 of file out-e.c.

References AddDeclare1(), DEC_INT, Forname2Int(), OutCommon(), str1, str2, var, and variables.

00108 {
00109   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00110   AddDeclare1(DEC_INT,"n%d",var->stack_position);
00111   sprintf(str2,"&n%d",var->stack_position);
00112   OutCommon(f,var,insidelist,nel);
00113 }

Here is the call graph for this function:

void OutSTRINGMAT ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 339 of file out-e.c.

References Forname2Int(), Fprintf(), GetExistOutVar(), icre, indent, var::stack_position, str, str1, str2, var, and variables.

00340 {
00341   strcpy(str1,Forname2Int(variables[var->el[0]-1],0));
00342   strcpy(str2,Forname2Int(variables[var->el[1]-1],0));
00343   sprintf(str,"lr%d",var->stack_position);
00344   if ( insidelist != 0)
00345     {
00346       int iout = GetExistOutVar();
00347       VARPTR vout = variables[iout -1];
00348       Fprintf(f,indent,"CreateListVarFromPtr(%d,%d,\"S\",&%s,&%s,Str%d);\n",
00349               vout->stack_position,nel,
00350               (str1[0] == '&' ) ? str1+1: str1,
00351               (str2[0] == '&' ) ? str2+1: str2,
00352               var->stack_position);
00353     }
00354   else
00355     {
00356       Fprintf(f,indent,"CreateVarFromPtr(%d, \"S\",&%s,&%s,Str%d);\n",
00357               icre,
00358               (str1[0] == '&' ) ? str1+1: str1,
00359               (str2[0] == '&' ) ? str2+1: str2,
00360               var->stack_position);
00361       Fprintf(f,indent,"FreeRhsSVar(Str%d);\n",var->stack_position);
00362       icre++;
00363     }
00364 }

Here is the call graph for this function:

void OutVECTOR ( FILE *  f,
VARPTR  var,
int  insidelist,
int  nel 
)

Definition at line 37 of file out-e.c.

References AddDeclare1(), DEC_INT, Forname2Int(), OutCommon(), str1, str2, var, and variables.

00038 {
00039   strcpy(str1,"un");
00040   AddDeclare1(DEC_INT,"un=1");
00041   strcpy(str2,Forname2Int(variables[var->el[0]-1],0));
00042   OutCommon(f,var,insidelist,nel);
00043 }

Here is the call graph for this function:

void WriteVariableOutput ( FILE *  f,
VARPTR  var,
int  convert,
int  insidelist,
int  nel 
)

Definition at line 418 of file out-e.c.

References OUTRHSTAB, str, strc, strit, strR, and var.

00419 {
00420   if ( var->list_name != (char *) 0 ) 
00421     {
00422       /* variable is a list member */
00423       int nel1= var->list_el;
00424       sprintf(strR,"%de%d",var->stack_position,nel1);
00425       sprintf(str,"lr%de%d",var->stack_position,nel1);
00426       sprintf(strc,"lc%de%d",var->stack_position,nel1);
00427       sprintf(strit,"it%de%d",var->stack_position,nel1);
00428     }
00429   else 
00430     {
00431       sprintf(strR,"%d",var->stack_position);
00432       sprintf(str,"lr%d",var->stack_position);
00433       sprintf(strc,"lc%d",var->stack_position);
00434       sprintf(strit,"it%d",var->stack_position);
00435     }
00436   (*(OUTRHSTAB[var->type].fonc))(f,var,insidelist,nel);
00437 }


Variable Documentation

int icre

Definition at line 15 of file intersci-n.c.

int indent

Definition at line 36 of file niceprintf.c.

OutRhsTab OUTRHSTAB[]

Initial value:

 {
  {DIMFOREXT,OutANY},
  {COLUMN,OutCOLUMN},
  {LIST,OutLIST},
  {TLIST,OutANY},
  {MATRIX,OutMATRIX},
  {POLYNOM,OutPOLYNOM},
  {ROW,OutROW},
  {SCALAR,OutSCALAR},
  {SEQUENCE,OutANY},
  {STRING,OutSTRING},
  {WORK,OutVECTOR},
  {EMPTY,OutANY},
  {ANY,OutANY},
  {VECTOR,OutVECTOR},
  {STRINGMAT,OutSTRINGMAT},
  {SCIMPOINTER,OutPOINTER},
  {IMATRIX,OutIMATRIX},
  {SCISMPOINTER,OutPOINTER},
  {SCILPOINTER,OutPOINTER},
  {BMATRIX,OutBMATRIX},
  {SCIBPOINTER,OutPOINTER},
  {SCIOPOINTER,OutPOINTER},
  {SPARSE,OutSPARSE}
}

Definition at line 383 of file out-e.c.

Referenced by WriteVariableOutput().

int pass

Definition at line 17 of file intersci-n.c.

char str[MAXNAM] [static]

Definition at line 11 of file out-e.c.

char str1[MAXNAM] [static]

Definition at line 12 of file out-e.c.

char str2[MAXNAM] [static]

Definition at line 13 of file out-e.c.

char str3[MAXNAM] [static]

Definition at line 14 of file out-e.c.

char str4[MAXNAM] [static]

Definition at line 15 of file out-e.c.

char str5[MAXNAM] [static]

Definition at line 16 of file out-e.c.

Referenced by OutIMATRIX(), and OutSPARSE().

char strc[MAXNAM] [static]

Definition at line 18 of file out-e.c.

Referenced by WriteVariableOutput().

char strit[MAXNAM] [static]

Definition at line 19 of file out-e.c.

Referenced by WriteVariableOutput().

char strR[MAXNAM] [static]

Definition at line 17 of file out-e.c.

Referenced by WriteVariableOutput().


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