Merge remote-tracking branch 'origin/master'

This commit is contained in:
Charlton, Scott R 2021-03-05 16:43:46 -07:00
commit b9f44da20a
6 changed files with 29 additions and 14 deletions

View File

@ -2651,10 +2651,16 @@ factor(struct LOC_exec * LINK)
case tokadd_heading: case tokadd_heading:
require(toklp, LINK); require(toklp, LINK);
name = stringfactor(STR1, LINK); name = strexpr(LINK);
require(tokrp, LINK); require(tokrp, LINK);
PhreeqcPtr->current_user_punch->Get_headings().push_back(name); if (PhreeqcPtr->current_user_punch != NULL)
n.UU.val = (parse_all) ? 1 : (double)PhreeqcPtr->current_user_punch->Get_headings().size(); {
PhreeqcPtr->current_user_punch->Get_headings().push_back(name);
n.UU.val = (parse_all) ? 1 : (double)PhreeqcPtr->current_user_punch->Get_headings().size();
} else {
n.UU.val = 0;
}
break; break;
case toksys: case toksys:
@ -4131,7 +4137,7 @@ factor(struct LOC_exec * LINK)
case tokno_newline_: case tokno_newline_:
n.stringval = true; n.stringval = true;
PhreeqcPtr->current_selected_output->Set_punch_newline(false); PhreeqcPtr->Set_output_newline(false);
this->skip_punch = true; this->skip_punch = true;
break; break;
@ -5035,17 +5041,21 @@ cmdprint(struct LOC_exec *LINK)
n = expr(LINK); n = expr(LINK);
if (n.stringval) if (n.stringval)
{ {
/* fputs(n.UU.sval, stdout); */ if (!skip_punch) {
output_msg(PhreeqcPtr->sformatf("%s ", n.UU.sval)); /* fputs(n.UU.sval, stdout); */
output_msg(PhreeqcPtr->sformatf("%s ", n.UU.sval));
}
PhreeqcPtr->PHRQ_free(n.UU.sval); PhreeqcPtr->PHRQ_free(n.UU.sval);
} }
else else
/* printf("%s ", numtostr(STR1, n.UU.val)); */ /* printf("%s ", numtostr(STR1, n.UU.val)); */
output_msg(PhreeqcPtr->sformatf("%s ", numtostr(STR1, n.UU.val))); output_msg(PhreeqcPtr->sformatf("%s ", numtostr(STR1, n.UU.val)));
} }
if (!semiflag) if (!semiflag && PhreeqcPtr->Get_output_newline())
/* putchar('\n');*/ /* putchar('\n');*/
output_msg("\n"); output_msg("\n");
PhreeqcPtr->Set_output_newline(true);
skip_punch = false;
} }
void PBasic:: void PBasic::

View File

@ -997,6 +997,7 @@ void Phreeqc::init(void)
numerical_deriv = FALSE; numerical_deriv = FALSE;
count_total_steps = 0; count_total_steps = 0;
phast = FALSE; phast = FALSE;
output_newline = true;
llnl_temp = 0; llnl_temp = 0;
llnl_count_temp = 0; llnl_count_temp = 0;
llnl_adh = 0; llnl_adh = 0;
@ -2304,6 +2305,7 @@ Phreeqc::InternalCopy(const Phreeqc *pSrc)
numerical_deriv = pSrc->numerical_deriv; numerical_deriv = pSrc->numerical_deriv;
count_total_steps = 0; count_total_steps = 0;
phast = FALSE; phast = FALSE;
output_newline = true;
/* /*
llnl_temp = 0; llnl_temp = 0;
llnl_count_temp = 0; llnl_count_temp = 0;

View File

@ -1697,6 +1697,9 @@ protected:
int count_total_steps; int count_total_steps;
int phast; int phast;
bool output_newline;
inline void Set_output_newline(bool tf) { this->output_newline = tf;}
inline bool Get_output_newline() { return this->output_newline;}
LDBLE *llnl_temp, *llnl_adh, *llnl_bdh, *llnl_bdot, *llnl_co2_coefs, a_llnl, b_llnl; LDBLE *llnl_temp, *llnl_adh, *llnl_bdh, *llnl_bdot, *llnl_co2_coefs, a_llnl, b_llnl;
int llnl_count_temp, llnl_count_adh, llnl_count_bdh, llnl_count_bdot, int llnl_count_temp, llnl_count_adh, llnl_count_bdh, llnl_count_bdot,
llnl_count_co2_coefs; llnl_count_co2_coefs;

View File

@ -39,7 +39,6 @@ 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
// //

View File

@ -83,7 +83,6 @@ 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;}
@ -108,7 +107,6 @@ 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;}
@ -183,7 +181,7 @@ protected:
bool charge_balance; bool charge_balance;
bool percent_error; bool percent_error;
bool new_line; bool new_line;
bool punch_newline; //bool punch_newline;
// as-is set flags // as-is set flags
bool set_user_punch; bool set_user_punch;

View File

@ -195,9 +195,9 @@ punch_all(void)
/* /*
* new line for punch_file * new line for punch_file
*/ */
if (current_selected_output->Get_new_line() && current_selected_output->Get_punch_newline()) if (current_selected_output->Get_new_line() && this->Get_output_newline())
punch_msg("\n"); punch_msg("\n");
current_selected_output->Set_punch_newline(true); this->Set_output_newline(true);
/* /*
* signal end of row * signal end of row
@ -2399,7 +2399,10 @@ print_user_print(void)
{ {
error_msg("Fatal Basic error in USER_PRINT.", STOP); error_msg("Fatal Basic error in USER_PRINT.", STOP);
} }
output_msg(sformatf("\n")); if (this->output_newline) {
output_msg(sformatf("\n"));
}
this->Set_output_newline(true);
if (use.Get_kinetics_in() == TRUE) if (use.Get_kinetics_in() == TRUE)
{ {
use.Set_kinetics_ptr(kinetics_ptr); use.Set_kinetics_ptr(kinetics_ptr);