7 /* replace decomp routine in KPP Integr file */
10 main( int argc
, char *argv
[] )
13 char mechname
[NAMELEN
];
14 char intfname
[NAMELEN
], incfname
[NAMELEN
], tfname
[NAMELEN
];
15 char inln
[NAMELEN
], incln
[NAMELEN
];
16 char callln
[NAMELEN
], endln
[NAMELEN
] ;
17 char cp_command
[NAMELEN
];
30 strcpy( mechname
, *argv
);
34 printf("ERROR: USAGE: integr_edit mech_name\n");
38 sprintf ( intfname
, "module_kpp_%s_Integr.F", mechname
);
39 sprintf ( incfname
, "decomp_%s.inc", mechname
);
40 sprintf ( tfname
, "%s_new", intfname
);
44 sprintf( cp_command
,"cp %s %s",tfname
, intfname
);
46 intf
= fopen( intfname
, "r" );
47 incf
= fopen( incfname
, "r" );
48 ofile
= fopen( tfname
, "w" );
52 sprintf ( callln
, " CALL %s_KppDecomp\0", mechname
);
53 sprintf ( endln
, "END MODULE");
55 /* loop over lines in Integr file */
56 while ( fgets ( inln
, 4096 , intf
) != NULL
){
61 /* replace call to decomp routine */
63 if ( !strncmp (inln
, callln
, strlen(callln
)-1) ) {
65 printf(" integr_edit: replacing %s \n", inln
);
67 fprintf(ofile
, "!!! use direct adressing in decomp \n");
68 fprintf(ofile
, "!!! %s", inln
);
69 fprintf(ofile
, "CALL decomp_%s ( A, ising )\n", mechname
);
77 /* add decomp routine w. direct referncing */
79 if ( !strncmp (inln
, endln
, strlen(endln
)-1) ) {
82 printf(" %s ", inln
);
83 while ( fgets ( incln
, 4096 , incf
) != NULL
){
85 fprintf(ofile
, "%s", incln
);
89 fprintf(ofile
, " \n\n\n");
96 /* copy line from original file */
99 fprintf(ofile
, "%s", inln
);
108 printf(" integr_edit: Kept previous version. \n ");