Working on IPhreeqc Basic callback. Compiles with ISO_C_BINDING, but may need some more debugging.

Need to merge this change with PhreeqcRM-trunk.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@9424 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2015-03-27 22:03:36 +00:00
parent 793df0c22a
commit ab440058fb
2 changed files with 21 additions and 1 deletions

View File

@ -86,7 +86,11 @@ public:
void basic_free(void);
double basic_callback(double x1, double x2, char * str);
void register_basic_callback(double ( *fcn)(double x1, double x2, const char *str, void *cookie), void *cookie1);
#ifdef IPHREEQC_NO_FORTRAN_MODULE
void register_fortran_basic_callback(double ( *fcn)(double *x1, double *x2, char *str, size_t l));
#else
void register_fortran_basic_callback(double ( *fcn)(double *x1, double *x2, char *str));
#endif
LDBLE activity(const char *species_name);
LDBLE activity_coefficient(const char *species_name);
@ -1718,7 +1722,11 @@ protected:
PBasic * basic_interpreter;
double (*basic_callback_ptr) (double x1, double x2, const char *str, void *cookie);
void *basic_callback_cookie;
#ifdef IPHREEQC_NO_FORTRAN_MODULE
double (*basic_fortran_callback_ptr) (double *x1, double *x2, char *str, size_t l);
#else
double (*basic_fortran_callback_ptr) (double *x1, double *x2, char *str);
#endif
/* cl1.cpp ------------------------------- */
LDBLE *x_arg, *res_arg, *scratch;

View File

@ -3873,7 +3873,11 @@ basic_callback(double x1, double x2, char * str)
}
if (basic_fortran_callback_ptr != NULL)
{
#ifdef IPHREEQC_NO_FORTRAN_MODULE
return (*basic_fortran_callback_ptr) (&local_x1, &local_x2, str, (int) strlen(str));
#else
return (*basic_fortran_callback_ptr) (&local_x1, &local_x2, str);
#endif
}
return 0;
}
@ -3884,9 +3888,17 @@ Phreeqc::register_basic_callback(double (*fcn)(double x1, double x2, const char
this->basic_callback_ptr = fcn;
this->basic_callback_cookie = cookie1;
}
#ifdef IPHREEQC_NO_FORTRAN_MODULE
void
Phreeqc::register_fortran_basic_callback(double ( *fcn)(double *x1, double *x2, char *str, size_t l))
{
this->basic_fortran_callback_ptr = fcn;
}
#else
void
Phreeqc::register_fortran_basic_callback(double ( *fcn)(double *x1, double *x2, char *str))
{
this->basic_fortran_callback_ptr = fcn;
}
#endif