Redid include as include$.

Have rewritten get_line, but need to redo the parser get_line.

Works on include test case. 

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@4987 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2010-12-21 17:24:00 +00:00
parent e0ed0a618f
commit 6f9a13b106
3 changed files with 45 additions and 0 deletions

View File

@ -476,6 +476,7 @@ Phreeqc::~Phreeqc(void)
PHRQ_free_all();
}
void Phreeqc::set_phast(int tf)
{
this->phast = tf;
@ -1223,5 +1224,37 @@ void Phreeqc::init(void)
/* model.c */
gas_in = FALSE;
this->clear_cookie();
return;
}
void * Phreeqc::get_cookie()
{
if (cookie_list.size() > 0)
{
return this->cookie_list.front();
}
else
{
return NULL;
}
}
void Phreeqc::set_cookie(std::istream * cookie)
{
this->cookie_list.push_front(cookie);
}
void Phreeqc::clear_cookie(void)
{
while (this->cookie_list.size() > 0)
{
this->pop_cookie();
}
}
void Phreeqc::pop_cookie()
{
if (cookie_list.size() > 0)
{
delete this->cookie_list.front();
this->cookie_list.pop_front();
}
}

View File

@ -1449,8 +1449,16 @@ public: // public methods for PHREEQC_CLASS
int main_method(int argc, char *argv[]);
void set_phast(int);
size_t list_components(std::list<std::string> &list_c);
void *get_cookie();
void pop_cookie();
void set_cookie(std::istream * cookie);
void clear_cookie(void);
protected:
void init(void);
//Data
std::list <std::istream *> cookie_list;
std::ifstream * in_stream;
std::ifstream * db_stream;
};
#endif /* _INC_PHREEQC_H */

View File

@ -134,7 +134,9 @@ main_method(int argc, char *argv[])
* Load database into memory
*/
#if defined(MERGE_INCLUDE_FILES)
this->set_cookie((std::ifstream *) db_cookie);
errors = read_database(istream_getc, db_cookie);
this->clear_cookie();
#else
errors = read_database(getc_callback, db_cookie);
#endif
@ -148,7 +150,9 @@ main_method(int argc, char *argv[])
* Read input data for simulation
*/
#if defined(MERGE_INCLUDE_FILES)
this->set_cookie((std::ifstream *)input_cookie);
errors = run_simulations(istream_getc, input_cookie);
this->clear_cookie();
#else
errors = run_simulations(getc_callback, input_cookie);
#endif