cloudy trunk
Loading...
Searching...
No Matches
parse_state.cpp
Go to the documentation of this file.
1/* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2 * others. For conditions of distribution and use see copyright notice in license.txt */
3/*ParseState save or recover previous state of the code */
4#include "cddefines.h"
5#include "parse.h"
6#include "state.h"
7#include "parser.h"
8
9/*ParseState save or recover previous state of the code */
11{
12 char chFilename[INPUT_LINE_LENGTH];
13
14 DEBUG_ENTRY( "ParseState()" );
15
16 /*
17 * get file name for this save output.
18 * GetQuote does the following -
19 * first copy original version of file name into chLabel,
20 * string does include null termination.
21 * set filename in OrgCard and second parameter to spaces so
22 * that not picked up below as keyword
23 * last parameter says to abort if no quote found
24 */
25 p.GetQuote( chFilename , true );
26
27 /* option to print all contents of arrays - BIG PRINTOUT! */
28 if( p.nMatch("PRIN") )
29 state.lgState_print = true;
30
31 if( p.nMatch(" GET") )
32 {
33# if 0
34 state.ioGET_STATE = open_data( chFilename, "rb", AS_LOCAL_ONLY );
35# endif
36 state.lgGet_state = true;
37 strcpy( state.chGetFilename , chFilename );
38 }
39 else if( p.nMatch(" PUT") )
40 {
41# if 0
42 state.ioPUT_STATE = open_data( chFilename , "wb", AS_LOCAL_ONLY );
43# endif
44 state.lgPut_state = true;
45 strcpy( state.chPutFilename , chFilename );
46 /* look for keyword ALL - says want to save state for all iterations,
47 * default is last iteration */
48 if( p.nMatch(" ALL") )
49 {
50 state.lgPutAll = true;
51 }
52 else
53 {
54 state.lgPutAll = false;
55 }
56 }
57
58 else
59 {
60 fprintf( ioQQQ, " The STATE command has two keywords, GET and PUT. One must appear - I did not see it.\n Sorry.\n" );
62 }
63 return;
64}
FILE * ioQQQ
Definition cddefines.cpp:7
const int INPUT_LINE_LENGTH
Definition cddefines.h:254
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
bool nMatch(const char *chKey) const
Definition parser.h:135
int GetQuote(char *chLabel, bool lgABORT)
Definition parser.h:209
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
Definition cpu.cpp:625
@ AS_LOCAL_ONLY
Definition cpu.h:208
void ParseState(Parser &p)
t_state state
Definition state.cpp:19