bugs linux caught, something different about when to print headings

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/branches/multi_punch@7874 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2013-08-01 20:35:33 +00:00
parent 1afe3e43f3
commit d436c9cf4f
7 changed files with 19 additions and 18 deletions

View File

@ -472,7 +472,7 @@ numtostr(char * Result, LDBLE n)
/* if ((n != 0 && fabs(n) < 1e-2) || fabs(n) >= 1e12) { */ /* if ((n != 0 && fabs(n) < 1e-2) || fabs(n) >= 1e12) { */
if (ceil(n) == floor(n)) if (ceil(n) == floor(n))
{ {
if (!PhreeqcPtr->current_selected_output != NULL && if (PhreeqcPtr->current_selected_output != NULL &&
!PhreeqcPtr->current_selected_output->Get_high_precision()) !PhreeqcPtr->current_selected_output->Get_high_precision())
{ {
sprintf(l_s, "%12.0f", (double) n); sprintf(l_s, "%12.0f", (double) n);
@ -484,7 +484,7 @@ numtostr(char * Result, LDBLE n)
} }
else else
{ {
if (!PhreeqcPtr->current_selected_output != NULL && if (PhreeqcPtr->current_selected_output != NULL &&
!PhreeqcPtr->current_selected_output->Get_high_precision()) !PhreeqcPtr->current_selected_output->Get_high_precision())
{ {
sprintf(l_s, "%12.4e", (double) n); sprintf(l_s, "%12.4e", (double) n);
@ -4397,7 +4397,7 @@ cmdpunch(struct LOC_exec *LINK)
if (n.stringval) if (n.stringval)
{ {
/* fputs(n.UU.sval, stdout); */ /* fputs(n.UU.sval, stdout); */
if (!PhreeqcPtr->current_selected_output != NULL && if (PhreeqcPtr->current_selected_output != NULL &&
!PhreeqcPtr->current_selected_output->Get_high_precision()) !PhreeqcPtr->current_selected_output->Get_high_precision())
{ {
if (strlen(n.UU.sval) <= 12) if (strlen(n.UU.sval) <= 12)
@ -4422,7 +4422,7 @@ cmdpunch(struct LOC_exec *LINK)
} }
PhreeqcPtr->PHRQ_free(n.UU.sval); PhreeqcPtr->PHRQ_free(n.UU.sval);
} }
else if (!PhreeqcPtr->current_selected_output != NULL && else if (PhreeqcPtr->current_selected_output != NULL &&
!PhreeqcPtr->current_selected_output->Get_high_precision()) !PhreeqcPtr->current_selected_output->Get_high_precision())
{ {
PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%12.4e\t", (double) n.UU.val); PhreeqcPtr->fpunchf_user(PhreeqcPtr->n_user_punch_index, "%12.4e\t", (double) n.UU.val);

View File

@ -38,7 +38,7 @@ SelectedOutput::SelectedOutput(int n, PHRQ_io *io)
this->user_punch = true; this->user_punch = true;
this->charge_balance = false; this->charge_balance = false;
this->percent_error = false; this->percent_error = false;
this->punch = false; //this->punch = false;
} }
@ -76,4 +76,4 @@ SelectedOutput::Set_file_name(int n)
std::ostringstream os; std::ostringstream os;
os << "selected_output_" << n << ".sel"; os << "selected_output_" << n << ".sel";
file_name = os.str(); file_name = os.str();
} }

View File

@ -42,7 +42,7 @@ public:
bool Get_charge_balance(void) {return this->charge_balance;} bool Get_charge_balance(void) {return this->charge_balance;}
bool Get_percent_error(void) {return this->percent_error;} bool Get_percent_error(void) {return this->percent_error;}
bool Get_inverse(void) {return this->inverse;} bool Get_inverse(void) {return this->inverse;}
bool Get_punch(void) {return this->punch;} //bool Get_punch(void) {return this->punch;}
bool Get_active(void) {return this->active;} bool Get_active(void) {return this->active;}
void Set_file_name(int i); void Set_file_name(int i);
@ -67,7 +67,7 @@ public:
void Set_charge_balance(bool tf) {this->charge_balance = tf;} void Set_charge_balance(bool tf) {this->charge_balance = tf;}
void Set_percent_error(bool tf) {this->percent_error = tf;} void Set_percent_error(bool tf) {this->percent_error = tf;}
void Set_inverse(bool tf) {this->inverse = tf;} void Set_inverse(bool tf) {this->inverse = tf;}
void Set_punch(bool tf) {this->punch = tf;} //void Set_punch(bool tf) {this->punch = tf;}
void Set_active(bool tf) {this->active = tf;} void Set_active(bool tf) {this->active = tf;}
std::string file_name; std::string file_name;
@ -103,6 +103,6 @@ public:
bool charge_balance; bool charge_balance;
bool percent_error; bool percent_error;
bool inverse; bool inverse;
bool punch; //bool punch;
}; };
#endif // !defined(SELECTEDOUTPUT_H_INCLUDED) #endif // !defined(SELECTEDOUTPUT_H_INCLUDED)

View File

@ -930,12 +930,12 @@ punch_calculate_values(void)
} }
if (!current_selected_output->Get_high_precision()) if (!current_selected_output->Get_high_precision())
{ {
fpunchf(sformatf("V_%s", current_selected_output->Get_calculate_values()[i].first), fpunchf(sformatf("V_%s", current_selected_output->Get_calculate_values()[i].first.c_str()),
"%12.4e\t", (double) result); "%12.4e\t", (double) result);
} }
else else
{ {
fpunchf(sformatf("V_%s", current_selected_output->Get_calculate_values()[i].first), fpunchf(sformatf("V_%s", current_selected_output->Get_calculate_values()[i].first.c_str()),
"%20.12e\t", (double) result); "%20.12e\t", (double) result);
} }
} }

View File

@ -4970,7 +4970,7 @@ read_selected_output(void)
temp_selected_output.Set_new_def(true); temp_selected_output.Set_new_def(true);
warning_msg("Use PRINT; -selected_output, not SELECTED_OUTPUT; -selected_output"); warning_msg("Use PRINT; -selected_output, not SELECTED_OUTPUT; -selected_output");
value = get_true_false(next_char, TRUE); value = get_true_false(next_char, TRUE);
temp_selected_output.Set_punch(value!=FALSE); temp_selected_output.Set_active(value!=FALSE);
opt_save = OPTION_ERROR; opt_save = OPTION_ERROR;
break; break;
case 49: /* active */ case 49: /* active */

View File

@ -1033,7 +1033,7 @@ dump_cpp(void)
fs << token; fs << token;
for (size_t i = 0; i < current_selected_output->Get_molalities().size(); i++) for (size_t i = 0; i < current_selected_output->Get_molalities().size(); i++)
{ {
sprintf(token, " %s", current_selected_output->Get_molalities()[i].first.size()); sprintf(token, " %s", current_selected_output->Get_molalities()[i].first.c_str());
fs << token; fs << token;
} }
sprintf(token, "\n"); sprintf(token, "\n");
@ -1151,7 +1151,7 @@ dump_cpp(void)
} }
sprintf(token, "\t-length\n"); sprintf(token, "\t-length\n");
fs << token; fs << token;
for (size_t i = 0; i < count_cells; i++) for (int i = 0; i < count_cells; i++)
{ {
sprintf(token, "%12.3e", (double) cell_data[i].length); sprintf(token, "%12.3e", (double) cell_data[i].length);
fs << token; fs << token;
@ -1165,7 +1165,7 @@ dump_cpp(void)
fs << token; fs << token;
sprintf(token, "\t-disp\n"); sprintf(token, "\t-disp\n");
fs << token; fs << token;
for (size_t i = 0; i < count_cells; i++) for (int i = 0; i < count_cells; i++)
{ {
if (current_selected_output != NULL && !current_selected_output->Get_high_precision()) if (current_selected_output != NULL && !current_selected_output->Get_high_precision())
{ {
@ -1192,7 +1192,7 @@ dump_cpp(void)
else else
j = count_cells; j = count_cells;
l = 0; l = 0;
for (size_t i = 0; i < j; i++) for (int i = 0; i < j; i++)
{ {
if (cell_data[i].punch != TRUE) if (cell_data[i].punch != TRUE)
continue; continue;
@ -1214,7 +1214,7 @@ dump_cpp(void)
else else
j = count_cells; j = count_cells;
l = 0; l = 0;
for (size_t i = 0; i < j; i++) for (int i = 0; i < j; i++)
{ {
if (cell_data[i].print != TRUE) if (cell_data[i].print != TRUE)
continue; continue;

View File

@ -1781,6 +1781,7 @@ tidy_punch(void)
current_selected_output = &(so_it->second); current_selected_output = &(so_it->second);
if (pr.punch == FALSE || if (pr.punch == FALSE ||
current_selected_output == NULL || current_selected_output == NULL ||
!current_selected_output->Get_active() ||
current_selected_output->punch_ostream == NULL) current_selected_output->punch_ostream == NULL)
continue; continue;
phrq_io->Set_punch_ostream(current_selected_output->punch_ostream); phrq_io->Set_punch_ostream(current_selected_output->punch_ostream);