mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Working on echoing for CParser
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@1605 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
3320ef3c93
commit
2dc33fb7ae
@ -78,7 +78,7 @@ CParser::LINE_TYPE CParser::check_line(const std::string& str, bool allow_empty,
|
|||||||
get_output() << msg;
|
get_output() << msg;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EO_KEWORDS:
|
case EO_KEYWORDS:
|
||||||
if (i == LT_KEYWORD)
|
if (i == LT_KEYWORD)
|
||||||
{
|
{
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
@ -100,7 +100,7 @@ CParser::LINE_TYPE CParser::check_line(const std::string& str, bool allow_empty,
|
|||||||
output_msg(OUTPUT_MESSAGE, "%s", msg.str().c_str());
|
output_msg(OUTPUT_MESSAGE, "%s", msg.str().c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EO_KEWORDS:
|
case EO_KEYWORDS:
|
||||||
if (i == LT_KEYWORD)
|
if (i == LT_KEYWORD)
|
||||||
{
|
{
|
||||||
std::ostringstream msg;
|
std::ostringstream msg;
|
||||||
|
|||||||
2
Parser.h
2
Parser.h
@ -69,7 +69,7 @@ public:
|
|||||||
enum ECHO_OPTION {
|
enum ECHO_OPTION {
|
||||||
EO_NONE = 0,
|
EO_NONE = 0,
|
||||||
EO_ALL = 1,
|
EO_ALL = 1,
|
||||||
EO_KEWORDS = 2
|
EO_KEYWORDS = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum STATUS_TYPE {
|
enum STATUS_TYPE {
|
||||||
|
|||||||
191
ReadClass.cxx
191
ReadClass.cxx
@ -20,6 +20,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
extern int reading_database (void);
|
||||||
extern int check_line(const char *string, int allow_empty, int allow_eof, int allow_keyword,
|
extern int check_line(const char *string, int allow_empty, int allow_eof, int allow_keyword,
|
||||||
int print);
|
int print);
|
||||||
|
|
||||||
@ -51,6 +52,8 @@ int read_solution_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("solution_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("solution_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -58,12 +61,20 @@ int read_solution_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -76,20 +87,23 @@ int read_solution_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (solution_bsearch(soln_ptr->n_user, &n, FALSE) != NULL) {
|
if (solution_bsearch(soln_ptr->n_user, &n, FALSE) != NULL) {
|
||||||
solution_free(solution[n]);
|
solution_free(solution[n]);
|
||||||
|
solution[n] = soln_ptr;
|
||||||
} else {
|
} else {
|
||||||
n=count_solution++;
|
n=count_solution++;
|
||||||
if (count_solution >= max_solution) {
|
if (count_solution >= max_solution) {
|
||||||
space ((void **) ((void *) &(solution)), count_solution, &max_solution, sizeof (struct solution *) );
|
space ((void **) ((void *) &(solution)), count_solution, &max_solution, sizeof (struct solution *) );
|
||||||
}
|
}
|
||||||
|
solution[n] = soln_ptr;
|
||||||
|
solution_sort ();
|
||||||
}
|
}
|
||||||
solution[n] = soln_ptr;
|
|
||||||
|
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -120,6 +134,8 @@ int read_exchange_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("exchange_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("exchange_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -127,12 +143,20 @@ int read_exchange_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -144,20 +168,25 @@ int read_exchange_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (exchange_bsearch(exchange_ptr->n_user, &n) != NULL) {
|
if (exchange_bsearch(exchange_ptr->n_user, &n) != NULL) {
|
||||||
exchange_free(&exchange[n]);
|
exchange_free(&exchange[n]);
|
||||||
|
exchange_copy(exchange_ptr, &exchange[n], exchange_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_exchange++;
|
n=count_exchange++;
|
||||||
if (count_exchange >= max_exchange) {
|
if (count_exchange >= max_exchange) {
|
||||||
space ((void **) ((void *) &(exchange)), count_exchange, &max_exchange, sizeof (struct exchange *) );
|
space ((void **) ((void *) &(exchange)), count_exchange, &max_exchange, sizeof (struct exchange *) );
|
||||||
}
|
}
|
||||||
|
exchange_copy(exchange_ptr, &exchange[n], exchange_ptr->n_user);
|
||||||
|
exchange_sort ();
|
||||||
}
|
}
|
||||||
exchange_copy(exchange_ptr, &exchange[n], exchange_ptr->n_user);
|
|
||||||
exchange_free(exchange_ptr);
|
exchange_free(exchange_ptr);
|
||||||
free_check_null(exchange_ptr);
|
free_check_null(exchange_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -188,6 +217,8 @@ int read_surface_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("surface_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("surface_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -195,12 +226,20 @@ int read_surface_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -212,20 +251,25 @@ int read_surface_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (surface_bsearch(surface_ptr->n_user, &n) != NULL) {
|
if (surface_bsearch(surface_ptr->n_user, &n) != NULL) {
|
||||||
surface_free(&surface[n]);
|
surface_free(&surface[n]);
|
||||||
|
surface_copy(surface_ptr, &surface[n], surface_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_surface++;
|
n=count_surface++;
|
||||||
if (count_surface >= max_surface) {
|
if (count_surface >= max_surface) {
|
||||||
space ((void **) ((void *) &(surface)), count_surface, &max_surface, sizeof (struct surface *) );
|
space ((void **) ((void *) &(surface)), count_surface, &max_surface, sizeof (struct surface *) );
|
||||||
}
|
}
|
||||||
|
surface_copy(surface_ptr, &surface[n], surface_ptr->n_user);
|
||||||
|
surface_sort ();
|
||||||
}
|
}
|
||||||
surface_copy(surface_ptr, &surface[n], surface_ptr->n_user);
|
|
||||||
surface_free(surface_ptr);
|
surface_free(surface_ptr);
|
||||||
free_check_null(surface_ptr);
|
free_check_null(surface_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -256,6 +300,8 @@ int read_equilibrium_phases_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("equilibrium_phases_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("equilibrium_phases_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -263,12 +309,20 @@ int read_equilibrium_phases_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -280,20 +334,25 @@ int read_equilibrium_phases_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pp_assemblage_bsearch(pp_assemblage_ptr->n_user, &n) != NULL) {
|
if (pp_assemblage_bsearch(pp_assemblage_ptr->n_user, &n) != NULL) {
|
||||||
pp_assemblage_free(&pp_assemblage[n]);
|
pp_assemblage_free(&pp_assemblage[n]);
|
||||||
|
pp_assemblage_copy(pp_assemblage_ptr, &pp_assemblage[n], pp_assemblage_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_pp_assemblage++;
|
n=count_pp_assemblage++;
|
||||||
if (count_pp_assemblage >= max_pp_assemblage) {
|
if (count_pp_assemblage >= max_pp_assemblage) {
|
||||||
space ((void **) ((void *) &(pp_assemblage)), count_pp_assemblage, &max_pp_assemblage, sizeof (struct pp_assemblage *) );
|
space ((void **) ((void *) &(pp_assemblage)), count_pp_assemblage, &max_pp_assemblage, sizeof (struct pp_assemblage *) );
|
||||||
}
|
}
|
||||||
|
pp_assemblage_copy(pp_assemblage_ptr, &pp_assemblage[n], pp_assemblage_ptr->n_user);
|
||||||
|
pp_assemblage_sort ();
|
||||||
}
|
}
|
||||||
pp_assemblage_copy(pp_assemblage_ptr, &pp_assemblage[n], pp_assemblage_ptr->n_user);
|
|
||||||
pp_assemblage_free(pp_assemblage_ptr);
|
pp_assemblage_free(pp_assemblage_ptr);
|
||||||
free_check_null(pp_assemblage_ptr);
|
free_check_null(pp_assemblage_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -324,6 +383,8 @@ int read_kinetics_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("kinetics_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("kinetics_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -331,12 +392,20 @@ int read_kinetics_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -348,20 +417,25 @@ int read_kinetics_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (kinetics_bsearch(kinetics_ptr->n_user, &n) != NULL) {
|
if (kinetics_bsearch(kinetics_ptr->n_user, &n) != NULL) {
|
||||||
kinetics_free(&kinetics[n]);
|
kinetics_free(&kinetics[n]);
|
||||||
|
kinetics_copy(kinetics_ptr, &kinetics[n], kinetics_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_kinetics++;
|
n=count_kinetics++;
|
||||||
if (count_kinetics >= max_kinetics) {
|
if (count_kinetics >= max_kinetics) {
|
||||||
space ((void **) ((void *) &(kinetics)), count_kinetics, &max_kinetics, sizeof (struct kinetics *) );
|
space ((void **) ((void *) &(kinetics)), count_kinetics, &max_kinetics, sizeof (struct kinetics *) );
|
||||||
}
|
}
|
||||||
|
kinetics_copy(kinetics_ptr, &kinetics[n], kinetics_ptr->n_user);
|
||||||
|
kinetics_sort ();
|
||||||
}
|
}
|
||||||
kinetics_copy(kinetics_ptr, &kinetics[n], kinetics_ptr->n_user);
|
|
||||||
kinetics_free(kinetics_ptr);
|
kinetics_free(kinetics_ptr);
|
||||||
free_check_null(kinetics_ptr);
|
free_check_null(kinetics_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -392,6 +466,8 @@ int read_solid_solutions_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("solid_solution_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("solid_solution_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -399,12 +475,20 @@ int read_solid_solutions_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -416,20 +500,25 @@ int read_solid_solutions_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (s_s_assemblage_bsearch(s_s_assemblage_ptr->n_user, &n) != NULL) {
|
if (s_s_assemblage_bsearch(s_s_assemblage_ptr->n_user, &n) != NULL) {
|
||||||
s_s_assemblage_free(&s_s_assemblage[n]);
|
s_s_assemblage_free(&s_s_assemblage[n]);
|
||||||
|
s_s_assemblage_copy(s_s_assemblage_ptr, &s_s_assemblage[n], s_s_assemblage_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_s_s_assemblage++;
|
n=count_s_s_assemblage++;
|
||||||
if (count_s_s_assemblage >= max_s_s_assemblage) {
|
if (count_s_s_assemblage >= max_s_s_assemblage) {
|
||||||
space ((void **) ((void *) &(s_s_assemblage)), count_s_s_assemblage, &max_s_s_assemblage, sizeof (struct s_s_assemblage *) );
|
space ((void **) ((void *) &(s_s_assemblage)), count_s_s_assemblage, &max_s_s_assemblage, sizeof (struct s_s_assemblage *) );
|
||||||
}
|
}
|
||||||
|
s_s_assemblage_copy(s_s_assemblage_ptr, &s_s_assemblage[n], s_s_assemblage_ptr->n_user);
|
||||||
|
s_s_assemblage_sort ();
|
||||||
}
|
}
|
||||||
s_s_assemblage_copy(s_s_assemblage_ptr, &s_s_assemblage[n], s_s_assemblage_ptr->n_user);
|
|
||||||
s_s_assemblage_free(s_s_assemblage_ptr);
|
s_s_assemblage_free(s_s_assemblage_ptr);
|
||||||
free_check_null(s_s_assemblage_ptr);
|
free_check_null(s_s_assemblage_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -460,6 +549,8 @@ int read_gas_phase_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("gas_phase_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("gas_phase_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -467,12 +558,20 @@ int read_gas_phase_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -484,20 +583,25 @@ int read_gas_phase_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (gas_phase_bsearch(gas_phase_ptr->n_user, &n) != NULL) {
|
if (gas_phase_bsearch(gas_phase_ptr->n_user, &n) != NULL) {
|
||||||
gas_phase_free(&gas_phase[n]);
|
gas_phase_free(&gas_phase[n]);
|
||||||
|
gas_phase_copy(gas_phase_ptr, &gas_phase[n], gas_phase_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_gas_phase++;
|
n=count_gas_phase++;
|
||||||
if (count_gas_phase >= max_gas_phase) {
|
if (count_gas_phase >= max_gas_phase) {
|
||||||
space ((void **) ((void *) &(gas_phase)), count_gas_phase, &max_gas_phase, sizeof (struct gas_phase *) );
|
space ((void **) ((void *) &(gas_phase)), count_gas_phase, &max_gas_phase, sizeof (struct gas_phase *) );
|
||||||
}
|
}
|
||||||
|
gas_phase_copy(gas_phase_ptr, &gas_phase[n], gas_phase_ptr->n_user);
|
||||||
|
gas_phase_sort ();
|
||||||
}
|
}
|
||||||
gas_phase_copy(gas_phase_ptr, &gas_phase[n], gas_phase_ptr->n_user);
|
|
||||||
gas_phase_free(gas_phase_ptr);
|
gas_phase_free(gas_phase_ptr);
|
||||||
free_check_null(gas_phase_ptr);
|
free_check_null(gas_phase_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -528,6 +632,8 @@ int read_reaction_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("reaction_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("reaction_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -535,12 +641,20 @@ int read_reaction_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -552,19 +666,24 @@ int read_reaction_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (irrev_bsearch(irrev_ptr->n_user, &n) != NULL) {
|
if (irrev_bsearch(irrev_ptr->n_user, &n) != NULL) {
|
||||||
irrev_free(&irrev[n]);
|
irrev_free(&irrev[n]);
|
||||||
|
irrev_copy(irrev_ptr, &irrev[n], irrev_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_irrev++;
|
n=count_irrev++;
|
||||||
irrev = (struct irrev *) PHRQ_realloc(irrev, (size_t) count_irrev * sizeof (struct irrev));
|
irrev = (struct irrev *) PHRQ_realloc(irrev, (size_t) count_irrev * sizeof (struct irrev));
|
||||||
if (irrev == NULL) malloc_error();
|
if (irrev == NULL) malloc_error();
|
||||||
|
irrev_copy(irrev_ptr, &irrev[n], irrev_ptr->n_user);
|
||||||
|
irrev_sort ();
|
||||||
}
|
}
|
||||||
irrev_copy(irrev_ptr, &irrev[n], irrev_ptr->n_user);
|
|
||||||
irrev_free(irrev_ptr);
|
irrev_free(irrev_ptr);
|
||||||
free_check_null(irrev_ptr);
|
free_check_null(irrev_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -595,6 +714,8 @@ int read_mix_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("mix_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("mix_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -602,12 +723,20 @@ int read_mix_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -619,19 +748,24 @@ int read_mix_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (mix_bsearch(mix_ptr->n_user, &n) != NULL) {
|
if (mix_bsearch(mix_ptr->n_user, &n) != NULL) {
|
||||||
mix_free(&mix[n]);
|
mix_free(&mix[n]);
|
||||||
|
mix_copy(mix_ptr, &mix[n], mix_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_mix++;
|
n=count_mix++;
|
||||||
mix = (struct mix *) PHRQ_realloc(mix, (size_t) count_mix * sizeof (struct mix));
|
mix = (struct mix *) PHRQ_realloc(mix, (size_t) count_mix * sizeof (struct mix));
|
||||||
if (mix == NULL) malloc_error();
|
if (mix == NULL) malloc_error();
|
||||||
|
mix_copy(mix_ptr, &mix[n], mix_ptr->n_user);
|
||||||
|
mix_sort ();
|
||||||
}
|
}
|
||||||
mix_copy(mix_ptr, &mix[n], mix_ptr->n_user);
|
|
||||||
mix_free(mix_ptr);
|
mix_free(mix_ptr);
|
||||||
free_check_null(mix_ptr);
|
free_check_null(mix_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -662,6 +796,8 @@ int read_temperature_raw (void)
|
|||||||
/*
|
/*
|
||||||
* Read additonal lines
|
* Read additonal lines
|
||||||
*/
|
*/
|
||||||
|
int save_echo_input = pr.echo_input;
|
||||||
|
pr.echo_input = FALSE;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
return_value = check_line("temperature_raw",TRUE,TRUE,TRUE,FALSE);
|
return_value = check_line("temperature_raw",TRUE,TRUE,TRUE,FALSE);
|
||||||
/* empty, eof, keyword, print */
|
/* empty, eof, keyword, print */
|
||||||
@ -669,12 +805,20 @@ int read_temperature_raw (void)
|
|||||||
keywordLines.append(line);
|
keywordLines.append(line);
|
||||||
keywordLines.append("\n");
|
keywordLines.append("\n");
|
||||||
}
|
}
|
||||||
|
pr.echo_input = save_echo_input;
|
||||||
|
|
||||||
std::istringstream iss_in(keywordLines);
|
std::istringstream iss_in(keywordLines);
|
||||||
std::ostringstream oss_out;
|
std::ostringstream oss_out;
|
||||||
std::ostringstream oss_err;
|
std::ostringstream oss_err;
|
||||||
|
|
||||||
CParser parser(iss_in, oss_out, oss_err);
|
CParser parser(iss_in, oss_out, oss_err);
|
||||||
|
if (pr.echo_input == FALSE)
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_NONE);
|
||||||
|
} else if (reading_database ())
|
||||||
|
{
|
||||||
|
parser.set_echo_file(CParser::EO_KEYWORDS);
|
||||||
|
}
|
||||||
//For testing, need to read line to get started
|
//For testing, need to read line to get started
|
||||||
std::vector<std::string> vopts;
|
std::vector<std::string> vopts;
|
||||||
std::istream::pos_type next_char;
|
std::istream::pos_type next_char;
|
||||||
@ -686,18 +830,23 @@ int read_temperature_raw (void)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is not quite right, may not produce sort order
|
* This is not quite right, may not produce sort order, forced sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (temperature_bsearch(temperature_ptr->n_user, &n) != NULL) {
|
if (temperature_bsearch(temperature_ptr->n_user, &n) != NULL) {
|
||||||
temperature_free(&temperature[n]);
|
temperature_free(&temperature[n]);
|
||||||
|
temperature_copy(temperature_ptr, &temperature[n], temperature_ptr->n_user);
|
||||||
} else {
|
} else {
|
||||||
n=count_temperature++;
|
n=count_temperature++;
|
||||||
temperature = (struct temperature *) PHRQ_realloc(temperature, (size_t) count_temperature * sizeof (struct temperature));
|
temperature = (struct temperature *) PHRQ_realloc(temperature, (size_t) count_temperature * sizeof (struct temperature));
|
||||||
if (temperature == NULL) malloc_error();
|
if (temperature == NULL) malloc_error();
|
||||||
|
temperature_copy(temperature_ptr, &temperature[n], temperature_ptr->n_user);
|
||||||
|
temperature_sort ();
|
||||||
}
|
}
|
||||||
temperature_copy(temperature_ptr, &temperature[n], temperature_ptr->n_user);
|
|
||||||
temperature_free(temperature_ptr);
|
temperature_free(temperature_ptr);
|
||||||
free_check_null(temperature_ptr);
|
free_check_null(temperature_ptr);
|
||||||
|
|
||||||
|
// Need to output the next keyword
|
||||||
|
output_msg (OUTPUT_CHECKLINE, "\t%s\n", line);
|
||||||
return(return_value);
|
return(return_value);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user