mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Merge commit '50016849a03a70eeb0f714f23a3b56f1983a8189'
This commit is contained in:
commit
fa25db5da9
@ -2,7 +2,7 @@
|
|||||||
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src
|
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src
|
||||||
# SRC 2020-01-28T10:03:39-07:00
|
# SRC 2020-01-28T10:03:39-07:00
|
||||||
#
|
#
|
||||||
image: buildpack-deps:bionic-scm
|
image: ${CI_REGISTRY}/coupled/containers/buildpack-deps:bionic-scm
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- sync
|
- sync
|
||||||
|
|||||||
@ -64,6 +64,8 @@ PBasic::PBasic(Phreeqc * ptr, PHRQ_io *phrq_io)
|
|||||||
nIDErrPrompt = (PBasic::IDErr)0;
|
nIDErrPrompt = (PBasic::IDErr)0;
|
||||||
#endif
|
#endif
|
||||||
nErrLineNumber = 0;
|
nErrLineNumber = 0;
|
||||||
|
punch_tab = true;
|
||||||
|
skip_punch = false;
|
||||||
// Basic commands initialized at bottom of file
|
// Basic commands initialized at bottom of file
|
||||||
}
|
}
|
||||||
PBasic::~PBasic(void)
|
PBasic::~PBasic(void)
|
||||||
@ -1091,6 +1093,14 @@ listtokens(FILE * f, tokenrec * l_buf)
|
|||||||
output_msg("EOL$");
|
output_msg("EOL$");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case tokeol_notab_:
|
||||||
|
output_msg("EOL_NOTAB$");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tokno_newline_:
|
||||||
|
output_msg("NO_NEWLINE$");
|
||||||
|
break;
|
||||||
|
|
||||||
case tokasc:
|
case tokasc:
|
||||||
output_msg("ASC");
|
output_msg("ASC");
|
||||||
break;
|
break;
|
||||||
@ -1413,6 +1423,10 @@ listtokens(FILE * f, tokenrec * l_buf)
|
|||||||
output_msg("SYS");
|
output_msg("SYS");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case tokadd_heading:
|
||||||
|
output_msg("ADD_HEADING");
|
||||||
|
break;
|
||||||
|
|
||||||
case tokinstr:
|
case tokinstr:
|
||||||
output_msg("INSTR");
|
output_msg("INSTR");
|
||||||
break;
|
break;
|
||||||
@ -2635,6 +2649,14 @@ factor(struct LOC_exec * LINK)
|
|||||||
n.UU.sval = PhreeqcPtr->string_pad(string1, i);
|
n.UU.sval = PhreeqcPtr->string_pad(string1, i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case tokadd_heading:
|
||||||
|
require(toklp, LINK);
|
||||||
|
name = stringfactor(STR1, LINK);
|
||||||
|
require(tokrp, LINK);
|
||||||
|
PhreeqcPtr->current_user_punch->Get_headings().push_back(name);
|
||||||
|
n.UU.val = (parse_all) ? 1 : (double)PhreeqcPtr->current_user_punch->Get_headings().size();
|
||||||
|
break;
|
||||||
|
|
||||||
case toksys:
|
case toksys:
|
||||||
require(toklp, LINK);
|
require(toklp, LINK);
|
||||||
elt_name = stringfactor(STR1, LINK);
|
elt_name = stringfactor(STR1, LINK);
|
||||||
@ -4098,6 +4120,21 @@ factor(struct LOC_exec * LINK)
|
|||||||
strcpy(n.UU.sval, "\n");
|
strcpy(n.UU.sval, "\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case tokeol_notab_:
|
||||||
|
n.stringval = true;
|
||||||
|
n.UU.sval = (char*)PhreeqcPtr->PHRQ_calloc(256, sizeof(char));
|
||||||
|
if (n.UU.sval == NULL)
|
||||||
|
PhreeqcPtr->malloc_error();
|
||||||
|
strcpy(n.UU.sval, "\n");
|
||||||
|
punch_tab = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tokno_newline_:
|
||||||
|
n.stringval = true;
|
||||||
|
PhreeqcPtr->current_selected_output->Set_punch_newline(false);
|
||||||
|
this->skip_punch = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case tokasc:
|
case tokasc:
|
||||||
l_s = strfactor(LINK);
|
l_s = strfactor(LINK);
|
||||||
if (*l_s == '\0')
|
if (*l_s == '\0')
|
||||||
@ -5031,31 +5068,56 @@ cmdpunch(struct LOC_exec *LINK)
|
|||||||
bool temp_high_precision = (PhreeqcPtr->current_selected_output != NULL) ?
|
bool temp_high_precision = (PhreeqcPtr->current_selected_output != NULL) ?
|
||||||
PhreeqcPtr->current_selected_output->Get_high_precision() :
|
PhreeqcPtr->current_selected_output->Get_high_precision() :
|
||||||
PhreeqcPtr->high_precision;
|
PhreeqcPtr->high_precision;
|
||||||
|
if (!this->skip_punch)
|
||||||
|
{
|
||||||
if (n.stringval)
|
if (n.stringval)
|
||||||
{
|
{
|
||||||
/* fputs(n.UU.sval, stdout); */
|
/* fputs(n.UU.sval, stdout); */
|
||||||
|
{
|
||||||
if (!temp_high_precision)
|
if (!temp_high_precision)
|
||||||
{
|
{
|
||||||
if (strlen(n.UU.sval) <= 12)
|
if (strlen(n.UU.sval) <= 12)
|
||||||
|
{
|
||||||
|
if (punch_tab)
|
||||||
{
|
{
|
||||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%12.12s\t", n.UU.sval);
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%12.12s\t", n.UU.sval);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%12.12s", n.UU.sval);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (punch_tab)
|
||||||
{
|
{
|
||||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s\t", n.UU.sval);
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s\t", n.UU.sval);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s", n.UU.sval);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (strlen(n.UU.sval) <= 20)
|
if (strlen(n.UU.sval) <= 20)
|
||||||
{
|
{
|
||||||
|
if (punch_tab) {
|
||||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.20s\t", n.UU.sval);
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.20s\t", n.UU.sval);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.20s", n.UU.sval);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (punch_tab) {
|
||||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s\t", n.UU.sval);
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s\t", n.UU.sval);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%s", n.UU.sval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PhreeqcPtr->PHRQ_free(n.UU.sval);
|
PhreeqcPtr->PHRQ_free(n.UU.sval);
|
||||||
}
|
}
|
||||||
@ -5067,8 +5129,11 @@ cmdpunch(struct LOC_exec *LINK)
|
|||||||
{
|
{
|
||||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.12e\t", (double)n.UU.val);
|
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.12e\t", (double)n.UU.val);
|
||||||
}
|
}
|
||||||
|
punch_tab = true;
|
||||||
++PhreeqcPtr->n_user_punch_index;
|
++PhreeqcPtr->n_user_punch_index;
|
||||||
}
|
}
|
||||||
|
this->skip_punch = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined PHREEQ98
|
#if defined PHREEQ98
|
||||||
@ -7253,6 +7318,8 @@ const std::map<const std::string, PBasic::BASIC_TOKEN>::value_type temp_tokens[]
|
|||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("val", PBasic::tokval),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("val", PBasic::tokval),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("chr$", PBasic::tokchr_),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("chr$", PBasic::tokchr_),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("eol$", PBasic::tokeol_),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("eol$", PBasic::tokeol_),
|
||||||
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("eol_notab$", PBasic::tokeol_notab_),
|
||||||
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("no_newline$", PBasic::tokno_newline_),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("asc", PBasic::tokasc),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("asc", PBasic::tokasc),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("len", PBasic::toklen),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("len", PBasic::toklen),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("mid$", PBasic::tokmid_),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("mid$", PBasic::tokmid_),
|
||||||
@ -7332,6 +7399,7 @@ const std::map<const std::string, PBasic::BASIC_TOKEN>::value_type temp_tokens[]
|
|||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("description", PBasic::tokdescription),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("description", PBasic::tokdescription),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("title", PBasic::toktitle),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("title", PBasic::toktitle),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("sys", PBasic::toksys),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("sys", PBasic::toksys),
|
||||||
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("add_heading", PBasic::tokadd_heading),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("instr", PBasic::tokinstr),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("instr", PBasic::tokinstr),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("ltrim", PBasic::tokltrim),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("ltrim", PBasic::tokltrim),
|
||||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rtrim", PBasic::tokrtrim),
|
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rtrim", PBasic::tokrtrim),
|
||||||
|
|||||||
@ -266,6 +266,7 @@ public:
|
|||||||
tokdescription,
|
tokdescription,
|
||||||
toktitle,
|
toktitle,
|
||||||
toksys,
|
toksys,
|
||||||
|
tokadd_heading,
|
||||||
tokinstr,
|
tokinstr,
|
||||||
tokltrim,
|
tokltrim,
|
||||||
tokrtrim,
|
tokrtrim,
|
||||||
@ -298,6 +299,8 @@ public:
|
|||||||
toktotmol,
|
toktotmol,
|
||||||
toktotmoles,
|
toktotmoles,
|
||||||
tokeol_,
|
tokeol_,
|
||||||
|
tokeol_notab_,
|
||||||
|
tokno_newline_,
|
||||||
tokceil,
|
tokceil,
|
||||||
tokfloor,
|
tokfloor,
|
||||||
tokkinetics_formula,
|
tokkinetics_formula,
|
||||||
@ -547,6 +550,8 @@ protected:
|
|||||||
IDErr nIDErrPrompt;
|
IDErr nIDErrPrompt;
|
||||||
#endif
|
#endif
|
||||||
int nErrLineNumber;
|
int nErrLineNumber;
|
||||||
|
bool punch_tab;
|
||||||
|
bool skip_punch;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INC_PBasic_H */
|
#endif /* _INC_PBasic_H */
|
||||||
|
|||||||
@ -39,6 +39,7 @@ SelectedOutput::SelectedOutput(int n, PHRQ_io *io)
|
|||||||
this->charge_balance = false;
|
this->charge_balance = false;
|
||||||
this->percent_error = false;
|
this->percent_error = false;
|
||||||
this->new_line = true;
|
this->new_line = true;
|
||||||
|
this->punch_newline = true;
|
||||||
|
|
||||||
// as-is set flags
|
// as-is set flags
|
||||||
//
|
//
|
||||||
|
|||||||
@ -83,6 +83,7 @@ public:
|
|||||||
inline bool Get_charge_balance(void)const {return this->charge_balance;}
|
inline bool Get_charge_balance(void)const {return this->charge_balance;}
|
||||||
inline bool Get_percent_error(void)const {return this->percent_error;}
|
inline bool Get_percent_error(void)const {return this->percent_error;}
|
||||||
inline bool Get_new_line(void)const {return this->new_line; }
|
inline bool Get_new_line(void)const {return this->new_line; }
|
||||||
|
inline bool Get_punch_newline(void)const {return this->punch_newline; }
|
||||||
|
|
||||||
// as-is setters
|
// as-is setters
|
||||||
inline void Set_user_punch(bool tf) {this->user_punch = tf; this->set_user_punch = true;}
|
inline void Set_user_punch(bool tf) {this->user_punch = tf; this->set_user_punch = true;}
|
||||||
@ -107,6 +108,7 @@ public:
|
|||||||
inline void Set_charge_balance(bool tf) {this->charge_balance = tf; this->set_charge_balance = true;}
|
inline void Set_charge_balance(bool tf) {this->charge_balance = tf; this->set_charge_balance = true;}
|
||||||
inline void Set_percent_error(bool tf) {this->percent_error = tf; this->set_percent_error = true;}
|
inline void Set_percent_error(bool tf) {this->percent_error = tf; this->set_percent_error = true;}
|
||||||
inline void Set_new_line(bool tf) {this->new_line = tf; this->set_new_line = true;}
|
inline void Set_new_line(bool tf) {this->new_line = tf; this->set_new_line = true;}
|
||||||
|
inline void Set_punch_newline(bool tf) {this->punch_newline = tf; this->set_new_line = true; }
|
||||||
|
|
||||||
// set flag getters
|
// set flag getters
|
||||||
inline bool was_set_user_punch()const {return this->set_user_punch;}
|
inline bool was_set_user_punch()const {return this->set_user_punch;}
|
||||||
@ -181,6 +183,7 @@ protected:
|
|||||||
bool charge_balance;
|
bool charge_balance;
|
||||||
bool percent_error;
|
bool percent_error;
|
||||||
bool new_line;
|
bool new_line;
|
||||||
|
bool punch_newline;
|
||||||
|
|
||||||
// as-is set flags
|
// as-is set flags
|
||||||
bool set_user_punch;
|
bool set_user_punch;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src-common
|
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src-common
|
||||||
# SRC 2020-01-28T10:03:39-07:00
|
# SRC 2020-01-28T10:03:39-07:00
|
||||||
#
|
#
|
||||||
image: buildpack-deps:bionic-scm
|
image: ${CI_REGISTRY}/coupled/containers/buildpack-deps:bionic-scm
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- trigger
|
- trigger
|
||||||
|
|||||||
@ -180,7 +180,6 @@ punch_all(void)
|
|||||||
// UserPunch
|
// UserPunch
|
||||||
std::map < int, UserPunch >::iterator up_it = UserPunch_map.find(current_selected_output->Get_n_user());
|
std::map < int, UserPunch >::iterator up_it = UserPunch_map.find(current_selected_output->Get_n_user());
|
||||||
current_user_punch = up_it == UserPunch_map.end() ? NULL : &(up_it->second);
|
current_user_punch = up_it == UserPunch_map.end() ? NULL : &(up_it->second);
|
||||||
|
|
||||||
punch_identifiers();
|
punch_identifiers();
|
||||||
punch_totals();
|
punch_totals();
|
||||||
punch_molalities();
|
punch_molalities();
|
||||||
@ -196,8 +195,9 @@ punch_all(void)
|
|||||||
/*
|
/*
|
||||||
* new line for punch_file
|
* new line for punch_file
|
||||||
*/
|
*/
|
||||||
if (current_selected_output->Get_new_line())
|
if (current_selected_output->Get_new_line() && current_selected_output->Get_punch_newline())
|
||||||
punch_msg("\n");
|
punch_msg("\n");
|
||||||
|
current_selected_output->Set_punch_newline(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* signal end of row
|
* signal end of row
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user