mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +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
|
||||
# SRC 2020-01-28T10:03:39-07:00
|
||||
#
|
||||
image: buildpack-deps:bionic-scm
|
||||
image: ${CI_REGISTRY}/coupled/containers/buildpack-deps:bionic-scm
|
||||
|
||||
stages:
|
||||
- sync
|
||||
|
||||
@ -64,6 +64,8 @@ PBasic::PBasic(Phreeqc * ptr, PHRQ_io *phrq_io)
|
||||
nIDErrPrompt = (PBasic::IDErr)0;
|
||||
#endif
|
||||
nErrLineNumber = 0;
|
||||
punch_tab = true;
|
||||
skip_punch = false;
|
||||
// Basic commands initialized at bottom of file
|
||||
}
|
||||
PBasic::~PBasic(void)
|
||||
@ -1091,6 +1093,14 @@ listtokens(FILE * f, tokenrec * l_buf)
|
||||
output_msg("EOL$");
|
||||
break;
|
||||
|
||||
case tokeol_notab_:
|
||||
output_msg("EOL_NOTAB$");
|
||||
break;
|
||||
|
||||
case tokno_newline_:
|
||||
output_msg("NO_NEWLINE$");
|
||||
break;
|
||||
|
||||
case tokasc:
|
||||
output_msg("ASC");
|
||||
break;
|
||||
@ -1413,6 +1423,10 @@ listtokens(FILE * f, tokenrec * l_buf)
|
||||
output_msg("SYS");
|
||||
break;
|
||||
|
||||
case tokadd_heading:
|
||||
output_msg("ADD_HEADING");
|
||||
break;
|
||||
|
||||
case tokinstr:
|
||||
output_msg("INSTR");
|
||||
break;
|
||||
@ -2635,6 +2649,14 @@ factor(struct LOC_exec * LINK)
|
||||
n.UU.sval = PhreeqcPtr->string_pad(string1, i);
|
||||
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:
|
||||
require(toklp, LINK);
|
||||
elt_name = stringfactor(STR1, LINK);
|
||||
@ -4098,6 +4120,21 @@ factor(struct LOC_exec * LINK)
|
||||
strcpy(n.UU.sval, "\n");
|
||||
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:
|
||||
l_s = strfactor(LINK);
|
||||
if (*l_s == '\0')
|
||||
@ -5031,31 +5068,56 @@ cmdpunch(struct LOC_exec *LINK)
|
||||
bool temp_high_precision = (PhreeqcPtr->current_selected_output != NULL) ?
|
||||
PhreeqcPtr->current_selected_output->Get_high_precision() :
|
||||
PhreeqcPtr->high_precision;
|
||||
if (!this->skip_punch)
|
||||
{
|
||||
if (n.stringval)
|
||||
{
|
||||
/* fputs(n.UU.sval, stdout); */
|
||||
|
||||
{
|
||||
if (!temp_high_precision)
|
||||
{
|
||||
if (strlen(n.UU.sval) <= 12)
|
||||
{
|
||||
if (punch_tab)
|
||||
{
|
||||
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
|
||||
{
|
||||
if (punch_tab)
|
||||
{
|
||||
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
|
||||
{
|
||||
if (strlen(n.UU.sval) <= 20)
|
||||
{
|
||||
if (punch_tab) {
|
||||
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
|
||||
{
|
||||
if (punch_tab) {
|
||||
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);
|
||||
}
|
||||
@ -5067,8 +5129,11 @@ cmdpunch(struct LOC_exec *LINK)
|
||||
{
|
||||
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%20.12e\t", (double)n.UU.val);
|
||||
}
|
||||
punch_tab = true;
|
||||
++PhreeqcPtr->n_user_punch_index;
|
||||
}
|
||||
this->skip_punch = false;
|
||||
}
|
||||
}
|
||||
|
||||
#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("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_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("len", PBasic::toklen),
|
||||
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("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("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("ltrim", PBasic::tokltrim),
|
||||
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rtrim", PBasic::tokrtrim),
|
||||
|
||||
@ -266,6 +266,7 @@ public:
|
||||
tokdescription,
|
||||
toktitle,
|
||||
toksys,
|
||||
tokadd_heading,
|
||||
tokinstr,
|
||||
tokltrim,
|
||||
tokrtrim,
|
||||
@ -298,6 +299,8 @@ public:
|
||||
toktotmol,
|
||||
toktotmoles,
|
||||
tokeol_,
|
||||
tokeol_notab_,
|
||||
tokno_newline_,
|
||||
tokceil,
|
||||
tokfloor,
|
||||
tokkinetics_formula,
|
||||
@ -547,6 +550,8 @@ protected:
|
||||
IDErr nIDErrPrompt;
|
||||
#endif
|
||||
int nErrLineNumber;
|
||||
bool punch_tab;
|
||||
bool skip_punch;
|
||||
};
|
||||
|
||||
#endif /* _INC_PBasic_H */
|
||||
|
||||
@ -39,6 +39,7 @@ SelectedOutput::SelectedOutput(int n, PHRQ_io *io)
|
||||
this->charge_balance = false;
|
||||
this->percent_error = false;
|
||||
this->new_line = true;
|
||||
this->punch_newline = true;
|
||||
|
||||
// as-is set flags
|
||||
//
|
||||
|
||||
@ -83,6 +83,7 @@ public:
|
||||
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_new_line(void)const {return this->new_line; }
|
||||
inline bool Get_punch_newline(void)const {return this->punch_newline; }
|
||||
|
||||
// as-is setters
|
||||
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_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_punch_newline(bool tf) {this->punch_newline = tf; this->set_new_line = true; }
|
||||
|
||||
// set flag getters
|
||||
inline bool was_set_user_punch()const {return this->set_user_punch;}
|
||||
@ -181,6 +183,7 @@ protected:
|
||||
bool charge_balance;
|
||||
bool percent_error;
|
||||
bool new_line;
|
||||
bool punch_newline;
|
||||
|
||||
// as-is set flags
|
||||
bool set_user_punch;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# https://code.chs.usgs.gov/coupled/subtrees/phreeqc3-src-common
|
||||
# SRC 2020-01-28T10:03:39-07:00
|
||||
#
|
||||
image: buildpack-deps:bionic-scm
|
||||
image: ${CI_REGISTRY}/coupled/containers/buildpack-deps:bionic-scm
|
||||
|
||||
stages:
|
||||
- trigger
|
||||
|
||||
@ -180,7 +180,6 @@ punch_all(void)
|
||||
// UserPunch
|
||||
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);
|
||||
|
||||
punch_identifiers();
|
||||
punch_totals();
|
||||
punch_molalities();
|
||||
@ -196,8 +195,9 @@ punch_all(void)
|
||||
/*
|
||||
* 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");
|
||||
current_selected_output->Set_punch_newline(true);
|
||||
|
||||
/*
|
||||
* signal end of row
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user