mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
windows log functions passed (w/ phreeqcpp -r 5966) except for (PHRQ_io.h -r 5990)
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/ErrorHandling@5991 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
61ec1524c9
commit
9674406e59
89
IPhreeqc.cpp
89
IPhreeqc.cpp
@ -18,17 +18,19 @@ const char DUMP_FILENAME_FORMAT[] = "dump.%d.out";
|
|||||||
std::map<size_t, IPhreeqc*> IPhreeqc::Instances;
|
std::map<size_t, IPhreeqc*> IPhreeqc::Instances;
|
||||||
size_t IPhreeqc::InstancesIndex = 0;
|
size_t IPhreeqc::InstancesIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
IPhreeqc::IPhreeqc(void)
|
IPhreeqc::IPhreeqc(void)
|
||||||
: DatabaseLoaded(false)
|
: DatabaseLoaded(false)
|
||||||
, ClearAccumulated(false)
|
, ClearAccumulated(false)
|
||||||
, UpdateComponents(true)
|
, UpdateComponents(true)
|
||||||
, SelectedOutputOn(false)
|
, SelectedOutputOn(false)
|
||||||
, OutputFileOn(false)
|
, OutputFileOn(false)
|
||||||
, LogOn(false)
|
, LogFileOn(false)
|
||||||
, ErrorOn(false)
|
, ErrorOn(false)
|
||||||
, DumpOn(false)
|
, DumpOn(false)
|
||||||
, DumpStringOn(false)
|
, DumpStringOn(false)
|
||||||
, OutputStringOn(false)
|
, OutputStringOn(false)
|
||||||
|
, LogStringOn(false)
|
||||||
, ErrorReporter(0)
|
, ErrorReporter(0)
|
||||||
, WarningReporter(0)
|
, WarningReporter(0)
|
||||||
, SelectedOutput(0)
|
, SelectedOutput(0)
|
||||||
@ -220,9 +222,44 @@ int IPhreeqc::GetId(void)const
|
|||||||
return (int)this->Index;
|
return (int)this->Index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* IPhreeqc::GetLogFileName(void)const
|
||||||
|
{
|
||||||
|
return this->LogFileName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
bool IPhreeqc::GetLogFileOn(void)const
|
bool IPhreeqc::GetLogFileOn(void)const
|
||||||
{
|
{
|
||||||
return this->LogOn;
|
return this->LogFileOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* IPhreeqc::GetLogString(void)const
|
||||||
|
{
|
||||||
|
static const char err_msg[] = "GetLogString: LogStringOn not set.\n";
|
||||||
|
if (!this->LogStringOn)
|
||||||
|
{
|
||||||
|
return err_msg;
|
||||||
|
}
|
||||||
|
return this->LogString.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* IPhreeqc::GetLogStringLine(int n)const
|
||||||
|
{
|
||||||
|
static const char empty[] = "";
|
||||||
|
if (n < 0 || n >= this->GetLogStringLineCount())
|
||||||
|
{
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
return this->LogLines[n].c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
int IPhreeqc::GetLogStringLineCount(void)const
|
||||||
|
{
|
||||||
|
return (int)this->LogLines.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPhreeqc::GetLogStringOn(void)const
|
||||||
|
{
|
||||||
|
return this->LogStringOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* IPhreeqc::GetOutputFileName(void)const
|
const char* IPhreeqc::GetOutputFileName(void)const
|
||||||
@ -351,6 +388,8 @@ int IPhreeqc::LoadDatabase(const char* filename)
|
|||||||
{
|
{
|
||||||
bool bSaveOutputOn = this->OutputFileOn;
|
bool bSaveOutputOn = this->OutputFileOn;
|
||||||
this->OutputFileOn = false;
|
this->OutputFileOn = false;
|
||||||
|
bool bSaveLogFileOn = this->LogFileOn;
|
||||||
|
this->LogFileOn = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// cleanup
|
// cleanup
|
||||||
@ -394,6 +433,7 @@ int IPhreeqc::LoadDatabase(const char* filename)
|
|||||||
this->PhreeqcPtr->phrq_io->clear_istream();
|
this->PhreeqcPtr->phrq_io->clear_istream();
|
||||||
this->DatabaseLoaded = (this->PhreeqcPtr->get_input_errors() == 0);
|
this->DatabaseLoaded = (this->PhreeqcPtr->get_input_errors() == 0);
|
||||||
this->OutputFileOn = bSaveOutputOn;
|
this->OutputFileOn = bSaveOutputOn;
|
||||||
|
this->LogFileOn = bSaveLogFileOn;
|
||||||
return this->PhreeqcPtr->get_input_errors();
|
return this->PhreeqcPtr->get_input_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,9 +653,22 @@ void IPhreeqc::SetErrorFileOn(bool bValue)
|
|||||||
this->ErrorOn = bValue;
|
this->ErrorOn = bValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetLogFileName(const char *filename)
|
||||||
|
{
|
||||||
|
if (filename && ::strlen(filename))
|
||||||
|
{
|
||||||
|
this->LogFileName = filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IPhreeqc::SetLogFileOn(bool bValue)
|
void IPhreeqc::SetLogFileOn(bool bValue)
|
||||||
{
|
{
|
||||||
this->LogOn = bValue;
|
this->LogFileOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetLogStringOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->LogStringOn = bValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPhreeqc::SetOutputFileName(const char *filename)
|
void IPhreeqc::SetOutputFileName(const char *filename)
|
||||||
@ -720,6 +773,8 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
}
|
}
|
||||||
|
|
||||||
// release
|
// release
|
||||||
|
this->LogString.clear();
|
||||||
|
this->LogLines.clear();
|
||||||
this->OutputString.clear();
|
this->OutputString.clear();
|
||||||
this->OutputLines.clear();
|
this->OutputLines.clear();
|
||||||
|
|
||||||
@ -752,6 +807,9 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
|
|
||||||
int save_punch_in = this->PhreeqcPtr->punch.in;
|
int save_punch_in = this->PhreeqcPtr->punch.in;
|
||||||
|
|
||||||
|
//{{
|
||||||
|
//}}
|
||||||
|
|
||||||
this->PhreeqcPtr->dup_print(token, TRUE);
|
this->PhreeqcPtr->dup_print(token, TRUE);
|
||||||
if (this->PhreeqcPtr->read_input() == EOF)
|
if (this->PhreeqcPtr->read_input() == EOF)
|
||||||
break;
|
break;
|
||||||
@ -996,6 +1054,19 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
|||||||
this->update_errors();
|
this->update_errors();
|
||||||
|
|
||||||
// update lines
|
// update lines
|
||||||
|
//
|
||||||
|
|
||||||
|
if (this->LogStringOn)
|
||||||
|
{
|
||||||
|
// output lines
|
||||||
|
std::istringstream iss(this->LogString);
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(iss, line))
|
||||||
|
{
|
||||||
|
this->LogLines.push_back(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this->OutputStringOn)
|
if (this->OutputStringOn)
|
||||||
{
|
{
|
||||||
// output lines
|
// output lines
|
||||||
@ -1035,6 +1106,16 @@ void IPhreeqc::update_errors(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::log_msg(const char * str)
|
||||||
|
{
|
||||||
|
if (this->LogStringOn && this->log_on)
|
||||||
|
{
|
||||||
|
this->LogString += str;
|
||||||
|
}
|
||||||
|
ASSERT(!(this->LogFileOn ^ (this->log_ostream != 0)));
|
||||||
|
this->PHRQ_io::log_msg(str);
|
||||||
|
}
|
||||||
|
|
||||||
void IPhreeqc::error_msg(const char *str, bool stop)
|
void IPhreeqc::error_msg(const char *str, bool stop)
|
||||||
{
|
{
|
||||||
ASSERT(!(this->ErrorOn ^ (this->error_ostream != 0)));
|
ASSERT(!(this->ErrorOn ^ (this->error_ostream != 0)));
|
||||||
@ -1112,7 +1193,7 @@ void IPhreeqc::open_output_files(const char* sz_routine)
|
|||||||
this->warning_msg(oss.str().c_str());
|
this->warning_msg(oss.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->LogOn)
|
if (this->LogFileOn)
|
||||||
{
|
{
|
||||||
if (this->log_ostream != NULL)
|
if (this->log_ostream != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
58
IPhreeqcF.f
58
IPhreeqcF.f
@ -149,6 +149,13 @@
|
|||||||
INTEGER(KIND=4) :: GetErrorStringLineCountF
|
INTEGER(KIND=4) :: GetErrorStringLineCountF
|
||||||
GetErrorStringLineCount = GetErrorStringLineCountF(ID)
|
GetErrorStringLineCount = GetErrorStringLineCountF(ID)
|
||||||
END FUNCTION GetErrorStringLineCount
|
END FUNCTION GetErrorStringLineCount
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
SUBROUTINE GetLogFileName(ID,FNAME)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
CHARACTER(LEN=*) :: FNAME
|
||||||
|
CALL GetLogFileNameF(ID,FNAME)
|
||||||
|
END SUBROUTINE GetLogFileName
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
FUNCTION GetLogFileOn(ID)
|
FUNCTION GetLogFileOn(ID)
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
@ -161,6 +168,38 @@
|
|||||||
GetLogFileOn = .TRUE.
|
GetLogFileOn = .TRUE.
|
||||||
ENDIF
|
ENDIF
|
||||||
END FUNCTION GetLogFileOn
|
END FUNCTION GetLogFileOn
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
! GetLogString
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
FUNCTION GetLogStringLine(ID,N,LINE)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
INTEGER(KIND=4) :: N
|
||||||
|
CHARACTER(LEN=*) :: LINE
|
||||||
|
INTEGER(KIND=4) :: GetLogStringLine
|
||||||
|
INTEGER(KIND=4) :: GetLogStringLineF
|
||||||
|
GetLogStringLine = GetLogStringLineF(ID,N,LINE)
|
||||||
|
END FUNCTION GetLogStringLine
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
FUNCTION GetLogStringLineCount(ID)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
INTEGER(KIND=4) :: GetLogStringLineCount
|
||||||
|
INTEGER(KIND=4) :: GetLogStringLineCountF
|
||||||
|
GetLogStringLineCount = GetLogStringLineCountF(ID)
|
||||||
|
END FUNCTION GetLogStringLineCount
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
FUNCTION GetLogStringOn(ID)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
LOGICAL(KIND=4) :: GetLogStringOn
|
||||||
|
INTEGER(KIND=4) :: GetLogStringOnF
|
||||||
|
IF (GetLogStringOnF(ID).EQ.0) THEN
|
||||||
|
GetLogStringOn = .FALSE.
|
||||||
|
ELSE
|
||||||
|
GetLogStringOn = .TRUE.
|
||||||
|
ENDIF
|
||||||
|
END FUNCTION GetLogStringOn
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
SUBROUTINE GetOutputFileName(ID,FNAME)
|
SUBROUTINE GetOutputFileName(ID,FNAME)
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
@ -372,6 +411,15 @@
|
|||||||
INTEGER(KIND=4) :: SetErrorFileOnF
|
INTEGER(KIND=4) :: SetErrorFileOnF
|
||||||
SetErrorFileOn = SetErrorFileOnF(ID,ERROR_ON)
|
SetErrorFileOn = SetErrorFileOnF(ID,ERROR_ON)
|
||||||
END FUNCTION SetErrorFileOn
|
END FUNCTION SetErrorFileOn
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
FUNCTION SetLogFileName(ID,FNAME)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
CHARACTER(LEN=*) :: FNAME
|
||||||
|
INTEGER(KIND=4) :: SetLogFileName
|
||||||
|
INTEGER(KIND=4) :: SetLogFileNameF
|
||||||
|
SetLogFileName = SetLogFileNameF(ID,FNAME)
|
||||||
|
END FUNCTION SetLogFileName
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
FUNCTION SetLogFileOn(ID,LOG_ON)
|
FUNCTION SetLogFileOn(ID,LOG_ON)
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
@ -381,6 +429,15 @@
|
|||||||
INTEGER(KIND=4) :: SetLogFileOnF
|
INTEGER(KIND=4) :: SetLogFileOnF
|
||||||
SetLogFileOn = SetLogFileOnF(ID,LOG_ON)
|
SetLogFileOn = SetLogFileOnF(ID,LOG_ON)
|
||||||
END FUNCTION SetLogFileOn
|
END FUNCTION SetLogFileOn
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
FUNCTION SetLogStringOn(ID,LOG_STRING_ON)
|
||||||
|
IMPLICIT NONE
|
||||||
|
INTEGER(KIND=4) :: ID
|
||||||
|
LOGICAL(KIND=4) :: LOG_STRING_ON
|
||||||
|
INTEGER(KIND=4) :: SetLogStringOn
|
||||||
|
INTEGER(KIND=4) :: SetLogStringOnF
|
||||||
|
SetLogStringOn = SetLogStringOnF(ID,LOG_STRING_ON)
|
||||||
|
END FUNCTION SetLogStringOn
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
FUNCTION SetOutputFileName(ID,FNAME)
|
FUNCTION SetOutputFileName(ID,FNAME)
|
||||||
IMPLICIT NONE
|
IMPLICIT NONE
|
||||||
@ -417,3 +474,4 @@
|
|||||||
INTEGER(KIND=4) :: SetSelOutFileOnF
|
INTEGER(KIND=4) :: SetSelOutFileOnF
|
||||||
SetSelectedOutputFileOn = SetSelOutFileOnF(ID,SELECTED_ON)
|
SetSelectedOutputFileOn = SetSelOutFileOnF(ID,SELECTED_ON)
|
||||||
END FUNCTION SetSelectedOutputFileOn
|
END FUNCTION SetSelectedOutputFileOn
|
||||||
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|||||||
@ -240,6 +240,18 @@ GetErrorStringLineCount(int id)
|
|||||||
return IPQ_BADINSTANCE;
|
return IPQ_BADINSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
GetLogFileName(int id)
|
||||||
|
{
|
||||||
|
static const char empty[] = "";
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
return IPhreeqcPtr->GetLogFileName();
|
||||||
|
}
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
GetLogFileOn(int id)
|
GetLogFileOn(int id)
|
||||||
{
|
{
|
||||||
@ -258,6 +270,59 @@ GetLogFileOn(int id)
|
|||||||
return IPQ_BADINSTANCE;
|
return IPQ_BADINSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
GetLogString(int id)
|
||||||
|
{
|
||||||
|
static const char empty[] = "";
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
return IPhreeqcPtr->GetLogString();
|
||||||
|
}
|
||||||
|
return empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char*
|
||||||
|
GetLogStringLine(int id, int n)
|
||||||
|
{
|
||||||
|
static const char err_msg[] = "GetLogStringLine: Invalid instance id.\n";
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
return IPhreeqcPtr->GetLogStringLine(n);
|
||||||
|
}
|
||||||
|
return err_msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GetLogStringLineCount(int id)
|
||||||
|
{
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
return IPhreeqcPtr->GetLogStringLineCount();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GetLogStringOn(int id)
|
||||||
|
{
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
if (IPhreeqcPtr->GetLogStringOn())
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return IPQ_BADINSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
GetOutputFileName(int id)
|
GetOutputFileName(int id)
|
||||||
{
|
{
|
||||||
@ -579,6 +644,18 @@ SetErrorFileOn(int id, int value)
|
|||||||
return IPQ_BADINSTANCE;
|
return IPQ_BADINSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPQ_RESULT
|
||||||
|
SetLogFileName(int id, const char* filename)
|
||||||
|
{
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
IPhreeqcPtr->SetLogFileName(filename);
|
||||||
|
return IPQ_OK;
|
||||||
|
}
|
||||||
|
return IPQ_BADINSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
IPQ_RESULT
|
IPQ_RESULT
|
||||||
SetLogFileOn(int id, int value)
|
SetLogFileOn(int id, int value)
|
||||||
{
|
{
|
||||||
@ -591,6 +668,18 @@ SetLogFileOn(int id, int value)
|
|||||||
return IPQ_BADINSTANCE;
|
return IPQ_BADINSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPQ_RESULT
|
||||||
|
SetLogStringOn(int id, int value)
|
||||||
|
{
|
||||||
|
IPhreeqc* IPhreeqcPtr = IPhreeqcLib::GetInstance(id);
|
||||||
|
if (IPhreeqcPtr)
|
||||||
|
{
|
||||||
|
IPhreeqcPtr->SetLogStringOn(value != 0);
|
||||||
|
return IPQ_OK;
|
||||||
|
}
|
||||||
|
return IPQ_BADINSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
IPQ_RESULT
|
IPQ_RESULT
|
||||||
SetOutputFileName(int id, const char* filename)
|
SetOutputFileName(int id, const char* filename)
|
||||||
{
|
{
|
||||||
|
|||||||
72
fwrap.cpp
72
fwrap.cpp
@ -176,12 +176,36 @@ GetErrorStringLineF(int *id, int* n, char* line, unsigned int line_length)
|
|||||||
padfstring(line, ::GetErrorStringLine(*id, (*n) - 1), line_length);
|
padfstring(line, ::GetErrorStringLine(*id, (*n) - 1), line_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GetLogFileNameF(int *id, char* fname, unsigned int fname_length)
|
||||||
|
{
|
||||||
|
padfstring(fname, ::GetLogFileName(*id), fname_length);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
GetLogFileOnF(int *id)
|
GetLogFileOnF(int *id)
|
||||||
{
|
{
|
||||||
return ::GetLogFileOn(*id);
|
return ::GetLogFileOn(*id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GetLogStringOnF(int *id)
|
||||||
|
{
|
||||||
|
return ::GetLogStringOn(*id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GetLogStringLineCountF(int *id)
|
||||||
|
{
|
||||||
|
return ::GetLogStringLineCount(*id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GetLogStringLineF(int *id, int* n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
padfstring(line, ::GetLogStringLine(*id, (*n) - 1), line_length);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GetOutputFileNameF(int *id, char* fname, unsigned int fname_length)
|
GetOutputFileNameF(int *id, char* fname, unsigned int fname_length)
|
||||||
{
|
{
|
||||||
@ -420,12 +444,35 @@ SetErrorFileOnF(int *id, int* error_on)
|
|||||||
return ::SetErrorFileOn(*id, *error_on);
|
return ::SetErrorFileOn(*id, *error_on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPQ_RESULT
|
||||||
|
SetLogFileNameF(int *id, char* fname, unsigned int fname_length)
|
||||||
|
{
|
||||||
|
char* cinput;
|
||||||
|
|
||||||
|
cinput = f2cstring(fname, fname_length);
|
||||||
|
if (!cinput)
|
||||||
|
{
|
||||||
|
::AddError(*id, "SetLogFileName: Out of memory.\n");
|
||||||
|
return IPQ_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPQ_RESULT n = ::SetLogFileName(*id, cinput);
|
||||||
|
free(cinput);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
IPQ_RESULT
|
IPQ_RESULT
|
||||||
SetLogFileOnF(int *id, int* log_on)
|
SetLogFileOnF(int *id, int* log_on)
|
||||||
{
|
{
|
||||||
return ::SetLogFileOn(*id, *log_on);
|
return ::SetLogFileOn(*id, *log_on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPQ_RESULT
|
||||||
|
SetLogStringOnF(int *id, int* log_string_on)
|
||||||
|
{
|
||||||
|
return ::SetLogStringOn(*id, *log_string_on);
|
||||||
|
}
|
||||||
|
|
||||||
IPQ_RESULT
|
IPQ_RESULT
|
||||||
SetOutputFileNameF(int *id, char* fname, unsigned int fname_length)
|
SetOutputFileNameF(int *id, char* fname, unsigned int fname_length)
|
||||||
{
|
{
|
||||||
@ -536,10 +583,27 @@ IPQ_DLL_EXPORT int __stdcall GETERRORSTRINGLINECOUNT(int *id)
|
|||||||
{
|
{
|
||||||
return GetErrorStringLineCountF(id);
|
return GetErrorStringLineCountF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT void __stdcall GETLOGFILENAME(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
GetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int __stdcall GETLOGFILEON(int *id)
|
IPQ_DLL_EXPORT int __stdcall GETLOGFILEON(int *id)
|
||||||
{
|
{
|
||||||
return GetLogFileOnF(id);
|
return GetLogFileOnF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int __stdcall GETLOGSTRINGON(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringOnF(id);
|
||||||
|
}
|
||||||
|
// GetLogString
|
||||||
|
IPQ_DLL_EXPORT void __stdcall GETLOGSTRINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetLogStringLineF(id, n, line, line_length);
|
||||||
|
}
|
||||||
|
IPQ_DLL_EXPORT int __stdcall GETLOGSTRINGLINECOUNT(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringLineCountF(id);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT void __stdcall GETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT void __stdcall GETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
GetOutputFileNameF(id, filename, len);
|
GetOutputFileNameF(id, filename, len);
|
||||||
@ -634,10 +698,18 @@ IPQ_DLL_EXPORT int __stdcall SETERRORFILEON(int *id, int *error_on)
|
|||||||
{
|
{
|
||||||
return SetErrorFileOnF(id, error_on);
|
return SetErrorFileOnF(id, error_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int __stdcall SETLOGFILENAME(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return SetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int __stdcall SETLOGFILEON(int *id, int *log_on)
|
IPQ_DLL_EXPORT int __stdcall SETLOGFILEON(int *id, int *log_on)
|
||||||
{
|
{
|
||||||
return SetLogFileOnF(id, log_on);
|
return SetLogFileOnF(id, log_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int __stdcall SETLOGSTRINGON(int *id, int *log_on)
|
||||||
|
{
|
||||||
|
return SetLogStringOnF(id, log_on);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int __stdcall SETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT int __stdcall SETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
return SetOutputFileNameF(id, filename, len);
|
return SetOutputFileNameF(id, filename, len);
|
||||||
|
|||||||
12
fwrap.h
12
fwrap.h
@ -24,7 +24,11 @@
|
|||||||
#define GetErrorStringLineCountF FC_FUNC (geterrorstringlinecountf, GETERRORSTRINGLINECOUNTF)
|
#define GetErrorStringLineCountF FC_FUNC (geterrorstringlinecountf, GETERRORSTRINGLINECOUNTF)
|
||||||
#define GetErrorStringLineF FC_FUNC (geterrorstringlinef, GETERRORSTRINGLINEF)
|
#define GetErrorStringLineF FC_FUNC (geterrorstringlinef, GETERRORSTRINGLINEF)
|
||||||
#define GetErrorFileOnF FC_FUNC (geterrorfileonf, GETERRORFILEONF)
|
#define GetErrorFileOnF FC_FUNC (geterrorfileonf, GETERRORFILEONF)
|
||||||
|
#define GetLogFileNameF FC_FUNC (getlogfilenamef, GETLOGFILENAMEF)
|
||||||
#define GetLogFileOnF FC_FUNC (getlogfileonf, GETLOGFILEONF)
|
#define GetLogFileOnF FC_FUNC (getlogfileonf, GETLOGFILEONF)
|
||||||
|
#define GetLogStringLineCountF FC_FUNC (getlogstringlinecountf, GETLOGSTRINGLINECOUNTF)
|
||||||
|
#define GetLogStringLineF FC_FUNC (getlogstringlinef, GETLOGSTRINGLINEF)
|
||||||
|
#define GetLogStringOnF FC_FUNC (getlogstringonf, GETLOGSTRINGONF)
|
||||||
#define GetOutputFileNameF FC_FUNC (getoutputfilenamef, GETOUTPUTFILENAMEF)
|
#define GetOutputFileNameF FC_FUNC (getoutputfilenamef, GETOUTPUTFILENAMEF)
|
||||||
#define GetOutputFileOnF FC_FUNC (getoutputfileonf, GETOUTPUTFILEONF)
|
#define GetOutputFileOnF FC_FUNC (getoutputfileonf, GETOUTPUTFILEONF)
|
||||||
#define GetOutputStringLineF FC_FUNC (getoutputstringlinef, GETOUTPUTSTRINGLINEF)
|
#define GetOutputStringLineF FC_FUNC (getoutputstringlinef, GETOUTPUTSTRINGLINEF)
|
||||||
@ -48,7 +52,9 @@
|
|||||||
#define SetDumpFileOnF FC_FUNC (setdumpfileonf, SETDUMPFILEONF)
|
#define SetDumpFileOnF FC_FUNC (setdumpfileonf, SETDUMPFILEONF)
|
||||||
#define SetDumpStringOnF FC_FUNC (setdumpstringonf, SETDUMPSTRINGONF)
|
#define SetDumpStringOnF FC_FUNC (setdumpstringonf, SETDUMPSTRINGONF)
|
||||||
#define SetErrorFileOnF FC_FUNC (seterrorfileonf, SETERRORFILEONF)
|
#define SetErrorFileOnF FC_FUNC (seterrorfileonf, SETERRORFILEONF)
|
||||||
|
#define SetLogFileNameF FC_FUNC (setlogfilenamef, SETLOGFILENAMEF)
|
||||||
#define SetLogFileOnF FC_FUNC (setlogfileonf, SETLOGFILEONF)
|
#define SetLogFileOnF FC_FUNC (setlogfileonf, SETLOGFILEONF)
|
||||||
|
#define SetLogStringOnF FC_FUNC (setlogstringonf, SETLOGSTRINGONF)
|
||||||
#define SetOutputFileNameF FC_FUNC (setoutputfilenamef, SETOUTPUTFILENAMEF)
|
#define SetOutputFileNameF FC_FUNC (setoutputfilenamef, SETOUTPUTFILENAMEF)
|
||||||
#define SetOutputFileOnF FC_FUNC (setoutputfileonf, SETOUTPUTFILEONF)
|
#define SetOutputFileOnF FC_FUNC (setoutputfileonf, SETOUTPUTFILEONF)
|
||||||
#define SetOutputStringOnF FC_FUNC (setoutputstringonf, SETOUTPUTSTRINGONF)
|
#define SetOutputStringOnF FC_FUNC (setoutputstringonf, SETOUTPUTSTRINGONF)
|
||||||
@ -75,7 +81,11 @@ extern "C" {
|
|||||||
int GetErrorStringLineCountF(int *id);
|
int GetErrorStringLineCountF(int *id);
|
||||||
void GetErrorStringLineF(int *id, int* n, char* line, unsigned int line_length);
|
void GetErrorStringLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||||
int GetErrorFileOnF(int *id);
|
int GetErrorFileOnF(int *id);
|
||||||
|
void GetLogFileNameF(int *id, char* filename, unsigned int filename_length);
|
||||||
int GetLogFileOnF(int *id);
|
int GetLogFileOnF(int *id);
|
||||||
|
int GetLogStringLineCountF(int *id);
|
||||||
|
void GetLogStringLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||||
|
int GetLogStringOnF(int *id);
|
||||||
void GetOutputFileNameF(int *id, char* filename, unsigned int filename_length);
|
void GetOutputFileNameF(int *id, char* filename, unsigned int filename_length);
|
||||||
int GetOutputFileOnF(int *id);
|
int GetOutputFileOnF(int *id);
|
||||||
int GetOutputStringLineCountF(int *id);
|
int GetOutputStringLineCountF(int *id);
|
||||||
@ -99,7 +109,9 @@ extern "C" {
|
|||||||
IPQ_RESULT SetDumpFileOnF(int *id, int* dump_on);
|
IPQ_RESULT SetDumpFileOnF(int *id, int* dump_on);
|
||||||
IPQ_RESULT SetDumpStringOnF(int *id, int* dump_string_on);
|
IPQ_RESULT SetDumpStringOnF(int *id, int* dump_string_on);
|
||||||
IPQ_RESULT SetErrorFileOnF(int *id, int* error_on);
|
IPQ_RESULT SetErrorFileOnF(int *id, int* error_on);
|
||||||
|
IPQ_RESULT SetLogFileNameF(int *id, char* fname, unsigned int fname_length);
|
||||||
IPQ_RESULT SetLogFileOnF(int *id, int* log_on);
|
IPQ_RESULT SetLogFileOnF(int *id, int* log_on);
|
||||||
|
IPQ_RESULT SetLogStringOnF(int *id, int* log_string_on);
|
||||||
IPQ_RESULT SetOutputFileNameF(int *id, char* fname, unsigned int fname_length);
|
IPQ_RESULT SetOutputFileNameF(int *id, char* fname, unsigned int fname_length);
|
||||||
IPQ_RESULT SetOutputFileOnF(int *id, int* output_on);
|
IPQ_RESULT SetOutputFileOnF(int *id, int* output_on);
|
||||||
IPQ_RESULT SetOutputStringOnF(int *id, int* output_string_on);
|
IPQ_RESULT SetOutputStringOnF(int *id, int* output_string_on);
|
||||||
|
|||||||
25
fwrap2.cpp
25
fwrap2.cpp
@ -76,10 +76,27 @@ IPQ_DLL_EXPORT int GETERRORSTRINGLINECOUNT(int *id)
|
|||||||
{
|
{
|
||||||
return GetErrorStringLineCountF(id);
|
return GetErrorStringLineCountF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT void GETLOGFILENAME(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
GetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int GETLOGFILEON(int *id)
|
IPQ_DLL_EXPORT int GETLOGFILEON(int *id)
|
||||||
{
|
{
|
||||||
return GetLogFileOnF(id);
|
return GetLogFileOnF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int GETLOGSTRINGON(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringOnF(id);
|
||||||
|
}
|
||||||
|
// GetLogString
|
||||||
|
IPQ_DLL_EXPORT void GETLOGSTRINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetLogStringLineF(id, n, line, line_length);
|
||||||
|
}
|
||||||
|
IPQ_DLL_EXPORT int GETLOGSTRINGLINECOUNT(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringLineCountF(id);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT void GETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT void GETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
GetOutputFileNameF(id, filename, len);
|
GetOutputFileNameF(id, filename, len);
|
||||||
@ -173,10 +190,18 @@ IPQ_DLL_EXPORT int SETERRORFILEON(int *id, int *error_on)
|
|||||||
{
|
{
|
||||||
return SetErrorFileOnF(id, error_on);
|
return SetErrorFileOnF(id, error_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int SETLOGFILENAME(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return SetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int SETLOGFILEON(int *id, int *log_on)
|
IPQ_DLL_EXPORT int SETLOGFILEON(int *id, int *log_on)
|
||||||
{
|
{
|
||||||
return SetLogFileOnF(id, log_on);
|
return SetLogFileOnF(id, log_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int SETLOGSTRINGON(int *id, int *log_on)
|
||||||
|
{
|
||||||
|
return SetLogStringOnF(id, log_on);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int SETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT int SETOUTPUTFILENAME(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
return SetOutputFileNameF(id, filename, len);
|
return SetOutputFileNameF(id, filename, len);
|
||||||
|
|||||||
25
fwrap3.cpp
25
fwrap3.cpp
@ -76,10 +76,27 @@ IPQ_DLL_EXPORT int geterrorstringlinecount_(int *id)
|
|||||||
{
|
{
|
||||||
return GetErrorStringLineCountF(id);
|
return GetErrorStringLineCountF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT void getlogfilename_(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
GetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int getlogfileon_(int *id)
|
IPQ_DLL_EXPORT int getlogfileon_(int *id)
|
||||||
{
|
{
|
||||||
return GetLogFileOnF(id);
|
return GetLogFileOnF(id);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int getlogstringon_(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringOnF(id);
|
||||||
|
}
|
||||||
|
// GetLogString
|
||||||
|
IPQ_DLL_EXPORT void getlogstringline_(int *id, int *n, char* line, unsigned int line_length)
|
||||||
|
{
|
||||||
|
GetLogStringLineF(id, n, line, line_length);
|
||||||
|
}
|
||||||
|
IPQ_DLL_EXPORT int getlogstringlinecount_(int *id)
|
||||||
|
{
|
||||||
|
return GetLogStringLineCountF(id);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT void getoutputfilename_(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT void getoutputfilename_(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
GetOutputFileNameF(id, filename, len);
|
GetOutputFileNameF(id, filename, len);
|
||||||
@ -174,10 +191,18 @@ IPQ_DLL_EXPORT int seterrorfileon_(int *id, int *error_on)
|
|||||||
{
|
{
|
||||||
return SetErrorFileOnF(id, error_on);
|
return SetErrorFileOnF(id, error_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int setlogfilename_(int *id, char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return SetLogFileNameF(id, filename, len);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int setlogfileon_(int *id, int *log_on)
|
IPQ_DLL_EXPORT int setlogfileon_(int *id, int *log_on)
|
||||||
{
|
{
|
||||||
return SetLogFileOnF(id, log_on);
|
return SetLogFileOnF(id, log_on);
|
||||||
}
|
}
|
||||||
|
IPQ_DLL_EXPORT int setlogstringon_(int *id, int *log_on)
|
||||||
|
{
|
||||||
|
return SetLogStringOnF(id, log_on);
|
||||||
|
}
|
||||||
IPQ_DLL_EXPORT int setoutputfilename_(int *id, char *filename, unsigned int len)
|
IPQ_DLL_EXPORT int setoutputfilename_(int *id, char *filename, unsigned int len)
|
||||||
{
|
{
|
||||||
return SetOutputFileNameF(id, filename, len);
|
return SetOutputFileNameF(id, filename, len);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user