Redid capability to include input files using #include fn.

Now process database and input files into streams in process_file_names. Uses alternate getc from streams to
read the streams. 

I have not set the necessary #define MERGE_INCLUDE_FILES to
implement the new capability. Also requires #define PHREEQC_CLASS.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@4816 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2010-09-15 19:03:43 +00:00
parent 619dc25cde
commit f41c9446bf
2 changed files with 12 additions and 2 deletions

View File

@ -311,6 +311,9 @@ public:
int close_input_files(void);
int close_output_files(void);
CLASS_STATIC int getc_callback(void *cookie);
#if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS)
CLASS_STATIC int istream_getc(void *cookie);
#endif /* #if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS) */
int process_file_names(int argc, char *argv[], void **db_cookie,
void **input_cookie, int log);
@ -1437,8 +1440,7 @@ void ExpandTable_multi(HashTable * Table);
#if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS)
public:
bool recursive_include(FILE * input_file, FILE * accumulated_file);
int simple_get_line(FILE * input_file, std::string & l_line);
bool recursive_include(std::ifstream & input_stream, std::iostream & accumulated_stream);
#endif /* #if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS) */
public: // public methods for PHREEQC_CLASS

View File

@ -133,7 +133,11 @@ main_method(int argc, char *argv[])
/*
* Load database into memory
*/
#if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS)
errors = read_database(istream_getc, db_cookie);
#else
errors = read_database(getc_callback, db_cookie);
#endif
if (errors != 0)
{
//clean_up();
@ -143,7 +147,11 @@ main_method(int argc, char *argv[])
/*
* Read input data for simulation
*/
#if defined(MERGE_INCLUDE_FILES) && defined(PHREEQC_CLASS)
errors = run_simulations(istream_getc, input_cookie);
#else
errors = run_simulations(getc_callback, input_cookie);
#endif
if (errors != 0)
{
//clean_up();