mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
working on fortran interfaces
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@4349 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
3943216561
commit
0f8c1d7b74
@ -42,32 +42,33 @@ C
|
||||
C function prototypes
|
||||
C
|
||||
|
||||
INTEGER AccumulateLine
|
||||
INTEGER CreateIPhreeqc
|
||||
INTEGER DestroyIPhreeqc
|
||||
C INTEGER GetComponent
|
||||
INTEGER GetComponentCount
|
||||
INTEGER GetDumpLine
|
||||
INTEGER GetDumpLineCount
|
||||
INTEGER GetErrorLine
|
||||
INTEGER GetErrorLineCount
|
||||
INTEGER GetSelectedOutputColumnCount
|
||||
INTEGER GetSelectedOutputRowCount
|
||||
INTEGER GetSelectedOutputValue
|
||||
INTEGER GetWarningLine
|
||||
INTEGER GetWarningLineCount
|
||||
INTEGER LoadDatabase
|
||||
INTEGER LoadDatabaseString
|
||||
C INTEGER OutputLastError
|
||||
C INTEGER OutputLastWarning
|
||||
INTEGER OutputLines
|
||||
INTEGER RunAccumulated
|
||||
INTEGER RunFile
|
||||
INTEGER RunString
|
||||
INTEGER SetDumpOn
|
||||
INTEGER SetDumpStringOn
|
||||
INTEGER SetErrorOn
|
||||
INTEGER SetLogOn
|
||||
INTEGER SetOutputOn
|
||||
INTEGER SetSelectedOutputOn
|
||||
INTEGER UnLoadDatabase
|
||||
INTEGER(KIND=4) AccumulateLine
|
||||
INTEGER(KIND=4) CreateIPhreeqc
|
||||
INTEGER(KIND=4) DestroyIPhreeqc
|
||||
INTEGER(KIND=4) GetComponent
|
||||
INTEGER(KIND=4) GetComponentCount
|
||||
INTEGER(KIND=4) GetDumpLine
|
||||
INTEGER(KIND=4) GetDumpLineCount
|
||||
INTEGER(KIND=4) GetErrorLine
|
||||
INTEGER(KIND=4) GetErrorLineCount
|
||||
LOGICAL(KIND=4) GetOutputOn
|
||||
INTEGER(KIND=4) GetSelectedOutputColumnCount
|
||||
INTEGER(KIND=4) GetSelectedOutputRowCount
|
||||
INTEGER(KIND=4) GetSelectedOutputValue
|
||||
INTEGER(KIND=4) GetWarningLine
|
||||
INTEGER(KIND=4) GetWarningLineCount
|
||||
INTEGER(KIND=4) LoadDatabase
|
||||
INTEGER(KIND=4) LoadDatabaseString
|
||||
INTEGER(KIND=4) OutputLastError
|
||||
INTEGER(KIND=4) OutputLastWarning
|
||||
INTEGER(KIND=4) OutputLines
|
||||
INTEGER(KIND=4) RunAccumulated
|
||||
INTEGER(KIND=4) RunFile
|
||||
INTEGER(KIND=4) RunString
|
||||
INTEGER(KIND=4) SetDumpOn
|
||||
INTEGER(KIND=4) SetDumpStringOn
|
||||
INTEGER(KIND=4) SetErrorOn
|
||||
INTEGER(KIND=4) SetLogOn
|
||||
INTEGER(KIND=4) SetOutputOn
|
||||
INTEGER(KIND=4) SetSelectedOutputOn
|
||||
INTEGER(KIND=4) UnLoadDatabase
|
||||
|
||||
@ -73,11 +73,20 @@
|
||||
END INTERFACE
|
||||
|
||||
|
||||
!!! TODO GetDumpOn
|
||||
INTERFACE
|
||||
FUNCTION GetDumpOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetDumpOn
|
||||
END FUNCTION GetDumpOn
|
||||
END INTERFACE
|
||||
|
||||
!!! GetDumpString not implemented
|
||||
|
||||
!!! TODO GetDumpStringOn
|
||||
INTERFACE
|
||||
FUNCTION GetDumpStringOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetDumpOn
|
||||
END FUNCTION GetDumpStringOn
|
||||
END INTERFACE
|
||||
|
||||
|
||||
INTERFACE
|
||||
@ -97,19 +106,28 @@
|
||||
END INTERFACE
|
||||
|
||||
|
||||
!!! TODO GetErrorOn
|
||||
INTERFACE
|
||||
FUNCTION GetErrorOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetErrorOn
|
||||
END FUNCTION GetErrorOn
|
||||
END INTERFACE
|
||||
|
||||
|
||||
!!! GetErrorString not implemented
|
||||
INTERFACE
|
||||
FUNCTION GetLogOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetLogOn
|
||||
END FUNCTION GetLogOn
|
||||
END INTERFACE
|
||||
|
||||
|
||||
!!! GetWarningString not implemented
|
||||
|
||||
|
||||
!!! TODO GetLogOn
|
||||
|
||||
|
||||
!!! TODO GetOutputOn
|
||||
INTERFACE
|
||||
FUNCTION GetOutputOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetOutputOn
|
||||
END FUNCTION GetOutputOn
|
||||
END INTERFACE
|
||||
|
||||
|
||||
INTERFACE
|
||||
@ -120,7 +138,12 @@
|
||||
END INTERFACE
|
||||
|
||||
|
||||
!!! TODO GetSelectedOutputOn
|
||||
INTERFACE
|
||||
FUNCTION GetSelectedOutputOn(ID)
|
||||
INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
LOGICAL(KIND=4) :: GetSelectedOutputOn
|
||||
END FUNCTION GetSelectedOutputOn
|
||||
END INTERFACE
|
||||
|
||||
|
||||
INTERFACE
|
||||
|
||||
@ -308,15 +308,6 @@ extern "C" {
|
||||
DLL_EXPORT const char* GetErrorString(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the warning messages from the last call to \ref RunAccumulated, \ref RunFile, \ref LoadDatabase, or \ref LoadDatabaseString.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
* @par Fortran90 Interface:
|
||||
* Not implemented. (see \ref GetWarningLineCount, \ref GetWarningLine, \ref OutputWarning)
|
||||
*/
|
||||
DLL_EXPORT const char* GetWarningString(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the current value of the log flag.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
@ -623,6 +614,15 @@ Headings
|
||||
DLL_EXPORT int GetWarningLineCount(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the warning messages from the last call to \ref RunAccumulated, \ref RunFile, \ref LoadDatabase, or \ref LoadDatabaseString.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
* @par Fortran90 Interface:
|
||||
* Not implemented. (see \ref GetWarningLineCount, \ref GetWarningLine, \ref OutputWarning)
|
||||
*/
|
||||
DLL_EXPORT const char* GetWarningString(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Load the specified database file into phreeqc.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
@ -688,23 +688,6 @@ Headings
|
||||
DLL_EXPORT void OutputError(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Output the warning messages to stdout.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
* @par Fortran90 Interface:
|
||||
* @htmlonly
|
||||
* <CODE>
|
||||
* <PRE>
|
||||
* SUBROUTINE OutputWarning
|
||||
* INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
* END SUBROUTINE OutputWarning
|
||||
* </PRE>
|
||||
* </CODE>
|
||||
* @endhtmlonly
|
||||
*/
|
||||
DLL_EXPORT void OutputWarning(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Output the accumulated input to stdout. This is the input that will be
|
||||
* used for the next call to RunAccumulated.
|
||||
@ -723,6 +706,23 @@ Headings
|
||||
DLL_EXPORT void OutputLines(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Output the warning messages to stdout.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
* @par Fortran90 Interface:
|
||||
* @htmlonly
|
||||
* <CODE>
|
||||
* <PRE>
|
||||
* SUBROUTINE OutputWarning
|
||||
* INTEGER(KIND=4), INTENT(IN) :: ID
|
||||
* END SUBROUTINE OutputWarning
|
||||
* </PRE>
|
||||
* </CODE>
|
||||
* @endhtmlonly
|
||||
*/
|
||||
DLL_EXPORT void OutputWarning(int id);
|
||||
|
||||
|
||||
/**
|
||||
* Runs the accumulated input sent to AccumulateLine.
|
||||
* @param id The instance id returned from \ref CreateIPhreeqc.
|
||||
|
||||
316
src/IPhreeqcF.f
316
src/IPhreeqcF.f
@ -1,3 +1,12 @@
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION AccumulateLine(ID,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: AccumulateLine
|
||||
INTEGER(KIND=4) :: AccumulateLineF
|
||||
AccumulateLine = AccumulateLineF(ID,LINE)
|
||||
END FUNCTION AccumulateLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION CreateIPhreeqc()
|
||||
IMPLICIT NONE
|
||||
@ -13,6 +22,180 @@
|
||||
INTEGER(KIND=4) :: DestroyIPhreeqcF
|
||||
DestroyIPhreeqc = DestroyIPhreeqcF(ID)
|
||||
END FUNCTION DestroyIPhreeqc
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetComponent(ID,N,COMP)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: COMP
|
||||
INTEGER(KIND=4) :: GetComponent
|
||||
INTEGER(KIND=4) :: GetComponentF
|
||||
GetComponent = GetComponentF(ID,N,COMP)
|
||||
END FUNCTION GetComponent
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetComponentCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetComponentCount
|
||||
INTEGER(KIND=4) :: GetComponentCountF
|
||||
GetComponentCount = GetComponentCountF(ID)
|
||||
END FUNCTION GetComponentCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetDumpLine
|
||||
INTEGER(KIND=4) :: GetDumpLineF
|
||||
GetDumpLine = GetDumpLineF(ID,N,LINE)
|
||||
END FUNCTION GetDumpLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetDumpLineCount
|
||||
INTEGER(KIND=4) :: GetDumpLineCountF
|
||||
GetDumpLineCount = GetDumpLineCountF(ID)
|
||||
END FUNCTION GetDumpLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetDumpOn
|
||||
INTEGER(KIND=4) :: GetDumpOnF
|
||||
IF (GetDumpOnF(ID).EQ.0) THEN
|
||||
GetDumpOn = .FALSE.
|
||||
ELSE
|
||||
GetDumpOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetDumpOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpStringOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetDumpStringOn
|
||||
INTEGER(KIND=4) :: GetDumpStringOnF
|
||||
IF (GetDumpStringOnF(ID).EQ.0) THEN
|
||||
GetDumpStringOn = .FALSE.
|
||||
ELSE
|
||||
GetDumpStringOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetDumpStringOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetErrorLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetErrorLine
|
||||
INTEGER(KIND=4) :: GetErrorLineF
|
||||
GetErrorLine = GetErrorLineF(ID,N,LINE)
|
||||
END FUNCTION GetErrorLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetErrorLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetErrorLineCount
|
||||
INTEGER(KIND=4) :: GetErrorLineCountF
|
||||
GetErrorLineCount = GetErrorLineCountF(ID)
|
||||
END FUNCTION GetErrorLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetErrorOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetErrorOn
|
||||
INTEGER(KIND=4) :: GetErrorOnF
|
||||
IF (GetErrorOnF(ID).EQ.0) THEN
|
||||
GetErrorOn = .FALSE.
|
||||
ELSE
|
||||
GetErrorOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetErrorOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetLogOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetLogOn
|
||||
INTEGER(KIND=4) :: GetLogOnF
|
||||
IF (GetLogOnF(ID).EQ.0) THEN
|
||||
GetLogOn = .FALSE.
|
||||
ELSE
|
||||
GetLogOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetLogOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetOutputOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetOutputOn
|
||||
INTEGER(KIND=4) :: GetOutputOnF
|
||||
IF (GetOutputOnF(ID).EQ.0) THEN
|
||||
GetOutputOn = .FALSE.
|
||||
ELSE
|
||||
GetOutputOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetOutputOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputColumnCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetSelectedOutputColumnCount
|
||||
INTEGER(KIND=4) :: GetSelectedOutputColumnCountF
|
||||
GetSelectedOutputColumnCount = GetSelectedOutputColumnCountF(ID)
|
||||
END FUNCTION GetSelectedOutputColumnCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputOn(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
LOGICAL(KIND=4) :: GetSelectedOutputOn
|
||||
INTEGER(KIND=4) :: GetSelectedOutputOnF
|
||||
IF (GetSelectedOutputOnF(ID).EQ.0) THEN
|
||||
GetSelectedOutputOn = .FALSE.
|
||||
ELSE
|
||||
GetSelectedOutputOn = .TRUE.
|
||||
ENDIF
|
||||
END FUNCTION GetSelectedOutputOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputRowCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetSelectedOutputRowCount
|
||||
INTEGER(KIND=4) :: GetSelectedOutputRowCountF
|
||||
GetSelectedOutputRowCount = GetSelectedOutputRowCountF(ID)
|
||||
END FUNCTION GetSelectedOutputRowCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputValue(ID,ROW,COL,VTYPE,DVALUE,SVALUE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: ROW
|
||||
INTEGER(KIND=4) :: COL
|
||||
INTEGER(KIND=4) :: VTYPE
|
||||
REAL(KIND=8) :: DVALUE
|
||||
CHARACTER(LEN=*) :: SVALUE
|
||||
INTEGER(KIND=4) :: GetSelectedOutputValue
|
||||
INTEGER(KIND=4) :: GetSelectedOutputValueF
|
||||
GetSelectedOutputValue = GetSelectedOutputValueF(ID,ROW,
|
||||
& COL,VTYPE,DVALUE,SVALUE)
|
||||
END FUNCTION GetSelectedOutputValue
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetWarningLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetWarningLine
|
||||
INTEGER(KIND=4) :: GetWarningLineF
|
||||
GetWarningLine = GetWarningLineF(ID,N,LINE)
|
||||
END FUNCTION GetWarningLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetWarningLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetWarningLineCount
|
||||
INTEGER(KIND=4) :: GetWarningLineCountF
|
||||
GetWarningLineCount = GetWarningLineCountF(ID)
|
||||
END FUNCTION GetWarningLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION LoadDatabase(ID,FILENAME)
|
||||
IMPLICIT NONE
|
||||
@ -31,35 +214,24 @@
|
||||
INTEGER(KIND=4) :: LoadDatabaseStringF
|
||||
LoadDatabaseString = LoadDatabaseStringF(ID,INPUT)
|
||||
END FUNCTION LoadDatabaseString
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION UnLoadDatabase(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: UnLoadDatabase
|
||||
INTEGER(KIND=4) :: UnLoadDatabaseF
|
||||
UnLoadDatabase = UnLoadDatabaseF(ID)
|
||||
END FUNCTION UnLoadDatabase
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
SUBROUTINE OutputError(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CALL OutputErrorF(ID)
|
||||
END SUBROUTINE OutputError
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
SUBROUTINE OutputLines(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CALL OutputLinesF(ID)
|
||||
END SUBROUTINE OutputLines
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
SUBROUTINE OutputWarning(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CALL OutputWarningF(ID)
|
||||
END SUBROUTINE OutputWarning
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION AccumulateLine(ID,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: AccumulateLine
|
||||
INTEGER(KIND=4) :: AccumulateLineF
|
||||
AccumulateLine = AccumulateLineF(ID,LINE)
|
||||
END FUNCTION AccumulateLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION SetSelectedOutputOn(ID,SELECTED_ON)
|
||||
IMPLICIT NONE
|
||||
@ -114,60 +286,6 @@
|
||||
INTEGER(KIND=4) :: SetDumpStringOnF
|
||||
SetDumpStringOn = SetDumpStringOnF(ID,DUMP_STRING_ON)
|
||||
END FUNCTION SetDumpStringOn
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetDumpLineCount
|
||||
INTEGER(KIND=4) :: GetDumpLineCountF
|
||||
GetDumpLineCount = GetDumpLineCountF(ID)
|
||||
END FUNCTION GetDumpLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetDumpLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetDumpLine
|
||||
INTEGER(KIND=4) :: GetDumpLineF
|
||||
GetDumpLine = GetDumpLineF(ID,N,LINE)
|
||||
END FUNCTION GetDumpLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetErrorLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetErrorLineCount
|
||||
INTEGER(KIND=4) :: GetErrorLineCountF
|
||||
GetErrorLineCount = GetErrorLineCountF(ID)
|
||||
END FUNCTION GetErrorLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetErrorLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetErrorLine
|
||||
INTEGER(KIND=4) :: GetErrorLineF
|
||||
GetErrorLine = GetErrorLineF(ID,N,LINE)
|
||||
END FUNCTION GetErrorLine
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetComponentCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetComponentCount
|
||||
INTEGER(KIND=4) :: GetComponentCountF
|
||||
GetComponentCount = GetComponentCountF(ID)
|
||||
END FUNCTION GetComponentCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetComponent(ID,N,COMP)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: COMP
|
||||
INTEGER(KIND=4) :: GetComponent
|
||||
INTEGER(KIND=4) :: GetComponentF
|
||||
GetComponent = GetComponentF(ID,N,COMP)
|
||||
END FUNCTION GetComponent
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION RunAccumulated(ID)
|
||||
IMPLICIT NONE
|
||||
@ -195,56 +313,10 @@
|
||||
RunString = RunStringF(ID,INPUT)
|
||||
END FUNCTION RunString
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputRowCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetSelectedOutputRowCount
|
||||
INTEGER(KIND=4) :: GetSelectedOutputRowCountF
|
||||
GetSelectedOutputRowCount = GetSelectedOutputRowCountF(ID)
|
||||
END FUNCTION GetSelectedOutputRowCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputColumnCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetSelectedOutputColumnCount
|
||||
INTEGER(KIND=4) :: GetSelectedOutputColumnCountF
|
||||
GetSelectedOutputColumnCount = GetSelectedOutputColumnCountF(ID)
|
||||
END FUNCTION GetSelectedOutputColumnCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetSelectedOutputValue(ID,ROW,COL,VTYPE,DVALUE,SVALUE)
|
||||
FUNCTION UnLoadDatabase(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: ROW
|
||||
INTEGER(KIND=4) :: COL
|
||||
INTEGER(KIND=4) :: VTYPE
|
||||
REAL(KIND=8) :: DVALUE
|
||||
CHARACTER(LEN=*) :: SVALUE
|
||||
INTEGER(KIND=4) :: GetSelectedOutputValue
|
||||
INTEGER(KIND=4) :: GetSelectedOutputValueF
|
||||
GetSelectedOutputValue = GetSelectedOutputValueF(ID,ROW,
|
||||
& COL,VTYPE,DVALUE,SVALUE)
|
||||
END FUNCTION GetSelectedOutputValue
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
SUBROUTINE OutputLines(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
CALL OutputLinesF(ID)
|
||||
END SUBROUTINE OutputLines
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetWarningLineCount(ID)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: GetWarningLineCount
|
||||
INTEGER(KIND=4) :: GetWarningLineCountF
|
||||
GetWarningLineCount = GetWarningLineCountF(ID)
|
||||
END FUNCTION GetWarningLineCount
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
FUNCTION GetWarningLine(ID,N,LINE)
|
||||
IMPLICIT NONE
|
||||
INTEGER(KIND=4) :: ID
|
||||
INTEGER(KIND=4) :: N
|
||||
CHARACTER(LEN=*) :: LINE
|
||||
INTEGER(KIND=4) :: GetWarningLine
|
||||
INTEGER(KIND=4) :: GetWarningLineF
|
||||
GetWarningLine = GetWarningLineF(ID,N,LINE)
|
||||
END FUNCTION GetWarningLine
|
||||
INTEGER(KIND=4) :: UnLoadDatabase
|
||||
INTEGER(KIND=4) :: UnLoadDatabaseF
|
||||
UnLoadDatabase = UnLoadDatabaseF(ID)
|
||||
END FUNCTION UnLoadDatabase
|
||||
|
||||
498
src/fwrap.cpp
498
src/fwrap.cpp
@ -36,58 +36,6 @@ padfstring(char *dest, const char *src, unsigned int len)
|
||||
*dest++ = ' ';
|
||||
}
|
||||
|
||||
int
|
||||
CreateIPhreeqcF(void)
|
||||
{
|
||||
return ::CreateIPhreeqc();
|
||||
}
|
||||
|
||||
int
|
||||
DestroyIPhreeqcF(int *id)
|
||||
{
|
||||
return ::DestroyIPhreeqc(*id);
|
||||
}
|
||||
|
||||
int
|
||||
LoadDatabaseF(int *id, char* filename, unsigned int filename_length)
|
||||
{
|
||||
char* cfilename;
|
||||
|
||||
cfilename = f2cstring(filename, filename_length);
|
||||
if (!cfilename)
|
||||
{
|
||||
::AddError(*id, "LoadDatabase: Out of memory.\n");
|
||||
return VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::LoadDatabase(*id, cfilename);
|
||||
free(cfilename);
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
LoadDatabaseStringF(int *id, char* input, unsigned int input_length)
|
||||
{
|
||||
char* cinput;
|
||||
|
||||
cinput = f2cstring(input, input_length);
|
||||
if (!cinput)
|
||||
{
|
||||
::AddError(*id, "LoadDatabaseString: Out of memory.\n");
|
||||
return VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::LoadDatabaseString(*id, cinput);
|
||||
free(cinput);
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
UnLoadDatabaseF(int *id)
|
||||
{
|
||||
return ::UnLoadDatabase(*id);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
AccumulateLineF(int *id, char *line, unsigned int line_length)
|
||||
{
|
||||
@ -106,76 +54,16 @@ AccumulateLineF(int *id, char *line, unsigned int line_length)
|
||||
return n;
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetSelectedOutputOnF(int *id, int* sel_on)
|
||||
int
|
||||
CreateIPhreeqcF(void)
|
||||
{
|
||||
return ::SetSelectedOutputOn(*id, *sel_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetOutputOnF(int *id, int* output_on)
|
||||
{
|
||||
return ::SetOutputOn(*id, *output_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetErrorOnF(int *id, int* error_on)
|
||||
{
|
||||
return ::SetErrorOn(*id, *error_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetLogOnF(int *id, int* log_on)
|
||||
{
|
||||
return ::SetLogOn(*id, *log_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetDumpOnF(int *id, int* dump_on)
|
||||
{
|
||||
return ::SetDumpOn(*id, *dump_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetDumpStringOnF(int *id, int* dump_string_on)
|
||||
{
|
||||
return ::SetDumpStringOn(*id, *dump_string_on);
|
||||
return ::CreateIPhreeqc();
|
||||
}
|
||||
|
||||
int
|
||||
GetDumpLineCountF(int *id)
|
||||
DestroyIPhreeqcF(int *id)
|
||||
{
|
||||
return ::GetDumpLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetDumpLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetDumpLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
GetErrorLineCountF(int *id)
|
||||
{
|
||||
return ::GetErrorLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetErrorLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetErrorLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
GetWarningLineCountF(int *id)
|
||||
{
|
||||
return ::GetWarningLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetWarningLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetWarningLine(*id, (*n) - 1), line_length);
|
||||
return ::DestroyIPhreeqc(*id);
|
||||
}
|
||||
|
||||
int
|
||||
@ -191,43 +79,69 @@ GetComponentF(int *id, int *n, char* comp, unsigned int line_length)
|
||||
}
|
||||
|
||||
int
|
||||
RunAccumulatedF(int *id)
|
||||
GetDumpLineCountF(int *id)
|
||||
{
|
||||
return ::RunAccumulated(*id);
|
||||
return ::GetDumpLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetDumpLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetDumpLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
RunFileF(int *id, char* filename, unsigned int filename_length)
|
||||
GetDumpOnF(int *id)
|
||||
{
|
||||
char* cfilename;
|
||||
|
||||
cfilename = f2cstring(filename, filename_length);
|
||||
if (!cfilename)
|
||||
{
|
||||
::AddError(*id, "RunFile: Out of memory.\n");
|
||||
return (int)VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::RunFile(*id, cfilename);
|
||||
free(cfilename);
|
||||
return n;
|
||||
return ::GetDumpOn(*id);
|
||||
}
|
||||
|
||||
int
|
||||
RunStringF(int *id, char* input, unsigned int input_length)
|
||||
GetDumpStringOnF(int *id)
|
||||
{
|
||||
char* cinput;
|
||||
return ::GetDumpStringOn(*id);
|
||||
}
|
||||
|
||||
cinput = f2cstring(input, input_length);
|
||||
if (!cinput)
|
||||
{
|
||||
::AddError(*id, "RunString: Out of memory.\n");
|
||||
return (int)VR_OUTOFMEMORY;
|
||||
}
|
||||
int
|
||||
GetErrorLineCountF(int *id)
|
||||
{
|
||||
return ::GetErrorLineCount(*id);
|
||||
}
|
||||
|
||||
int n = ::RunString(*id, cinput);
|
||||
free(cinput);
|
||||
return n;
|
||||
void
|
||||
GetErrorLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetErrorLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
GetErrorOnF(int *id)
|
||||
{
|
||||
return ::GetErrorOn(*id);
|
||||
}
|
||||
|
||||
int
|
||||
GetLogOnF(int *id)
|
||||
{
|
||||
return ::GetLogOn(*id);
|
||||
}
|
||||
|
||||
int
|
||||
GetOutputOnF(int *id)
|
||||
{
|
||||
return ::GetOutputOn(*id);
|
||||
}
|
||||
|
||||
int
|
||||
GetSelectedOutputColumnCountF(int *id)
|
||||
{
|
||||
return ::GetSelectedOutputColumnCount(*id);
|
||||
}
|
||||
|
||||
int
|
||||
GetSelectedOutputOnF(int *id)
|
||||
{
|
||||
return ::GetSelectedOutputOn(*id);
|
||||
}
|
||||
|
||||
int
|
||||
@ -241,12 +155,6 @@ GetSelectedOutputRowCountF(int *id)
|
||||
return rows;
|
||||
}
|
||||
|
||||
int
|
||||
GetSelectedOutputColumnCountF(int *id)
|
||||
{
|
||||
return ::GetSelectedOutputColumnCount(*id);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
{
|
||||
@ -289,49 +197,151 @@ GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue,
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
GetWarningLineCountF(int *id)
|
||||
{
|
||||
return ::GetWarningLineCount(*id);
|
||||
}
|
||||
|
||||
void
|
||||
GetWarningLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||
{
|
||||
padfstring(line, ::GetWarningLine(*id, (*n) - 1), line_length);
|
||||
}
|
||||
|
||||
int
|
||||
LoadDatabaseF(int *id, char* filename, unsigned int filename_length)
|
||||
{
|
||||
char* cfilename;
|
||||
|
||||
cfilename = f2cstring(filename, filename_length);
|
||||
if (!cfilename)
|
||||
{
|
||||
::AddError(*id, "LoadDatabase: Out of memory.\n");
|
||||
return VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::LoadDatabase(*id, cfilename);
|
||||
free(cfilename);
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
LoadDatabaseStringF(int *id, char* input, unsigned int input_length)
|
||||
{
|
||||
char* cinput;
|
||||
|
||||
cinput = f2cstring(input, input_length);
|
||||
if (!cinput)
|
||||
{
|
||||
::AddError(*id, "LoadDatabaseString: Out of memory.\n");
|
||||
return VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::LoadDatabaseString(*id, cinput);
|
||||
free(cinput);
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
OutputErrorF(int *id)
|
||||
{
|
||||
::OutputError(*id);
|
||||
}
|
||||
|
||||
void
|
||||
OutputWarningF(int *id)
|
||||
{
|
||||
::OutputWarning(*id);
|
||||
}
|
||||
|
||||
void
|
||||
OutputLinesF(int *id)
|
||||
{
|
||||
::OutputLines(*id);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
void
|
||||
OutputWarningF(int *id)
|
||||
{
|
||||
::OutputWarning(*id);
|
||||
}
|
||||
|
||||
int
|
||||
SystemF(char* command, unsigned int command_length)
|
||||
RunAccumulatedF(int *id)
|
||||
{
|
||||
char* ccommand;
|
||||
return ::RunAccumulated(*id);
|
||||
}
|
||||
|
||||
ccommand = f2cstring(command, command_length);
|
||||
if (!ccommand)
|
||||
int
|
||||
RunFileF(int *id, char* filename, unsigned int filename_length)
|
||||
{
|
||||
char* cfilename;
|
||||
|
||||
cfilename = f2cstring(filename, filename_length);
|
||||
if (!cfilename)
|
||||
{
|
||||
//AddError("System: Out of memory.\n");
|
||||
::AddError(*id, "RunFile: Out of memory.\n");
|
||||
return (int)VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = system(ccommand);
|
||||
free(ccommand);
|
||||
int n = ::RunFile(*id, cfilename);
|
||||
free(cfilename);
|
||||
return n;
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
int
|
||||
RunStringF(int *id, char* input, unsigned int input_length)
|
||||
{
|
||||
char* cinput;
|
||||
|
||||
cinput = f2cstring(input, input_length);
|
||||
if (!cinput)
|
||||
{
|
||||
::AddError(*id, "RunString: Out of memory.\n");
|
||||
return (int)VR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
int n = ::RunString(*id, cinput);
|
||||
free(cinput);
|
||||
return n;
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetDumpOnF(int *id, int* dump_on)
|
||||
{
|
||||
return ::SetDumpOn(*id, *dump_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetDumpStringOnF(int *id, int* dump_string_on)
|
||||
{
|
||||
return ::SetDumpStringOn(*id, *dump_string_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetErrorOnF(int *id, int* error_on)
|
||||
{
|
||||
return ::SetErrorOn(*id, *error_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetLogOnF(int *id, int* log_on)
|
||||
{
|
||||
return ::SetLogOn(*id, *log_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetOutputOnF(int *id, int* output_on)
|
||||
{
|
||||
return ::SetOutputOn(*id, *output_on);
|
||||
}
|
||||
|
||||
IPQ_RESULT
|
||||
SetSelectedOutputOnF(int *id, int* sel_on)
|
||||
{
|
||||
return ::SetSelectedOutputOn(*id, *sel_on);
|
||||
}
|
||||
|
||||
int
|
||||
UnLoadDatabaseF(int *id)
|
||||
{
|
||||
return ::UnLoadDatabase(*id);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
@ -343,6 +353,10 @@ extern "C" {
|
||||
//
|
||||
// Intel Fortran compiler 9.1 /iface:cvf
|
||||
//
|
||||
DLL_EXPORT int __stdcall ACCUMULATELINE(int *id, char *line, unsigned int len)
|
||||
{
|
||||
return AccumulateLineF(id, line, len);
|
||||
}
|
||||
DLL_EXPORT int __stdcall CREATEIPHREEQC(void)
|
||||
{
|
||||
return CreateIPhreeqcF();
|
||||
@ -351,6 +365,58 @@ DLL_EXPORT int __stdcall DESTROYIPHREEQC(int *id)
|
||||
{
|
||||
return DestroyIPhreeqcF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetComponentF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETCOMPONENTCOUNT(int *id)
|
||||
{
|
||||
return GetComponentCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetDumpLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETDUMPLINECOUNT(int *id)
|
||||
{
|
||||
return GetDumpLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETERRORLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetErrorLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETERRORLINECOUNT(int *id)
|
||||
{
|
||||
return GetErrorLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETLOGON(int *id)
|
||||
{
|
||||
return GetLogonF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETOUTPUTON(int *id)
|
||||
{
|
||||
return GetOutputF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(int *id)
|
||||
{
|
||||
return GetSelectedOutputColumnCountF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTROWCOUNT(int *id)
|
||||
{
|
||||
return GetSelectedOutputRowCountF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETWARNINGLINECOUNT(int *id)
|
||||
{
|
||||
return GetWarningLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall LOADDATABASE(int *id, char *filename, unsigned int len)
|
||||
{
|
||||
return LoadDatabaseF(id, filename, len);
|
||||
@ -359,78 +425,18 @@ DLL_EXPORT int __stdcall LOADDATABASESTRING(int *id, char *input, unsigned int l
|
||||
{
|
||||
return LoadDatabaseStringF(id, input, len);
|
||||
}
|
||||
DLL_EXPORT int __stdcall UNLOADDATABASE(int *id)
|
||||
{
|
||||
return UnLoadDatabaseF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall OUTPUTERROR(int *id)
|
||||
{
|
||||
OutputErrorF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall OUTPUTLINES(int *id)
|
||||
{
|
||||
OutputLinesF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall OUTPUTWARNING(int *id)
|
||||
{
|
||||
OutputWarningF(id);
|
||||
}
|
||||
DLL_EXPORT int __stdcall ACCUMULATELINE(int *id, char *line, unsigned int len)
|
||||
{
|
||||
return AccumulateLineF(id, line, len);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETSELECTEDOUTPUTON(int *id, int *selected_on)
|
||||
{
|
||||
SetSelectedOutputOnF(id, selected_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETOUTPUTON(int *id, int *output_on)
|
||||
{
|
||||
SetOutputOnF(id, output_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETERRORON(int *id, int *error_on)
|
||||
{
|
||||
SetErrorOnF(id, error_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETLOGON(int *id, int *log_on)
|
||||
{
|
||||
SetLogOnF(id, log_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETDUMPON(int *id, int *dump_on)
|
||||
{
|
||||
SetDumpOnF(id, dump_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETDUMPSTRINGON(int *id, int *dump_string_on)
|
||||
{
|
||||
SetDumpStringOnF(id, dump_string_on);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETDUMPLINECOUNT(int *id)
|
||||
{
|
||||
return GetDumpLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETDUMPLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetDumpLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETERRORLINECOUNT(int *id)
|
||||
{
|
||||
return GetErrorLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETERRORLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetErrorLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETWARNINGLINECOUNT(int *id)
|
||||
{
|
||||
return GetWarningLineCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETWARNINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningLineF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETCOMPONENTCOUNT(int *id)
|
||||
{
|
||||
return GetComponentCountF(id);
|
||||
}
|
||||
DLL_EXPORT void __stdcall GETCOMPONENT(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetComponentF(id, n, line, line_length);
|
||||
}
|
||||
DLL_EXPORT int __stdcall RUNACCUMULATED(int *id)
|
||||
{
|
||||
return RunAccumulatedF(id);
|
||||
@ -443,21 +449,33 @@ DLL_EXPORT int __stdcall RUNSTRING(int *id, char *input, unsigned int len)
|
||||
{
|
||||
return RunStringF(id, input, len);
|
||||
}
|
||||
DLL_EXPORT void __stdcall OUTPUTLINES(int *id)
|
||||
DLL_EXPORT void __stdcall SETDUMPON(int *id, int *dump_on)
|
||||
{
|
||||
OutputLinesF(id);
|
||||
SetDumpOnF(id, dump_on);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTROWCOUNT(int *id)
|
||||
DLL_EXPORT void __stdcall SETDUMPSTRINGON(int *id, int *dump_string_on)
|
||||
{
|
||||
return GetSelectedOutputRowCountF(id);
|
||||
SetDumpStringOnF(id, dump_string_on);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(int *id)
|
||||
DLL_EXPORT void __stdcall SETERRORON(int *id, int *error_on)
|
||||
{
|
||||
return GetSelectedOutputColumnCountF(id);
|
||||
SetErrorOnF(id, error_on);
|
||||
}
|
||||
DLL_EXPORT int __stdcall GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
DLL_EXPORT void __stdcall SETLOGON(int *id, int *log_on)
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
SetLogOnF(id, log_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETOUTPUTON(int *id, int *output_on)
|
||||
{
|
||||
SetOutputOnF(id, output_on);
|
||||
}
|
||||
DLL_EXPORT void __stdcall SETSELECTEDOUTPUTON(int *id, int *selected_on)
|
||||
{
|
||||
SetSelectedOutputOnF(id, selected_on);
|
||||
}
|
||||
DLL_EXPORT int __stdcall UNLOADDATABASE(int *id)
|
||||
{
|
||||
return UnLoadDatabaseF(id);
|
||||
}
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
131
src/fwrap.h
131
src/fwrap.h
@ -8,99 +8,82 @@
|
||||
#endif
|
||||
|
||||
#if defined(FC_FUNC)
|
||||
#define AccumulateLineF FC_FUNC (accumulatelinef, ACCUMULATELINEF)
|
||||
#define CreateIPhreeqcF FC_FUNC (createiphreeqcf, CREATEIPHREEQCF)
|
||||
#define DestroyIPhreeqcF FC_FUNC (destroyiphreeqcf, DESTROYIPHREEQCF)
|
||||
#define GetComponentCountF FC_FUNC (getcomponentcountf, GETCOMPONENTCOUNTF)
|
||||
#define GetComponentF FC_FUNC (getcomponentf, GETCOMPONENTF)
|
||||
#define GetDumpLineCountF FC_FUNC (getdumplinecountf, GETDUMPLINECOUNTF)
|
||||
#define GetDumpLineF FC_FUNC (getdumplinef, GETDUMPLINEF)
|
||||
#define GetDumpOnF FC_FUNC (getdumponf, GETDUMPONF)
|
||||
#define GetDumpStringOnF FC_FUNC (getdumpstringonf, GETDUMPSTRINGONF)
|
||||
#define GetErrorLineCountF FC_FUNC (geterrorlinecountf, GETERRORLINECOUNTF)
|
||||
#define GetErrorLineF FC_FUNC (geterrorlinef, GETERRORLINEF)
|
||||
#define GetErrorOnF FC_FUNC (geterroronf, GETERRORONF)
|
||||
#define GetLogOnF FC_FUNC (getlogonf, GETLOGONF)
|
||||
#define GetOutputOnF FC_FUNC (getoutputonf, GETOUTPUTONF)
|
||||
#define GetSelectedOutputColumnCountF FC_FUNC (getselectedoutputcolumncountf, GETSELECTEDOUTPUTCOLUMNCOUNTF)
|
||||
#define GetSelectedOutputOnF FC_FUNC (getselectedoutputonf, GETSELECTEDOUTPUTONF)
|
||||
#define GetSelectedOutputRowCountF FC_FUNC (getselectedoutputrowcountf, GETSELECTEDOUTPUTROWCOUNTF)
|
||||
#define GetSelectedOutputValueF FC_FUNC (getselectedoutputvaluef, GETSELECTEDOUTPUTVALUEF)
|
||||
#define GetWarningLineCountF FC_FUNC (getwarninglinecountf, GETWARNINGLINECOUNTF)
|
||||
#define GetWarningLineF FC_FUNC (getwarninglinef, GETWARNINGLINEF)
|
||||
#define LoadDatabaseF FC_FUNC (loaddatabasef, LOADDATABASEF)
|
||||
#define LoadDatabaseStringF FC_FUNC (loaddatabasestringf, LOADDATABASESTRINGF)
|
||||
#define UnLoadDatabaseF FC_FUNC (unloaddatabasef, UNLOADDATABASEF)
|
||||
#define AccumulateLineF FC_FUNC (accumulatelinef, ACCUMULATELINEF)
|
||||
#define OutputErrorF FC_FUNC (outputerrorf, OUTPUTERRORF)
|
||||
#define OutputLinesF FC_FUNC (outputlinesf, OUTPUTLINESF)
|
||||
#define OutputWarningF FC_FUNC (outputwarningf, OUTPUTWARNINGF)
|
||||
#define RunAccumulatedF FC_FUNC (runaccumulatedf, RUNACCUMULATEDF)
|
||||
#define RunFileF FC_FUNC (runfilef, RUNFILEF)
|
||||
#define RunStringF FC_FUNC (runstringf, RUNSTRINGF)
|
||||
#define GetSelectedOutputRowCountF FC_FUNC (getselectedoutputrowcountf, GETSELECTEDOUTPUTROWCOUNTF)
|
||||
#define GetSelectedOutputColumnCountF FC_FUNC (getselectedoutputcolumncountf, GETSELECTEDOUTPUTCOLUMNCOUNTF)
|
||||
#define GetSelectedOutputValueF FC_FUNC (getselectedoutputvaluef, GETSELECTEDOUTPUTVALUEF)
|
||||
#define SetSelectedOutputOnF FC_FUNC (setselectedoutputonf, SETSELECTEDOUTPUTONF)
|
||||
#define SetOutputOnF FC_FUNC (setoutputonf, SETOUTPUTONF)
|
||||
#define SetErrorOnF FC_FUNC (seterroronf, SETERRORONF)
|
||||
#define SetLogOnF FC_FUNC (setlogonf, SETLOGONF)
|
||||
#define SetDumpOnF FC_FUNC (setdumponf, SETDUMPONF)
|
||||
#define SetDumpStringOnF FC_FUNC (setdumpstringonf, SETDUMPSTRINGONF)
|
||||
#define GetDumpLineCountF FC_FUNC (getdumplinecountf, GETDUMPLINECOUNTF)
|
||||
#define GetDumpLineF FC_FUNC (getdumplinef, GETDUMPLINEF)
|
||||
#define GetErrorLineCountF FC_FUNC (geterrorlinecountf, GETERRORLINECOUNTF)
|
||||
#define GetErrorLineF FC_FUNC (geterrorlinef, GETERRORLINEF)
|
||||
#define GetWarningLineCountF FC_FUNC (getwarninglinecountf, GETWARNINGLINECOUNTF)
|
||||
#define GetWarningLineF FC_FUNC (getwarninglinef, GETWARNINGLINEF)
|
||||
#define GetComponentCountF FC_FUNC (getcomponentcountf, GETCOMPONENTCOUNTF)
|
||||
#define GetComponentF FC_FUNC (getcomponentf, GETCOMPONENTF)
|
||||
#define OutputErrorF FC_FUNC (outputerrorf, OUTPUTERRORF)
|
||||
#define OutputWarningF FC_FUNC (outputwarningf, OUTPUTWARNINGF)
|
||||
#define OutputLinesF FC_FUNC (outputlinesf, OUTPUTLINESF)
|
||||
#define SetErrorOnF FC_FUNC (seterroronf, SETERRORONF)
|
||||
#define SetLogOnF FC_FUNC (setlogonf, SETLOGONF)
|
||||
#define SetOutputOnF FC_FUNC (setoutputonf, SETOUTPUTONF)
|
||||
#define SetSelectedOutputOnF FC_FUNC (setselectedoutputonf, SETSELECTEDOUTPUTONF)
|
||||
#define UnLoadDatabaseF FC_FUNC (unloaddatabasef, UNLOADDATABASEF)
|
||||
#endif /* FC_FUNC */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int CreateIPhreeqcF(void);
|
||||
|
||||
int DestroyIPhreeqcF(int *id);
|
||||
|
||||
int LoadDatabaseF(int *id, char* filename, unsigned int filename_length);
|
||||
|
||||
int LoadDatabaseStringF(int *id, char* input, unsigned int input_length);
|
||||
|
||||
int UnLoadDatabaseF(int *id);
|
||||
|
||||
IPQ_RESULT AccumulateLineF(int *id, char *line, unsigned int line_length);
|
||||
|
||||
int RunAccumulatedF(int *id);
|
||||
|
||||
int RunFileF(int *id, char* filename, unsigned int filename_length);
|
||||
|
||||
int RunStringF(int *id, char* input, unsigned int input_length);
|
||||
|
||||
int GetSelectedOutputRowCountF(int *id);
|
||||
|
||||
int GetSelectedOutputColumnCountF(int *id);
|
||||
|
||||
int CreateIPhreeqcF(void);
|
||||
int DestroyIPhreeqcF(int *id);
|
||||
int GetComponentCountF(int *id);
|
||||
void GetComponentF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int GetDumpLineCountF(int *id);
|
||||
void GetDumpLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int GetErrorLineCountF(int *id);
|
||||
void GetErrorLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int GetErrorOnF(int *id);
|
||||
int GetDumpOnF(int *id);
|
||||
int GetDumpStringOnF(int *id);
|
||||
int GetLogOnF(int *id);
|
||||
int GetOutputOnF(int *id);
|
||||
int GetSelectedOutputColumnCountF(int *id);
|
||||
int GetSelectedOutputOnF(int *id);
|
||||
int GetSelectedOutputRowCountF(int *id);
|
||||
IPQ_RESULT GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
||||
|
||||
IPQ_RESULT SetSelectedOutputOnF(int *id, int* selected_output_on);
|
||||
|
||||
IPQ_RESULT SetOutputOnF(int *id, int* output_on);
|
||||
|
||||
IPQ_RESULT SetErrorOnF(int *id, int* error_on);
|
||||
|
||||
IPQ_RESULT SetLogOnF(int *id, int* log_on);
|
||||
|
||||
int GetWarningLineCountF(int *id);
|
||||
void GetWarningLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int LoadDatabaseF(int *id, char* filename, unsigned int filename_length);
|
||||
int LoadDatabaseStringF(int *id, char* input, unsigned int input_length);
|
||||
void OutputErrorF(int *id);
|
||||
void OutputLinesF(int *id);
|
||||
void OutputWarningF(int *id);
|
||||
int RunAccumulatedF(int *id);
|
||||
int RunFileF(int *id, char* filename, unsigned int filename_length);
|
||||
int RunStringF(int *id, char* input, unsigned int input_length);
|
||||
IPQ_RESULT SetDumpOnF(int *id, int* dump_on);
|
||||
|
||||
IPQ_RESULT SetDumpStringOnF(int *id, int* dump_string_on);
|
||||
|
||||
int GetDumpLineCountF(int *id);
|
||||
|
||||
void GetDumpLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
int GetErrorLineCountF(int *id);
|
||||
|
||||
void GetErrorLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
int GetWarningLineCountF(int *id);
|
||||
|
||||
void GetWarningLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
int GetComponentCountF(int *id);
|
||||
|
||||
void GetComponentF(int *id, int* n, char* line, unsigned int line_length);
|
||||
|
||||
void OutputErrorF(int *id);
|
||||
|
||||
void OutputWarningF(int *id);
|
||||
|
||||
void OutputLinesF(int *id);
|
||||
|
||||
IPQ_RESULT SetErrorOnF(int *id, int* error_on);
|
||||
IPQ_RESULT SetLogOnF(int *id, int* log_on);
|
||||
IPQ_RESULT SetOutputOnF(int *id, int* output_on);
|
||||
IPQ_RESULT SetSelectedOutputOnF(int *id, int* selected_output_on);
|
||||
int UnLoadDatabaseF(int *id);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
#define F_MAIN FC_FUNC(f_main, F_MAIN)
|
||||
|
||||
extern "C" void F_MAIN();
|
||||
extern "C" int F_MAIN();
|
||||
|
||||
int main(void)
|
||||
{
|
||||
F_MAIN();
|
||||
return 0;
|
||||
return F_MAIN();
|
||||
}
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#include <IPhreeqc.h>
|
||||
|
||||
typedef int (*getFunc)(int);
|
||||
typedef int (*setFunc)(int, int);
|
||||
int TestGetSet(int, getFunc, setFunc);
|
||||
|
||||
int
|
||||
main(int argc, const char* argv[])
|
||||
{
|
||||
@ -11,6 +15,43 @@ main(int argc, const char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Dump */
|
||||
if (TestGetSet(id, GetDumpOn, SetDumpOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Dump string */
|
||||
if (TestGetSet(id, GetDumpStringOn, SetDumpStringOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/* Error */
|
||||
if (TestGetSet(id, GetErrorOn, SetErrorOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Log */
|
||||
if (TestGetSet(id, GetLogOn, SetLogOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Output */
|
||||
if (TestGetSet(id, GetOutputOn, SetOutputOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Selected output */
|
||||
if (TestGetSet(id, GetSelectedOutputOn, SetSelectedOutputOn))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (LoadDatabase(id, "phreeqc.dat") != 0)
|
||||
{
|
||||
OutputError(id);
|
||||
@ -31,3 +72,29 @@ main(int argc, const char* argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
TestGetSet(int id, getFunc gf, setFunc sf)
|
||||
{
|
||||
if (gf(id))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (sf(id, 1) != IPQ_OK)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!gf(id))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (sf(id,0) != IPQ_OK)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,11 +1,86 @@
|
||||
#include <iostream>
|
||||
#include <IPhreeqc.hpp>
|
||||
|
||||
template <class TClass> class TTestGetSet
|
||||
{
|
||||
private:
|
||||
bool (TClass::*_get)(void)const;
|
||||
void (TClass::*_set)(bool);
|
||||
TClass* _p;
|
||||
public:
|
||||
TTestGetSet(TClass* p, bool(TClass::*get)(void)const, void(TClass::*set)(bool))
|
||||
{
|
||||
_p = p;
|
||||
_get = get;
|
||||
_set = set;
|
||||
}
|
||||
int Test(void)
|
||||
{
|
||||
if ((*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
(*_p.*_set)(true);
|
||||
if (!(*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
(*_p.*_set)(false);
|
||||
if ((*_p.*_get)())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, const char* argv[])
|
||||
{
|
||||
IPhreeqc iphreeqc;
|
||||
|
||||
// Dump
|
||||
TTestGetSet<IPhreeqc> testDump(&iphreeqc, &IPhreeqc::GetDumpOn, &IPhreeqc::SetDumpOn);
|
||||
if (testDump.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Dump string
|
||||
TTestGetSet<IPhreeqc> testDumpString(&iphreeqc, &IPhreeqc::GetDumpStringOn, &IPhreeqc::SetDumpStringOn);
|
||||
if (testDumpString.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Error
|
||||
TTestGetSet<IPhreeqc> testError(&iphreeqc, &IPhreeqc::GetErrorOn, &IPhreeqc::SetErrorOn);
|
||||
if (testError.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Log
|
||||
TTestGetSet<IPhreeqc> testLog(&iphreeqc, &IPhreeqc::GetLogOn, &IPhreeqc::SetLogOn);
|
||||
if (testLog.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Output
|
||||
TTestGetSet<IPhreeqc> testOutput(&iphreeqc, &IPhreeqc::GetOutputOn, &IPhreeqc::SetOutputOn);
|
||||
if (testOutput.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Selected output
|
||||
TTestGetSet<IPhreeqc> testSelectedOutput(&iphreeqc, &IPhreeqc::GetSelectedOutputOn, &IPhreeqc::SetSelectedOutputOn);
|
||||
if (testSelectedOutput.Test() != 0)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (iphreeqc.LoadDatabase("phreeqc.dat") != 0)
|
||||
{
|
||||
std::cout << iphreeqc.GetErrorString();
|
||||
|
||||
@ -1,27 +1,86 @@
|
||||
SUBROUTINE F_MAIN
|
||||
FUNCTION F_MAIN()
|
||||
|
||||
IMPLICIT NONE
|
||||
INCLUDE 'IPhreeqc.f.inc'
|
||||
INTEGER id
|
||||
INTEGER(KIND=4) id
|
||||
INTEGER(KIND=4) F_MAIN
|
||||
|
||||
id = CreateIPhreeqc()
|
||||
IF (id.LT.0) THEN
|
||||
STOP
|
||||
F_MAIN = 1
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (GetOutputOn(id)) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (SetOutputOn(id,.TRUE.).NE.IPQ_OK) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (.NOT.GetOutputOn(id)) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (LoadDatabase(id, "phreeqc.dat").NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 3
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (RunFile(id, "ex1").NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 3
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (DestroyIPhreeqc(id).NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 5
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
END SUBROUTINE F_MAIN
|
||||
F_MAIN = 0
|
||||
RETURN
|
||||
|
||||
END FUNCTION F_MAIN
|
||||
|
||||
|
||||
FUNCTION TestGetSet(id,getFunc,setFunc)
|
||||
|
||||
IMPLICIT NONE
|
||||
INCLUDE 'IPhreeqc.f90.inc'
|
||||
INTEGER(KIND=4) id
|
||||
INTEGER(KIND=4) TESTGETSET
|
||||
|
||||
LOGICAL(KIND=4) getFunc
|
||||
INTEGER(KIND=4) setFunc
|
||||
|
||||
IF (getFunc(id)) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (setFunc(id,.TRUE.).NE.IPQ_OK) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (.NOT.getFunc(id)) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (setFunc(id,.FALSE.).NE.IPQ_OK) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
TestGetSet = 0
|
||||
RETURN
|
||||
|
||||
END FUNCTION TestGetSet
|
||||
|
||||
@ -1,30 +1,118 @@
|
||||
SUBROUTINE F_MAIN
|
||||
FUNCTION F_MAIN()
|
||||
|
||||
IMPLICIT NONE
|
||||
INCLUDE 'IPhreeqc.f90.inc'
|
||||
INTEGER id
|
||||
INTEGER(KIND=4) id
|
||||
INTEGER(KIND=4) F_MAIN
|
||||
INTEGER(KIND=4) TestGetSet
|
||||
|
||||
id = CreateIPhreeqc()
|
||||
IF (id.LT.0) THEN
|
||||
STOP
|
||||
F_MAIN = 1
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Dump
|
||||
IF (TestGetSet(id,GetDumpOn,SetDumpOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Dump string
|
||||
IF (TestGetSet(id,GetDumpStringOn,SetDumpStringOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Error
|
||||
IF (TestGetSet(id,GetErrorOn,SetErrorOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Log
|
||||
IF (TestGetSet(id,GetLogOn,SetLogOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Output
|
||||
IF (TestGetSet(id,GetOutputOn,SetOutputOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
! Selected output
|
||||
IF (TestGetSet(id,GetSelectedOutputOn,SetSelectedOutputOn).NE.0) THEN
|
||||
F_MAIN = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (LoadDatabase(id, "phreeqc.dat").NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 3
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (RunFile(id, "ex1").NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 4
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (DestroyIPhreeqc(id).NE.0) THEN
|
||||
CALL OutputError(id)
|
||||
STOP
|
||||
F_MAIN = 5
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
END SUBROUTINE F_MAIN
|
||||
|
||||
F_MAIN = 0
|
||||
RETURN
|
||||
|
||||
END FUNCTION F_MAIN
|
||||
|
||||
|
||||
FUNCTION TestGetSet(id,getFunc,setFunc)
|
||||
|
||||
IMPLICIT NONE
|
||||
INCLUDE 'IPhreeqc.f90.inc'
|
||||
INTEGER(KIND=4) id
|
||||
INTEGER(KIND=4) TESTGETSET
|
||||
INTERFACE
|
||||
FUNCTION getFunc(id)
|
||||
INTEGER(KIND=4) id
|
||||
LOGICAL(KIND=4) getFunc
|
||||
END FUNCTION getFunc
|
||||
END INTERFACE
|
||||
INTERFACE
|
||||
FUNCTION setFunc(id,flag)
|
||||
INTEGER(KIND=4) id
|
||||
LOGICAL(KIND=4) flag
|
||||
INTEGER(KIND=4) setFunc
|
||||
END FUNCTION setFunc
|
||||
END INTERFACE
|
||||
|
||||
IF (getFunc(id)) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (setFunc(id,.TRUE.).NE.IPQ_OK) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (.NOT.getFunc(id)) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
IF (setFunc(id,.FALSE.).NE.IPQ_OK) THEN
|
||||
TestGetSet = 2
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
TestGetSet = 0
|
||||
RETURN
|
||||
|
||||
END FUNCTION TestGetSet
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user