functions are fcn

Added cookie to c callback.



git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@7895 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2013-08-08 19:53:31 +00:00
parent aaa8dfd905
commit 329d568dbf
13 changed files with 37 additions and 36 deletions

View File

@ -728,14 +728,14 @@ int IPhreeqc::RunString(const char* input)
return this->PhreeqcPtr->get_input_errors(); return this->PhreeqcPtr->get_input_errors();
} }
void IPhreeqc::SetBasicCallback(double (*cookie)(double x1, double x2, const char *str)) void IPhreeqc::SetBasicCallback(double (*fcn)(double x1, double x2, const char *str, void *cookie), void *cookie1)
{ {
this->PhreeqcPtr->register_basic_callback(cookie); this->PhreeqcPtr->register_basic_callback(fcn, cookie1);
} }
void IPhreeqc::SetBasicFortranCallback(double (*cookie)(double *x1, double *x2, char *str, int l)) void IPhreeqc::SetBasicFortranCallback(double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
this->PhreeqcPtr->register_fortran_basic_callback(cookie); this->PhreeqcPtr->register_fortran_basic_callback(fcn);
} }
void IPhreeqc::SetDumpFileName(const char *filename) void IPhreeqc::SetDumpFileName(const char *filename)

View File

@ -1533,16 +1533,17 @@ Headings
* @htmlonly * @htmlonly
* <CODE> * <CODE>
* <PRE> * <PRE>
* FUNCTION SetBasicCallback(ID,COOKIE) * FUNCTION SetBasicCallback(ID,fcn,cookie)
* INTEGER :: ID * INTEGER :: ID
* double (*cookie)(double x1, double x2, const char *str) * double (*fcn)(double x1, double x2, const char *str, void *)
* INTEGER :: SetBasicCallback * void * cookie :: SetBasicCallback
* integer SetBasicCallback
* END FUNCTION SetBasicCallback * END FUNCTION SetBasicCallback
* </PRE> * </PRE>
* </CODE> * </CODE>
* @endhtmlonly * @endhtmlonly
*/ */
IPQ_DLL_EXPORT IPQ_RESULT SetBasicCallback(int id, double (*cookie)(double x1, double x2, const char *str)); IPQ_DLL_EXPORT IPQ_RESULT SetBasicCallback(int id, double (*fcn)(double x1, double x2, const char *str, void *cookie), void *cookie1);
/** /**
* Sets Fortran callback function for the Basic interpreter. * Sets Fortran callback function for the Basic interpreter.
@ -1554,10 +1555,10 @@ Headings
* @htmlonly * @htmlonly
* <CODE> * <CODE>
* <PRE> * <PRE>
* FUNCTION SetBasicFortranCallback(ID,COOKIE) * FUNCTION SetBasicFortranCallback(ID,fcn)
* INTEGER(KIND=4), INTENT(IN) :: ID * INTEGER(KIND=4), INTENT(IN) :: ID
* INTERFACE * INTERFACE
* DOUBLE PRECISION FUNCTION cookie(x1, x2, str) * DOUBLE PRECISION FUNCTION fcn(x1, x2, str)
* DOUBLE PRECISION, INTENT(in) :: x1 * DOUBLE PRECISION, INTENT(in) :: x1
* DOUBLE PRECISION, INTENT(in) :: x2 * DOUBLE PRECISION, INTENT(in) :: x2
* CHARACTER(*), INTENT(in) :: str * CHARACTER(*), INTENT(in) :: str
@ -1569,7 +1570,7 @@ Headings
* </CODE> * </CODE>
* @endhtmlonly * @endhtmlonly
*/ */
IPQ_DLL_EXPORT IPQ_RESULT SetBasicFortranCallback(int id, double (*cookie)(double *x1, double *x2, char *str, int l)); IPQ_DLL_EXPORT IPQ_RESULT SetBasicFortranCallback(int id, double (*fcn)(double *x1, double *x2, char *str, int l));
/** /**

View File

@ -662,7 +662,7 @@ public:
* @param cookie The name of a user-defined function * @param cookie The name of a user-defined function
* @see SetBasicFortranCallback * @see SetBasicFortranCallback
*/ */
void SetBasicCallback(double (*cookie)(double x1, double x2, const char *str)); void SetBasicCallback(double (*fcn)(double x1, double x2, const char *str, void *cookie), void * cookie1);
/** /**
* Sets a Fortran callback function for Basic programs. The syntax for the Basic command is * Sets a Fortran callback function for Basic programs. The syntax for the Basic command is
@ -672,7 +672,7 @@ public:
* @param cookie The name of a user-defined double precision function with three arguments (two double precision, one character). * @param cookie The name of a user-defined double precision function with three arguments (two double precision, one character).
* @see SetBasicCallback * @see SetBasicCallback
*/ */
void SetBasicFortranCallback(double (*cookie)(double *x1, double *x2, char *str, int l)); void SetBasicFortranCallback(double (*fcn)(double *x1, double *x2, char *str, int l));
/** /**
* Runs the specified string as input to phreeqc. * Runs the specified string as input to phreeqc.

View File

@ -715,24 +715,24 @@ RunString(int id, const char* input)
} }
IPQ_RESULT IPQ_RESULT
SetBasicCallback(int id, double (*cookie)(double x1, double x2, const char *str)) SetBasicCallback(int id, double (*fcn)(double x1, double x2, const char *str, void *cookie), void *cookie1)
{ {
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id); IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr) if (IPhreeqcPtr)
{ {
IPhreeqcPtr->SetBasicCallback(cookie); IPhreeqcPtr->SetBasicCallback(fcn, cookie1);
return IPQ_OK; return IPQ_OK;
} }
return IPQ_BADINSTANCE; return IPQ_BADINSTANCE;
} }
IPQ_RESULT IPQ_RESULT
SetBasicFortranCallback(int id, double (*cookie)(double *x1, double *x2, char *str, int l)) SetBasicFortranCallback(int id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id); IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
if (IPhreeqcPtr) if (IPhreeqcPtr)
{ {
IPhreeqcPtr->SetBasicFortranCallback(cookie); IPhreeqcPtr->SetBasicFortranCallback(fcn);
return IPQ_OK; return IPQ_OK;
} }
return IPQ_BADINSTANCE; return IPQ_BADINSTANCE;

View File

@ -450,9 +450,9 @@ RunStringF(int *id, char* input, unsigned int input_length)
} }
IPQ_RESULT IPQ_RESULT
SetBasicFortranCallbackF(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) SetBasicFortranCallbackF(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return ::SetBasicFortranCallback(*id, cookie); return ::SetBasicFortranCallback(*id, fcn);
} }
IPQ_RESULT IPQ_RESULT
@ -799,9 +799,9 @@ IPQ_DLL_EXPORT int __stdcall RUNSTRING(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int __stdcall SETBASICFORTRANCALBACK(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int __stdcall SETBASICFORTRANCALBACK(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int __stdcall SETDUMPFILENAME(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int __stdcall SETDUMPFILENAME(int *id, char *filename, unsigned int len)
{ {

View File

@ -137,7 +137,7 @@ extern "C" {
IPQ_RESULT SetSelectedOutputFileNameF(int *id, char* fname, unsigned int fname_length); IPQ_RESULT SetSelectedOutputFileNameF(int *id, char* fname, unsigned int fname_length);
IPQ_RESULT SetSelectedOutputFileOnF(int *id, int* selected_output_file_on); IPQ_RESULT SetSelectedOutputFileOnF(int *id, int* selected_output_file_on);
IPQ_RESULT SetSelectedOutputStringOnF(int *id, int* selected_output_string_on); IPQ_RESULT SetSelectedOutputStringOnF(int *id, int* selected_output_string_on);
IPQ_RESULT SetBasicFortranCallbackF(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)); IPQ_RESULT SetBasicFortranCallbackF(int *id, double (*fcn)(double *x1, double *x2, char *str, int l));
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@ -199,9 +199,9 @@ IPQ_DLL_EXPORT int RUNSTRING(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int SETBASICFORTRANCALLBACK(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int SETBASICFORTRANCALLBACK(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int SETDUMPFILENAME(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int SETDUMPFILENAME(int *id, char *filename, unsigned int len)
{ {

View File

@ -200,9 +200,9 @@ IPQ_DLL_EXPORT int runstring_(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int setbasicfortrancallback_(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int setbasicfortrancallback_(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int setdumpfilename_(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int setdumpfilename_(int *id, char *filename, unsigned int len)
{ {

View File

@ -200,9 +200,9 @@ IPQ_DLL_EXPORT int runstring(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int setbasicfortrancallback(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int setbasicfortrancallback(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int setdumpfilename(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int setdumpfilename(int *id, char *filename, unsigned int len)
{ {

View File

@ -200,9 +200,9 @@ IPQ_DLL_EXPORT int RUNSTRING_(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int SETBASICFORTRANCALLBACK_(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int SETBASICFORTRANCALLBACK_(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int SETDUMPFILENAME_(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int SETDUMPFILENAME_(int *id, char *filename, unsigned int len)
{ {

View File

@ -201,9 +201,9 @@ IPQ_DLL_EXPORT int __stdcall RUNSTRING_(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int __stdcall SETBASICFORTRANCALLBACK_(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int __stdcall SETBASICFORTRANCALLBACK_(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int __stdcall SETDUMPFILENAME_(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int __stdcall SETDUMPFILENAME_(int *id, char *filename, unsigned int len)
{ {

View File

@ -200,9 +200,9 @@ IPQ_DLL_EXPORT int __stdcall runstring_(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int __stdcall setbasicfortrancallback_(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int __stdcall setbasicfortrancallback_(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int __stdcall setdumpfilename_(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int __stdcall setdumpfilename_(int *id, char *filename, unsigned int len)
{ {

View File

@ -200,9 +200,9 @@ IPQ_DLL_EXPORT int __stdcall runstring(int *id, char *input, unsigned int len)
{ {
return RunStringF(id, input, len); return RunStringF(id, input, len);
} }
IPQ_DLL_EXPORT int __stdcall setbasicfortrancallback(int *id, double (*cookie)(double *x1, double *x2, char *str, int l)) IPQ_DLL_EXPORT int __stdcall setbasicfortrancallback(int *id, double (*fcn)(double *x1, double *x2, char *str, int l))
{ {
return SetBasicFortranCallbackF(id, cookie); return SetBasicFortranCallbackF(id, fcn);
} }
IPQ_DLL_EXPORT int __stdcall setdumpfilename(int *id, char *filename, unsigned int len) IPQ_DLL_EXPORT int __stdcall setdumpfilename(int *id, char *filename, unsigned int len)
{ {