diff --git a/chem/KPP/kpp/kpp-2.1/src/code.c b/chem/KPP/kpp/kpp-2.1/src/code.c index a628eabb5a..cc3ca9684a 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code.c +++ b/chem/KPP/kpp/kpp-2.1/src/code.c @@ -32,6 +32,7 @@ #include "gdata.h" #include "code.h" +#include "scan.h" #include #include #include @@ -98,7 +99,6 @@ FILE * mex_jacFile = 0; FILE * mex_hessFile = 0; FILE * wrf_UpdateRconstFile = 0; - FILE * currentFile; int ident = 0; @@ -193,7 +193,7 @@ char *p; p = outBuf; while( *p ) *p++ &= ~0x80; - fprintf( currentFile, outBuf ); + fprintf( currentFile, "%s", outBuf ); outBuffer = outBuf; *outBuffer = 0; } @@ -205,7 +205,7 @@ char *p; p = buf; while( *p ) *p++ &= ~0x80; - fprintf( currentFile, buf ); + fprintf( currentFile, "%s", buf ); } void WriteDelim() diff --git a/chem/KPP/kpp/kpp-2.1/src/code.h b/chem/KPP/kpp/kpp-2.1/src/code.h index a40de2de3f..964637c01b 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code.h +++ b/chem/KPP/kpp/kpp-2.1/src/code.h @@ -34,6 +34,7 @@ #define _CODE_H_ #include +#include #include "gdef.h" #define MAX_DEPTH 10 @@ -167,10 +168,10 @@ void CommentFncBegin( int f, int *vars ); void CommentFunctionBegin( int f, ... ); void CommentFunctionEnd( int f ); -void Use_C(); -void Use_F(); -void Use_F90(); -void Use_MATLAB(); +void Use_C( char *rootFileName ); +void Use_F( char *rootFileName ); +void Use_F90( char *rootFileName ); +void Use_MATLAB( char *rootFileName ); extern void (*WriteElm)( NODE *n ); extern void (*WriteSymbol)( int op ); @@ -188,4 +189,14 @@ extern void (*FunctionEnd)( int f ); void WriteDelim(); +/* >>> CL: code_matlab.c */ +extern void MATLAB_Inline( char *fmt, ... ); +/* >>> CL: code_F90.c */ +extern void F90_Inline( char *fmt, ... ); +/* >>> CL: code_F77.c */ +extern void F77_Inline( char *fmt, ... ); +/* >>> CL: gen.c */ +extern int EqnString( int eq, char * buf ); +/* <<< CL */ + #endif diff --git a/chem/KPP/kpp/kpp-2.1/src/code_c.c b/chem/KPP/kpp/kpp-2.1/src/code_c.c index 64deef20a3..ee9b1d0356 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code_c.c +++ b/chem/KPP/kpp/kpp-2.1/src/code_c.c @@ -32,6 +32,7 @@ #include "gdata.h" #include "code.h" +#include "scan.h" #include #define MAX_LINE 120 @@ -366,7 +367,7 @@ char dummy_val[100]; /* used just to avoid strange behaviour of case CONST: bprintf("#define %-20s %-10s ", var->name, val ); break; default: - printf( "Invalid constant", var->type ); + printf( "Invalid constant %d", var->type ); break; } if( varTable[ v ]->comment ) @@ -484,7 +485,7 @@ char buf[ 1000 ]; FlushBuf(); } -void Use_C() +void Use_C( char *rootFileName ) { WriteElm = C_WriteElm; WriteSymbol = C_WriteSymbol; diff --git a/chem/KPP/kpp/kpp-2.1/src/code_f77.c b/chem/KPP/kpp/kpp-2.1/src/code_f77.c index ce8b1e5fe7..e1f4de6921 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code_f77.c +++ b/chem/KPP/kpp/kpp-2.1/src/code_f77.c @@ -529,7 +529,7 @@ char buf[ 1000 ]; } /*************************************************************************************************/ -void Use_F() +void Use_F( char *rootFileName ) { WriteElm = F77_WriteElm; WriteSymbol = F77_WriteSymbol; diff --git a/chem/KPP/kpp/kpp-2.1/src/code_f90.c b/chem/KPP/kpp/kpp-2.1/src/code_f90.c index 5bd7ec6ea9..47a7673eaa 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code_f90.c +++ b/chem/KPP/kpp/kpp-2.1/src/code_f90.c @@ -699,7 +699,7 @@ char buf[ 1000 ]; } /*************************************************************************************************/ -void Use_F90() +void Use_F90( char *rootFileName ) { WriteElm = F90_WriteElm; WriteSymbol = F90_WriteSymbol; diff --git a/chem/KPP/kpp/kpp-2.1/src/code_matlab.c b/chem/KPP/kpp/kpp-2.1/src/code_matlab.c index 9b99b869c4..f9b5ab71ab 100755 --- a/chem/KPP/kpp/kpp-2.1/src/code_matlab.c +++ b/chem/KPP/kpp/kpp-2.1/src/code_matlab.c @@ -32,6 +32,7 @@ #include "gdata.h" #include "code.h" +#include "scan.h" #include #include @@ -673,7 +674,7 @@ char buf[ 1000 ]; } /*************************************************************************************************/ -void Use_MATLAB() +void Use_MATLAB( char *rootFileName ) { WriteElm = MATLAB_WriteElm; WriteSymbol = MATLAB_WriteSymbol; diff --git a/chem/KPP/kpp/kpp-2.1/src/gdata.h b/chem/KPP/kpp/kpp-2.1/src/gdata.h index a9dbf1af73..3e54c689ac 100755 --- a/chem/KPP/kpp/kpp-2.1/src/gdata.h +++ b/chem/KPP/kpp/kpp-2.1/src/gdata.h @@ -36,9 +36,9 @@ #include -#define MAX_EQN 1200 /* mz_rs_20050130 */ -#define MAX_SPECIES 500 /* mz_rs_20050130 */ -#define MAX_SPNAME 30 +#define MAX_EQN 50000 /* 1200 *//* CL *//* mz_rs_20050130 */ +#define MAX_SPECIES 10000 /* 500 *//* CL *//* mz_rs_20050130 */ +#define MAX_SPNAME 50 /* 30 *//* CL */ #define MAX_IVAL 40 /* MAX_EQNTAG = max length of equation ID in eqn file */ #define MAX_EQNTAG 32 @@ -196,7 +196,7 @@ void CmdDriver( char *cmd ); void CmdRun( char *cmd ); void CmdStochastic( char *cmd ); -void Generate(); +void Generate( char *rootFileName ); char * FileName( char *name, char* env, char *dir, char *ext ); diff --git a/chem/KPP/kpp/kpp-2.1/src/gen.c b/chem/KPP/kpp/kpp-2.1/src/gen.c index e80e685e43..986138418a 100755 --- a/chem/KPP/kpp/kpp-2.1/src/gen.c +++ b/chem/KPP/kpp/kpp-2.1/src/gen.c @@ -30,6 +30,8 @@ ******************************************************************************/ +#include +#include #include "gdata.h" #include "code.h" #include "scan.h" @@ -610,11 +612,12 @@ char buf1[100], buf2[100]; if( VarNr == 0 ) return; if (useLang != MATLAB_LANG) /* Matlab generates an additional file per function */ - - if ( useWRFConform ) - UseFile( integratorFile ); - else - UseFile( functionFile ); + { + if ( useWRFConform ){ + UseFile( integratorFile );} + else{ + UseFile( functionFile ); } + } if ( useWRFConform ) { @@ -756,11 +759,12 @@ char buf1[100], buf2[100]; if( VarNr == 0 ) return; if (useLang != MATLAB_LANG) /* Matlab generates an additional file per function */ - - if ( useWRFConform ) - UseFile( integratorFile ); - else - UseFile( functionFile ); + { + if ( useWRFConform ) { + UseFile( integratorFile ); } + else { + UseFile( functionFile ); } + } if ( useWRFConform ) { @@ -1099,12 +1103,14 @@ char buf1[100], buf2[100]; if (useJacobian == JAC_OFF) return; if (useLang != MATLAB_LANG) /* Matlab generates an additional file per function */ + { + + if ( useWRFConform ){ + UseFile( integratorFile );} + else { + UseFile( jacobianFile );} + } - if ( useWRFConform ) - UseFile( integratorFile ); - else - UseFile( jacobianFile ); - if ( useWRFConform ){ sprintf( buf1, "%s_Jac_SP", rootFileName ); Jac_SP = DefFnc( buf1, 4, @@ -1932,7 +1938,7 @@ char buf1[100]; sprintf( buf1, "%s_KppSolve", rootFileName ); }else{ UseFile( linalgFile ); - sprintf( buf1, "KppSolve", rootFileName ); + sprintf( buf1, "%s_KppSolve", rootFileName ); } SOLVE = DefFnc( buf1, 2, "sparse back substitution"); @@ -2165,7 +2171,7 @@ int UPDATE_RCONST; F77_Inline(" INCLUDE '%s_Global.h'", rootFileName); MATLAB_Inline("global SUN TEMP RCONST"); - if ( (useLang==F77_LANG) ) + if ( useLang==F77_LANG ) IncludeCode( "%s/util/UserRateLaws_FcnHeader", Home ); NewLines(1); @@ -3380,14 +3386,14 @@ case 't': break; default: - printf("\n Unrecognized option '%s' in GenerateF90Modules\n", where); + printf("\n Unrecognized option '%c' in GenerateF90Modules\n", where); break; } } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -void Generate() +void Generate( char *rootFileName ) { int i, j; int n; @@ -3414,7 +3420,7 @@ int n; break; case MATLAB_LANG: Use_MATLAB( rootFileName ); break; - default: printf("\n Language no '%s' unknown\n",useLang ); + default: printf("\n Language no '%d' unknown\n",useLang ); } printf("\nKPP is initializing the code generation."); InitGen(); diff --git a/chem/KPP/kpp/kpp-2.1/src/gen_org.c b/chem/KPP/kpp/kpp-2.1/src/gen_org.c index aef1585162..5b6338fdde 100755 --- a/chem/KPP/kpp/kpp-2.1/src/gen_org.c +++ b/chem/KPP/kpp/kpp-2.1/src/gen_org.c @@ -3075,7 +3075,7 @@ case 't': /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -void Generate() +void Generate( char *rootFileName ) { int i, j; int n; diff --git a/chem/KPP/kpp/kpp-2.1/src/kpp.c b/chem/KPP/kpp/kpp-2.1/src/kpp.c index 22d2fd68df..4343a4e51b 100755 --- a/chem/KPP/kpp/kpp-2.1/src/kpp.c +++ b/chem/KPP/kpp/kpp-2.1/src/kpp.c @@ -457,7 +457,7 @@ for (i=0; i +#include #include "gdef.h" /* mz_rs_20050518+ value increased */ -#define MAX_INLINE 30000 +#define MAX_INLINE 50000 /* 30000 *//* CL further increased */ /* #define MAX_INLINE 4000 */ /* mz_rs_20050518- */ @@ -97,7 +98,7 @@ void WriteSpecies(); void WriteMatrices(); void WriteOptions(); -void yyerror() ; +void yyerror( char * str ) ; void ParserErrorMessage() ; char * AppendString( char * s1, char * s2, int * len, int addlen ); @@ -107,4 +108,28 @@ void AddInlineCode( char * context, char * code ); int yyerrflag ; #endif +/* >>> CL: scanner.c */ +extern void CmdStoicmat( char *cmd ); +extern void CheckAll(); +extern void LookAtAll(); +extern void TransportAll(); +extern void DefineInitializeNbr( char *cmd ); +extern void DefineXGrid( char *cmd ); +extern void DefineYGrid( char *cmd ); +extern void DefineZGrid( char *cmd ); +extern void SparseData( char *cmd ); +extern void AddUseFile( char *fname ); +extern void WRFConform(); +extern int ParseEquationFile( char * filename ); + +/* >>> CL: scan.l */ +extern int EqNoCase( char *s1, char *s2 ); + +/* >>> CL: scan.y */ +extern int yylex(void); +/* <<< CL */ + +/* <<< CL */ + + #endif diff --git a/chem/KPP/kpp/kpp-2.1/src/scan.l b/chem/KPP/kpp/kpp-2.1/src/scan.l index 84a74e2ff8..b8ae115ed3 100755 --- a/chem/KPP/kpp/kpp-2.1/src/scan.l +++ b/chem/KPP/kpp/kpp-2.1/src/scan.l @@ -30,7 +30,6 @@ ******************************************************************************/ - %s CMD_STATE INC_STATE MOD_STATE INT_STATE %s PRM_STATE DSP_STATE SSP_STATE INI_STATE EQN_STATE EQNTAG_STATE %s RATE_STATE LMP_STATE CR_IGNORE SC_IGNORE ATM_STATE LKT_STATE INL_STATE @@ -43,7 +42,6 @@ #include "scan.h" #include "y.tab.h" - void*malloc() ; void Include ( char * filename ); int EndInclude(); diff --git a/chem/KPP/kpp/kpp-2.1/src/scan.y b/chem/KPP/kpp/kpp-2.1/src/scan.y index 0ff3ae3d5c..7810ab08f5 100755 --- a/chem/KPP/kpp/kpp-2.1/src/scan.y +++ b/chem/KPP/kpp/kpp-2.1/src/scan.y @@ -38,6 +38,7 @@ #include #include #include "scan.h" + #include "gdata.h" #define __YYSCLASS @@ -45,7 +46,7 @@ extern char yytext[]; extern FILE * yyin; /* extern int yyerrstatus; */ - + int nError = 0; int nWarning = 0; @@ -65,7 +66,7 @@ %} %union{ - char str[80]; + char str[500]; }; %token JACOBIAN DOUBLE FUNCTION DEFVAR DEFRAD DEFFIX SETVAR SETRAD SETFIX diff --git a/chem/KPP/util/wkc/Makefile b/chem/KPP/util/wkc/Makefile index 86954eb2a3..92e44f5c83 100644 --- a/chem/KPP/util/wkc/Makefile +++ b/chem/KPP/util/wkc/Makefile @@ -6,7 +6,7 @@ include ../../configure.kpp CFLAGS = #-ansi LDFLAGS = -DEBUG = -g +DEBUG = -O0 -g OBJ = registry_kpp.o my_strtok.o data.o type.o misc.o reg_parse.o \ gen_kpp.o get_wrf_chem_specs.o gen_kpp_mech_dr.o gen_kpp_interface.o \ get_kpp_chem_specs.o compare_kpp_to_species.o get_wrf_radicals.o \ diff --git a/chem/KPP/util/wkc/change_chem_Makefile.c b/chem/KPP/util/wkc/change_chem_Makefile.c index cf3226b58a..1b2676cb7c 100644 --- a/chem/KPP/util/wkc/change_chem_Makefile.c +++ b/chem/KPP/util/wkc/change_chem_Makefile.c @@ -1,4 +1,6 @@ #include +#include +#include #include "protos.h" @@ -8,7 +10,7 @@ -int +void change_chem_Makefile ( ) { knode_t * p1, * p2, * pm1; @@ -45,7 +47,7 @@ knode_t * p1, * p2, * pm1; while ( fgets ( inln , NAMELEN , ch_Makefile ) != NULL ){ /* printf("%s ", inln ); */ - fprintf(t_Makefile, inln); + fprintf(t_Makefile, "%s", inln); /* if ( strncmp(inln, "MODULES",6) == 0){ */ diff --git a/chem/KPP/util/wkc/compare_kpp_to_species.c b/chem/KPP/util/wkc/compare_kpp_to_species.c index 8a6151148c..bd492327f1 100644 --- a/chem/KPP/util/wkc/compare_kpp_to_species.c +++ b/chem/KPP/util/wkc/compare_kpp_to_species.c @@ -72,7 +72,7 @@ compare_kpp_to_species ( char * kpp_dirname) for ( p1 = KPP_packs ; p1 != NULL ; p1 = p1->next ) { p2 = p1->assoc_wrf_pack; - printf(" ... testing %s %s\n",p1, p2 ); + printf(" ... testing %s %s\n",p1->name, p2->name ); if ( p2 ) { fprintf(stderr, "\n \n FOUND match between WRF-Chem/KPP for mechanism: %s \n", p2->name); diff --git a/chem/KPP/util/wkc/gen_kpp.c b/chem/KPP/util/wkc/gen_kpp.c index 85346c0f59..63dcd2f853 100644 --- a/chem/KPP/util/wkc/gen_kpp.c +++ b/chem/KPP/util/wkc/gen_kpp.c @@ -62,102 +62,7 @@ in ~WRF: chem/KPP/util/wkc/registry_kpp Registry/Registry */ -int -gen_kpp ( char * inc_dirname, char * kpp_dirname ) -{ - - - - /* put chem compound names defined in Registry into linked list WRFC_packs */ - - if ( DEBUGR == 1 ) printf("next: get_wrf_chem_specs \n"); - get_wrf_chem_specs () ; - if ( DEBUGR == 2 ) write_list_to_screen( WRFC_packs ) ; - - - - - /* put radical names defined in Registry into linked list WRFC_radicals */ - - if ( DEBUGR == 1 ) printf("next: get_wrf_radicals \n"); - get_wrf_radicals () ; - if ( DEBUGR == 2 ) write_list_to_screen( WRFC_radicals ) ; - - - /* put photolysis rates defined in Registry into linked list WRFC_jvals */ - - if ( DEBUGR == 1 ) printf("next: get_wrf_jvals \n"); - get_wrf_jvals () ; - if ( DEBUGR == 2 ) write_list_to_screen( WRFC_jvals ) ; - - - /* read KPP species files and put compound names into linked list KPP_packs */ - if ( DEBUGR == 1 ) printf("next: get_kpp_chem_specs \n"); - get_kpp_chem_specs ( kpp_dirname ) ; - if ( DEBUGR == 2 ) {write_list_to_screen( KPP_packs ) ;} - - - - - - /* define pointer from each KPP package to corresponding WRF-Chem chemistry package and check whether variable names are consistent. If *_wrfkpp.equiv file exists in KPP directory use it for name matching */ - - - if ( DEBUGR == 1 ) printf("next: compare_kpp_to_species \n"); - compare_kpp_to_species ( kpp_dirname ); - - - - - - /* write some output to screen */ - if ( DEBUGR == 1 ) printf("next: screen_out \n"); - screen_out( ); - - - /* make sure that wrf and kpp variables match and stop if not. */ - if ( DEBUGR == 1 ) printf("next: check_all \n"); - check_all ( kpp_dirname ); - - - - /* add the kpp generated modules to the Makefile in the chem directory */ - if ( DEBUGR == 1 ) printf("next: change_chem_Makefile \n"); - change_chem_Makefile ( ); - - - - - /* write the mechanism driver */ - if ( DEBUGR == 1 ) printf("next: gen_kpp_mechanism_driver (writing chem/kpp_mechanism_driver.F) \n"); - gen_kpp_mechanism_driver ( ); - - - if ( DEBUGR == 1 ) printf("next: gen_call_to_kpp_mechanism_driver (writing inc/call_to_kpp_mech_drive.inc) \n"); - gen_kpp_call_to_mech_dr ( ); - - - /* write arguments for call to KPPs Update_Rconst */ - if ( DEBUGR == 1 ) printf("next: gen_kpp_args_to_Update_Rconst (writing inc/args_to_update_rconst.inc and inc/ +#include +#include #include "protos.h" @@ -6,7 +8,7 @@ #include "kpp_data.h" -int +void decl_misc ( FILE * ofile ) { @@ -42,7 +44,7 @@ decl_misc ( FILE * ofile ) fprintf(ofile," \n\n\n\n "); } -int +void decl_jv ( FILE * ofile ) { int n; @@ -73,7 +75,7 @@ count_members( knode_t * nl ) -int +void decl_jv_pointers ( FILE * ofile ) { knode_t * pl; @@ -103,7 +105,7 @@ decl_jv_pointers ( FILE * ofile ) } -int +void gen_map_jval ( FILE * ofile ) { knode_t * pl; @@ -126,8 +128,7 @@ gen_map_jval ( FILE * ofile ) - -int +void gen_map_wrf_to_kpp ( FILE * ofile, knode_t * nl ) { knode_t * pml; @@ -154,7 +155,7 @@ gen_map_wrf_to_kpp ( FILE * ofile, knode_t * nl ) -int +void gen_map_kpp_to_wrf ( FILE * ofile, knode_t * nl ) { knode_t * pml; @@ -180,7 +181,7 @@ gen_map_kpp_to_wrf ( FILE * ofile, knode_t * nl ) } -int +void gen_kpp_pargs( FILE * ofile, knode_t * nl ) { knode_t * pml; @@ -217,7 +218,7 @@ gen_kpp_pargs( FILE * ofile, knode_t * nl ) } -int +void gen_kpp_pdecl( FILE * ofile, knode_t * nl ) { knode_t * pml; @@ -255,7 +256,7 @@ gen_kpp_pdecl( FILE * ofile, knode_t * nl ) } -int +void wki_start_loop( FILE * ofile ) { @@ -264,7 +265,7 @@ wki_start_loop( FILE * ofile ) fprintf(ofile," DO i=its, ite\n\n\n"); } -int +void wki_end_loop( FILE * ofile ) { @@ -274,7 +275,7 @@ wki_end_loop( FILE * ofile ) } -int +void wki_prelim( FILE * ofile ) { @@ -303,7 +304,7 @@ wki_prelim( FILE * ofile ) } -int +void wki_one_d_vars( FILE * ofile, knode_t * pp ) { diff --git a/chem/KPP/util/wkc/gen_kpp_interface.c b/chem/KPP/util/wkc/gen_kpp_interface.c index 03abb61679..46ac0a978d 100644 --- a/chem/KPP/util/wkc/gen_kpp_interface.c +++ b/chem/KPP/util/wkc/gen_kpp_interface.c @@ -1,4 +1,5 @@ #include +#include #include "protos.h" @@ -7,7 +8,7 @@ -int +void gen_kpp_interface ( ) { knode_t * p1, * p2, * pm1; diff --git a/chem/KPP/util/wkc/gen_kpp_mech_dr.c b/chem/KPP/util/wkc/gen_kpp_mech_dr.c index da1d7ab39c..8b0140c1e7 100644 --- a/chem/KPP/util/wkc/gen_kpp_mech_dr.c +++ b/chem/KPP/util/wkc/gen_kpp_mech_dr.c @@ -1,5 +1,6 @@ #include +#include #include "protos.h" @@ -9,7 +10,7 @@ /*---------------------------------------------------------------------*/ -int +void gen_kpp_mechanism_driver ( ) { knode_t * p1, * p2, * p3, * p4, * pm1, * pm3, * pm4; @@ -112,7 +113,7 @@ knode_t * p1, * p2, * p3, * p4, * pm1, * pm3, * pm4; -int +void gen_kpp_call_to_mech_dr ( ) { knode_t * p1, * p2, * p3, * p4, * pm1, * pm3, * pm4; diff --git a/chem/KPP/util/wkc/gen_kpp_utils.c b/chem/KPP/util/wkc/gen_kpp_utils.c index 52343f0a40..26afa0bebb 100644 --- a/chem/KPP/util/wkc/gen_kpp_utils.c +++ b/chem/KPP/util/wkc/gen_kpp_utils.c @@ -6,7 +6,7 @@ #include "kpp_data.h" -int gen_kpp_warning( FILE * ofile, char * gen_by_name, char*cchar ) +void gen_kpp_warning( FILE * ofile, char * gen_by_name, char*cchar ) { fprintf(ofile, "%s \n", cchar); fprintf(ofile, "%s THIS FILE WAS AUTOMATICALLY GENERATED BY \n%s\n",cchar,cchar ); @@ -17,8 +17,7 @@ int gen_kpp_warning( FILE * ofile, char * gen_by_name, char*cchar ) -int -gen_kpp_pass_down ( FILE * ofile, int is_driver ) +void gen_kpp_pass_down ( FILE * ofile, int is_driver ) { fprintf(ofile,"!\n"); @@ -39,8 +38,7 @@ gen_kpp_pass_down ( FILE * ofile, int is_driver ) } -int -gen_kpp_decl ( FILE * ofile, int is_driver ) +void gen_kpp_decl ( FILE * ofile, int is_driver ) { /* declare dimensions */ gen_kpp_decld ( ofile, is_driver ); @@ -71,7 +69,7 @@ gen_kpp_decl ( FILE * ofile, int is_driver ) } -int gen_kpp_argl( FILE * ofile, knode_t * nl ) +void gen_kpp_argl( FILE * ofile, knode_t * nl ) { knode_t * pml; int countit; @@ -98,7 +96,7 @@ int gen_kpp_argl( FILE * ofile, knode_t * nl ) -int gen_kpp_argl_new( FILE * ofile, knode_t * nl ) +void gen_kpp_argl_new( FILE * ofile, knode_t * nl ) { knode_t * pml; int countit; @@ -127,7 +125,7 @@ int gen_kpp_argl_new( FILE * ofile, knode_t * nl ) -int gen_kpp_argd ( FILE * ofile, int is_driver ) +void gen_kpp_argd ( FILE * ofile, int is_driver ) { fprintf(ofile, " ids,ide, jds,jde, kds,kde, &\n"); fprintf(ofile, " ims,ime, jms,jme, kms,kme, &\n"); @@ -138,7 +136,7 @@ int gen_kpp_argd ( FILE * ofile, int is_driver ) } -int gen_kpp_decld ( FILE * ofile, int is_driver ) +void gen_kpp_decld ( FILE * ofile, int is_driver ) { fprintf(ofile, "\n\n\n INTEGER, INTENT(IN ) :: &\n"); fprintf(ofile, " ids,ide, jds,jde, kds,kde, & \n"); @@ -151,7 +149,7 @@ int gen_kpp_decld ( FILE * ofile, int is_driver ) } } -int gen_kpp_decl3d( FILE * ofile, knode_t * nl ) +void gen_kpp_decl3d( FILE * ofile, knode_t * nl ) { knode_t * pml; int countit; diff --git a/chem/KPP/util/wkc/get_kpp_chem_specs.c b/chem/KPP/util/wkc/get_kpp_chem_specs.c index 318c21970f..6130400a9b 100644 --- a/chem/KPP/util/wkc/get_kpp_chem_specs.c +++ b/chem/KPP/util/wkc/get_kpp_chem_specs.c @@ -39,14 +39,14 @@ int in_comment, got_it; if (!dir) { fprintf(stderr, "WARNING from gen_kpp: Cannot read directory: %s \n", kpp_dirname); perror(""); - return; + return(0); // return; } /* loop through sub directories in KPP directory */ while ((entry = readdir(dir))) { - if (entry->d_name ) { + if ( strlen(entry->d_name) > 0 ) { if ( strcmp(entry->d_name, ".") == 0) continue; diff --git a/chem/KPP/util/wkc/get_wrf_jvals.c b/chem/KPP/util/wkc/get_wrf_jvals.c index 3a0ac0c53b..eb828e5942 100644 --- a/chem/KPP/util/wkc/get_wrf_jvals.c +++ b/chem/KPP/util/wkc/get_wrf_jvals.c @@ -1,4 +1,5 @@ #include +#include #include "protos.h" diff --git a/chem/KPP/util/wkc/get_wrf_radicals.c b/chem/KPP/util/wkc/get_wrf_radicals.c index d7e5e0adfe..a250ba2fbd 100644 --- a/chem/KPP/util/wkc/get_wrf_radicals.c +++ b/chem/KPP/util/wkc/get_wrf_radicals.c @@ -1,4 +1,5 @@ #include +#include #include "protos.h" #include "protos_kpp.h" diff --git a/chem/KPP/util/wkc/kpp_data.c b/chem/KPP/util/wkc/kpp_data.c index 2a779b8f00..b7f0362a4e 100644 --- a/chem/KPP/util/wkc/kpp_data.c +++ b/chem/KPP/util/wkc/kpp_data.c @@ -11,7 +11,7 @@ knode_t * -new_knode ( int * kind ) +new_knode ( ) { knode_t *p ; p = (knode_t *)malloc(sizeof(knode_t)) ; bzero(p,sizeof(knode_t)); return (p) ; } int diff --git a/chem/KPP/util/wkc/protos_kpp.h b/chem/KPP/util/wkc/protos_kpp.h index 12ce92b3f8..e1f6c41b65 100644 --- a/chem/KPP/util/wkc/protos_kpp.h +++ b/chem/KPP/util/wkc/protos_kpp.h @@ -2,7 +2,7 @@ #include "kpp_data.h" /* added for gen_kpp */ -knode_t * new_knode () ; +knode_t * new_knode ( ) ; int add_knode_to_end ( knode_t * node , knode_t ** list ) ; int gen_kpp (char * dirname1, char * dirname2); @@ -18,13 +18,13 @@ int compare_kpp_to_species ( char * kpp_dirname) ; int run_kpp( char * dirname , char * kpp_version ); -int change_chem_Makefile( ); +void change_chem_Makefile( ); -int gen_kpp_mechanism_driver ( ); -int gen_kpp_call_to_mech_dr ( ); -int gen_kpp_args_to_Update_Rconst ( ); -int gen_kpp_interface( ); +void gen_kpp_mechanism_driver ( ); +void gen_kpp_call_to_mech_dr ( ); +void gen_kpp_args_to_Update_Rconst ( ); +void gen_kpp_interface( ); int debug_out( ); @@ -35,30 +35,30 @@ int debug_out( ); /* added gen_kpp utils */ -int gen_kpp_warning( FILE * ofile, char * gen_by_name, char * cchar ); -int gen_kpp_pass_down ( FILE * ofile, int is_driver ); -int gen_kpp_decl ( FILE * ofile, int is_driver ); -int gen_kpp_argl( FILE * ofile , knode_t * nl ); -int gen_kpp_argl_new( FILE * ofile , knode_t * nl ); -int gen_kpp_argd ( FILE * ofile, int is_driver ); -int gen_kpp_decld ( FILE * ofile, int is_driver ); -int gen_kpp_decl3d( FILE * ofile, knode_t * nl ); +void gen_kpp_warning( FILE * ofile, char * gen_by_name, char * cchar ); +void gen_kpp_pass_down ( FILE * ofile, int is_driver ); +void gen_kpp_decl ( FILE * ofile, int is_driver ); +void gen_kpp_argl( FILE * ofile , knode_t * nl ); +void gen_kpp_argl_new( FILE * ofile , knode_t * nl ); +void gen_kpp_argd ( FILE * ofile, int is_driver ); +void gen_kpp_decld ( FILE * ofile, int is_driver ); +void gen_kpp_decl3d( FILE * ofile, knode_t * nl ); /* added gen_kpp_interf utils */ -int decl_misc ( FILE * ofile ); -int decl_jv ( FILE * ofile ); +void decl_misc ( FILE * ofile ); +void decl_jv ( FILE * ofile ); int count_members( knode_t * nl ); -int decl_jv_pointers ( FILE * ofile ); -int decl_kwc_constants ( FILE * ofile ); -int gen_map_jval( FILE * ofile ); -int gen_map_wrf_to_kpp ( FILE * ofile, knode_t * nl ); -int gen_map_kpp_to_wrf ( FILE * ofile, knode_t * nl ); -int gen_kpp_pargs( FILE * ofile, knode_t * nl ); -int gen_kpp_pdecl( FILE * ofile, knode_t * nl ); -int wki_prelim( FILE * ofile ); -int wki_start_loop( FILE * ofile ); -int wki_end_loop( FILE * ofile ); -int wki_one_d_vars ( FILE * ofile, knode_t * pp ); +void decl_jv_pointers ( FILE * ofile ); +void decl_kwc_constants ( FILE * ofile ); +void gen_map_jval( FILE * ofile ); +void gen_map_wrf_to_kpp ( FILE * ofile, knode_t * nl ); +void gen_map_kpp_to_wrf ( FILE * ofile, knode_t * nl ); +void gen_kpp_pargs( FILE * ofile, knode_t * nl ); +void gen_kpp_pdecl( FILE * ofile, knode_t * nl ); +void wki_prelim( FILE * ofile ); +void wki_start_loop( FILE * ofile ); +void wki_end_loop( FILE * ofile ); +void wki_one_d_vars ( FILE * ofile, knode_t * pp ); #define PROTOS_H_KPP #endif diff --git a/chem/KPP/util/wkc/registry_kpp.c b/chem/KPP/util/wkc/registry_kpp.c index c9b6b60ec4..ec78bac6d7 100644 --- a/chem/KPP/util/wkc/registry_kpp.c +++ b/chem/KPP/util/wkc/registry_kpp.c @@ -13,7 +13,7 @@ #include "data.h" #include "sym.h" -main( int argc, char *argv[], char *env[] ) +int main( int argc, char *argv[], char *env[] ) { char fname_in[NAMELEN], dir[NAMELEN], fname_tmp[NAMELEN], command[NAMELEN] ; FILE * fp_in, *fp_tmp ; diff --git a/chem/KPP/util/write_decomp/integr_edit.c b/chem/KPP/util/write_decomp/integr_edit.c index 756e04d135..82faae53c4 100644 --- a/chem/KPP/util/write_decomp/integr_edit.c +++ b/chem/KPP/util/write_decomp/integr_edit.c @@ -1,5 +1,6 @@ #include #include +#include #define NAMELEN 4096 @@ -7,6 +8,7 @@ /* replace decomp routine in KPP Integr file */ +int main( int argc, char *argv[] ) { diff --git a/compile b/compile index 0595d05db1..3b96dc6403 100755 --- a/compile +++ b/compile @@ -407,15 +407,17 @@ else echo " " uname -a echo " " - set comp = ( `grep "^SFC" configure.wrf | cut -d"=" -f2-` ) - if ( "$comp[1]" == "gfortran" ) then - gfortran --version - else if ( "$comp[1]" == "pgf90" ) then - pgf90 --version - else if ( "$comp[1]" == "ifort" ) then - ifort -V + set comp = ( `grep "^SFC" configure.wrf | cut -d"#" -f1 | cut -d"=" -f2-` ) + $comp[1] -V >& /dev/null + if ( $status == 0 ) then + $comp[1] --version else - echo "Not sure how to figure out the version of this compiler: $comp[1]" + $comp[1] --version >& /dev/null + if ( $status == 0 ) then + $comp[1] -V + else + echo "Not sure how to figure out the version of this compiler: $comp[1]" + endif endif echo " " echo "============================================================================================== " diff --git a/external/RSL_LITE/rsl_bcast.c b/external/RSL_LITE/rsl_bcast.c index 88c03c944b..28c6725d7e 100755 --- a/external/RSL_LITE/rsl_bcast.c +++ b/external/RSL_LITE/rsl_bcast.c @@ -532,7 +532,6 @@ void RSL_LITE_TO_PARENT_MSG ( nbuf_p, buf ) // // nest if it's parent->nest and the parent if it's nest->parent (we'll see) - /* common code */ void rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, dir ) int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p ; diff --git a/tools/Makefile b/tools/Makefile index a2c0acf50b..d413feeb71 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,7 +3,7 @@ CC_TOOLS = cc CFLAGS = $(CC_TOOLS_CFLAGS) #-ansi LDFLAGS = -DEBUG = -g +DEBUG = -O0 -g OBJ = registry.o my_strtok.o reg_parse.o data.o type.o misc.o \ gen_defs.o gen_allocs.o gen_mod_state_descr.o gen_scalar_indices.o \ gen_args.o gen_config.o sym.o symtab_gen.o gen_irr_diag.o \ diff --git a/tools/gen_interp.c b/tools/gen_interp.c index a4a504228c..e2a49ae914 100644 --- a/tools/gen_interp.c +++ b/tools/gen_interp.c @@ -377,7 +377,7 @@ fprintf(fp," ngrid%%parent_grid_ratio, ngrid%%parent_grid_ratio strcpy( tmpstr , pp->interpu_aux_fields ) ; } else if ( down_path & FORCE_DOWN ) { /* by default, add the boundary and boundary tendency fields to the arg list */ - if ( ! p->node_kind & FOURD ) { + if ( (! p->node_kind) & FOURD ) { sprintf( tmpstr , "%s_b,%s_bt,", pp->name, pp->name ) ; } else { sprintf( tmpstr , "%s_b,%s_bt,", p->name, p->name ) ; @@ -546,8 +546,8 @@ gen_nest_interp2 ( FILE * fp , node_t * node, char * fourdname, int down_path , set_dim_strs2 ( p , ddim , mdim , pdim , "", 1 ) ; } if ( !strcmp ( ddim[0][1], "kde") || - ( ddim[1][1], "kde") || - ( ddim[2][1], "kde")) { + !strcmp ( ddim[1][1], "kde") || + !strcmp ( ddim[2][1], "kde")) { if ( p->ntl > 1 ) { sprintf(tag,"_2") ; sprintf(tag2,"_%d", use_nest_time_level) ; } else { sprintf(tag,"") ; sprintf(tag2,"") ; } diff --git a/tools/gen_irr_diag.c b/tools/gen_irr_diag.c index 13071f239f..048ab53af2 100644 --- a/tools/gen_irr_diag.c +++ b/tools/gen_irr_diag.c @@ -255,12 +255,12 @@ int irr_diag_scalar_indices( char *dirname ) strcat( line,piece ); } strcat( line," /)\n" ); - fprintf( fp_inc,line ); + fprintf( fp_inc,"%s",line ); fprintf( fp_inc," \n"); for( i = 0; i < nChmOpts; i++ ) { sprintf( line," chm_opts_name(%d) = '%s'\n",i+1,chm_scheme[i]); - fprintf( fp_inc,line ); + fprintf( fp_inc,"%s",line ); } fprintf( fp_inc," \n"); @@ -273,10 +273,10 @@ int irr_diag_scalar_indices( char *dirname ) strcat( line,piece ); } strcat( line," /)\n" ); - fprintf( fp_inc,line ); + fprintf( fp_inc,"%s",line ); fprintf( fp_inc," \n"); - for( i = 0; i < nChmOpts,rxt_cnt[i] > 0; i++ ) { + for( i = 0; i < nChmOpts && rxt_cnt[i] > 0; i++ ) { for( j = 0; j < rxt_cnt[i]; j++ ) { sprintf( line," rxtsym(%d,%d) = '%s'\n",j+1,i+1,rxt_tbl[i][j]); fprintf( fp_inc,"%s",line); diff --git a/tools/gen_wrf_io.c b/tools/gen_wrf_io.c index 87c539b6e0..d228f6c962 100644 --- a/tools/gen_wrf_io.c +++ b/tools/gen_wrf_io.c @@ -85,7 +85,7 @@ gen_wrf_io2 ( FILE * fp , char * fname, char * structname , char * fourdname, no { - if ( p->ndims > 3 && ! p->node_kind & FOURD ) continue ; /* short circuit anything with more than 3 dims, (not counting 4d arrays) */ + if ( p->ndims > 3 && ( (! p->node_kind) & FOURD ) ) continue ; /* short circuit anything with more than 3 dims, (not counting 4d arrays) */ if ( p->node_kind & I1 ) continue ; /* short circuit anything that's not a state var */ diff --git a/tools/reg_parse.c b/tools/reg_parse.c index 8e2e1a0fd1..0b3144ad15 100644 --- a/tools/reg_parse.c +++ b/tools/reg_parse.c @@ -256,7 +256,7 @@ pre_parse( char * dir, FILE * infile, FILE * outfile ) if ( !strcmp( tokens[F_USE] , tracers[i] ) ) found = 1 ; } if ( found == 0 ) { - sprintf(tracers[ntracers],tokens[F_USE]) ; + sprintf(tracers[ntracers],"%s",tokens[F_USE]) ; ntracers++ ; /* add entries for _b and _bt arrays */ @@ -1058,7 +1058,7 @@ check_dimspecs() p->assoc_nl_var_s,p->name ) ; return(1) ; } - if ( ! q->node_kind & RCONFIG ) + if ( (! q->node_kind) & RCONFIG ) { fprintf(stderr,"WARNING: no namelist variable %s defined for dimension %s\n", p->assoc_nl_var_s,p->name ) ; @@ -1083,7 +1083,7 @@ check_dimspecs() p->assoc_nl_var_e,p->name ) ; return(1) ; } - if ( ! q->node_kind & RCONFIG ) + if ( (! q->node_kind) & RCONFIG ) { fprintf(stderr,"WARNING: no namelist variable %s defined for dimension %s\n", p->assoc_nl_var_e,p->name ) ;