Ejemplo n.º 1
0
void F90_FunctionBegin( int f, ... )
{
Va_list args;
int i;
int v;
int vars[20];
char * name;
int narg;
FILE *oldf;

  name = varTable[ f ]->name;
  narg = varTable[ f ]->maxi;
    
  Va_start( args, f );
  for( i = 0; i < narg; i++ ) 
    vars[ i ] = va_arg( args, int );
  va_end( args );
    
  CommentFncBegin( f, vars );
  F90_FunctionStart( f, vars );
  NewLines(1);
 /*  bprintf("  USE %s_Precision\n", rootFileName );
  bprintf("  USE %s_Parameters\n\n", rootFileName ); */
 /*  bprintf("      IMPLICIT NONE\n" ); */

  FlushBuf();

  for( i = 0; i < narg; i++ ) 
    F90_Declare( vars[ i ] );

  bprintf("\n");
  FlushBuf();

  MapFunctionComment( f, vars );
}
Ejemplo n.º 2
0
void MATLAB_FunctionBegin( int f, ... )
{
    Va_list args;
    int i;
    int v;
    int vars[20];
    char * name;
    int narg;
    FILE *oldf;
    char buf[200], bufname[200];
    time_t t;

    name = varTable[ f ]->name;
    narg = varTable[ f ]->maxi;

    /*Adi - each Matlab functin requires a separate file*/
    sprintf( buf, "%s_%s.m", rootFileName, varTable[ f ]->name );
    mex_funFile = fopen(buf, "w");
    if( mex_funFile == 0 ) {
        FatalError(3,"%s: Can't create file", buf );
    }
    UseFile( mex_funFile );
    /*Adi*/


    Va_start( args, f );
    for( i = 0; i < narg; i++ )
        vars[ i ] = va_arg( args, int );
    va_end( args );

    CommentFncBegin( f, vars );

    WriteDelim();
    WriteComment("");
    WriteComment("Generated by KPP - symbolic chemistry Kinetics PreProcessor" );
    WriteComment("    KPP is developed at CGRER labs University of Iowa by" );
    WriteComment("    Valeriu Damian & Adrian Sandu" );
    WriteComment("");
    WriteComment("%-20s : %s", "File", buf  );
    strcpy( buf, (char*)ctime( &t ) );
    buf[ (int)strlen(buf) - 1 ] = 0;
    WriteComment("%-20s : %s", "Time", buf );
    WriteComment("%-20s : %s", "Working directory", getcwd(buf, 200) );
    WriteComment("%-20s : %s", "Equation file", eqFileName );
    WriteComment("%-20s : %s", "Output root filename", rootFileName );
    WriteComment("");
    WriteDelim();
    NewLines(1);

    MATLAB_FunctionStart( f, vars );
    NewLines(1);

    FlushBuf();

    MapFunctionComment( f, vars );
}