mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
updated for R
git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@10311 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
190128c155
commit
64703778f0
46
PBasic.cpp
46
PBasic.cpp
@ -484,7 +484,9 @@ numtostr(char * Result, LDBLE n)
|
||||
if (l_s == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
l_s[PhreeqcPtr->max_line - 1] = '\0';
|
||||
/* if ((n != 0 && fabs(n) < 1e-2) || fabs(n) >= 1e12) { */
|
||||
@ -609,7 +611,9 @@ parse(char * l_inbuf, tokenrec ** l_buf)
|
||||
if (t->UU.sp == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
strncpy(t->UU.sp, l_inbuf + begin - 1, j);
|
||||
t->UU.sp[j] = '\0';
|
||||
@ -734,7 +738,9 @@ parse(char * l_inbuf, tokenrec ** l_buf)
|
||||
if (t->UU.sp == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
sprintf(t->UU.sp, "%.*s",
|
||||
(int) (strlen(l_inbuf) - i + 1),
|
||||
@ -754,7 +760,9 @@ parse(char * l_inbuf, tokenrec ** l_buf)
|
||||
if (v == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
v->UU.U0.arr = NULL;
|
||||
v->next = varbase;
|
||||
@ -1688,7 +1696,9 @@ parseinput(tokenrec ** l_buf)
|
||||
if (l1 == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
l1->next = l;
|
||||
if (l0 == NULL)
|
||||
@ -1873,7 +1883,9 @@ require(int k, struct LOC_exec *LINK)
|
||||
strcpy(str, ": missing ");
|
||||
snerr(strcat(str, item->first.c_str()));
|
||||
}
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
LINK->t = LINK->t->next;
|
||||
}
|
||||
@ -1887,7 +1899,9 @@ skipparen(struct LOC_exec *LINK)
|
||||
if (LINK->t == NULL)
|
||||
{
|
||||
snerr(": parenthesis missing");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
if (LINK->t->kind == tokrp || LINK->t->kind == tokcomma)
|
||||
goto _L1;
|
||||
@ -1913,7 +1927,9 @@ findvar(struct LOC_exec *LINK)
|
||||
if (LINK->t == NULL || LINK->t->kind != tokvar)
|
||||
{
|
||||
snerr(": can`t find variable");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
v = LINK->t->UU.vp;
|
||||
LINK->t = LINK->t->next;
|
||||
@ -2562,7 +2578,9 @@ factor(struct LOC_exec * LINK)
|
||||
if (LINK->t->kind != tokvar || !count_varrec || count_varrec->stringvar != 0)
|
||||
{
|
||||
snerr(": can`t find variable");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* return number of names of species */
|
||||
@ -2572,7 +2590,9 @@ factor(struct LOC_exec * LINK)
|
||||
if (LINK->t->kind != tokvar || !names_varrec || names_varrec->stringvar != 1)
|
||||
{
|
||||
snerr(": can`t find name of species");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* return number of types of species */
|
||||
@ -2619,19 +2639,25 @@ factor(struct LOC_exec * LINK)
|
||||
if (names_arg == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
types_arg = (char **)PhreeqcPtr->PHRQ_calloc((size_t) (count_sys + 1), sizeof(char *));
|
||||
if (types_arg == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
moles_arg = (LDBLE *) PhreeqcPtr->PHRQ_calloc((size_t) (count_sys + 1), sizeof(LDBLE));
|
||||
if (moles_arg == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
names_arg[0] = NULL;
|
||||
types_arg[0] = NULL;
|
||||
@ -2692,7 +2718,9 @@ factor(struct LOC_exec * LINK)
|
||||
if (LINK->t->kind != tokvar || !count_varrec || count_varrec->stringvar != 0)
|
||||
{
|
||||
snerr(": Missing or wrong type count variable.");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
// variable for species names
|
||||
LINK->t = LINK->t->next;
|
||||
@ -2701,7 +2729,9 @@ factor(struct LOC_exec * LINK)
|
||||
if (LINK->t->kind != tokvar || !names_varrec || names_varrec->stringvar != 1)
|
||||
{
|
||||
snerr(": Missing or wrong type name variable.");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
// variable for species concentrations
|
||||
LINK->t = LINK->t->next;
|
||||
@ -2738,13 +2768,17 @@ factor(struct LOC_exec * LINK)
|
||||
if (names_arg == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
moles_arg = (LDBLE *) PhreeqcPtr->PHRQ_calloc((size_t) (count_sys + 1), sizeof(LDBLE));
|
||||
if (moles_arg == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
names_arg[0] = NULL;
|
||||
moles_arg[0] = 0;
|
||||
@ -2815,7 +2849,9 @@ factor(struct LOC_exec * LINK)
|
||||
else
|
||||
{
|
||||
snerr(": Expected 4 arguments for list_s_s");
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
require(tokrp, LINK);
|
||||
|
||||
@ -2848,13 +2884,17 @@ factor(struct LOC_exec * LINK)
|
||||
if (names_varrec->UU.U1.sarr == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
moles_varrec->UU.U0.arr = (LDBLE *) PhreeqcPtr->PHRQ_malloc((count + 1) * sizeof(LDBLE));
|
||||
if (moles_varrec->UU.U0.arr == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
// first position not used
|
||||
@ -3052,13 +3092,17 @@ factor(struct LOC_exec * LINK)
|
||||
if (elts_varrec->UU.U1.sarr == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
coef_varrec->UU.U0.arr = (LDBLE *) PhreeqcPtr->PHRQ_malloc((count + 1) * sizeof(LDBLE));
|
||||
if (coef_varrec->UU.U0.arr == NULL)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
// first position not used
|
||||
@ -5490,7 +5534,9 @@ cmddim(struct LOC_exec *LINK)
|
||||
if (!v->UU.U1.sarr)
|
||||
{
|
||||
PhreeqcPtr->malloc_error();
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
if (v->UU.U1.sarr == NULL)
|
||||
PhreeqcPtr->malloc_error();
|
||||
|
||||
@ -79,7 +79,9 @@ inverse_models(void)
|
||||
{
|
||||
error_string = sformatf( "Can`t open file, %s.", string);
|
||||
error_msg(error_string, STOP);
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
count_inverse_models = 0;
|
||||
count_pat_solutions = 0;
|
||||
@ -4082,7 +4084,9 @@ dump_netpath(struct inverse *inverse_ptr)
|
||||
{
|
||||
error_string = sformatf( "Can`t open file, %s.", inverse_ptr->netpath);
|
||||
error_msg(error_string, STOP);
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
add_to_file("netpath.fil", inverse_ptr->netpath);
|
||||
|
||||
@ -5280,7 +5284,9 @@ add_to_file(const char *filename, const char *string)
|
||||
{
|
||||
error_string = sformatf( "Can`t open file, %s.", filename);
|
||||
error_msg(error_string, STOP);
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
i = 0;
|
||||
/*
|
||||
|
||||
@ -908,7 +908,9 @@ punch_calculate_values(void)
|
||||
"Definition not found for CALCULATE_VALUES %s.",
|
||||
current_selected_output->Get_calculate_values()[i].first.c_str());
|
||||
error_msg(error_string, STOP);
|
||||
#if !defined(R_SO)
|
||||
exit(4);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (calculate_value_ptr->calculated == FALSE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user