cloudy
trunk
|
00001 /* This file is part of Cloudy and is copyright (C)1978-2008 by Gary J. Ferland and 00002 * others. For conditions of distribution and use see copyright notice in license.txt */ 00003 /*ParseState save or recover previous state of the code */ 00004 #include "cddefines.h" 00005 #include "parse.h" 00006 #include "state.h" 00007 00008 /*ParseState save or recover previous state of the code */ 00009 void ParseState(char *chCard) 00010 { 00011 char chFilename[INPUT_LINE_LENGTH]; 00012 00013 DEBUG_ENTRY( "ParseState()" ); 00014 00015 /* 00016 * get file name for this punch output. 00017 * GetQuote does the following - 00018 * first copy original version of file name into chLabel, 00019 * string does include null termination. 00020 * set filename in OrgCard and second parameter to spaces so 00021 * that not picked up below as keyword 00022 * last parameter says to abort if no quote found 00023 */ 00024 GetQuote( chFilename , chCard , true ); 00025 00026 /* option to print all contents of arrays - BIG PRINTOUT! */ 00027 if( nMatch("PRIN",chCard) ) 00028 state.lgState_print = true; 00029 00030 if( nMatch(" GET",chCard) ) 00031 { 00032 # if 0 00033 state.ioGET_STATE = open_data( chFilename, "rb", AS_LOCAL_ONLY ); 00034 # endif 00035 state.lgGet_state = true; 00036 strcpy( state.chGetFilename , chFilename ); 00037 } 00038 else if( nMatch(" PUT",chCard) ) 00039 { 00040 # if 0 00041 state.ioPUT_STATE = open_data( chFilename , "wb", AS_LOCAL_ONLY ); 00042 # endif 00043 state.lgPut_state = true; 00044 strcpy( state.chPutFilename , chFilename ); 00045 /* look for keyword ALL - says want to save state for all iterations, 00046 * default is last iteration */ 00047 if( nMatch(" ALL",chCard) ) 00048 { 00049 state.lgPutAll = true; 00050 } 00051 else 00052 { 00053 state.lgPutAll = false; 00054 } 00055 } 00056 00057 else 00058 { 00059 fprintf( ioQQQ, " The STATE command has two keywords, GET and PUT. One must appear - I did not see it.\n Sorry.\n" ); 00060 cdEXIT(EXIT_FAILURE); 00061 } 00062 return; 00063 }