mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
added GetVersionString
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8153 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
5b9b110386
commit
4e28740d56
@ -1870,6 +1870,10 @@
|
||||
RelativePath=".\src\Var.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Version.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
||||
@ -217,6 +217,7 @@ if [ -z "$ver_patch" ]; then
|
||||
fi
|
||||
|
||||
SED_FILES="$DISTPATH/phreeqc3-doc/RELEASE.TXT \
|
||||
$DISTPATH/src/Version.h \
|
||||
$DISTPATH/src/IPhreeqc.h"
|
||||
|
||||
for vsn_file in $SED_FILES
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "IPhreeqc.hpp" // IPhreeqc
|
||||
#include "Phreeqc.h" // Phreeqc
|
||||
#include "thread.h"
|
||||
#include "Version.h"
|
||||
|
||||
#include "Debug.h" // ASSERT
|
||||
#include "ErrorReporter.hxx" // CErrorReporter
|
||||
@ -22,6 +23,8 @@ const char DUMP_FILENAME_FORMAT[] = "dump.%d.out";
|
||||
std::map<size_t, IPhreeqc*> IPhreeqc::Instances;
|
||||
size_t IPhreeqc::InstancesIndex = 0;
|
||||
|
||||
std::string IPhreeqc::Version(VERSION_STRING);
|
||||
|
||||
static const char empty[] = "";
|
||||
|
||||
|
||||
@ -510,6 +513,11 @@ VRESULT IPhreeqc::GetSelectedOutputValue2(int row, int col, int *vtype, double*
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* IPhreeqc::GetVersionString(void)
|
||||
{
|
||||
return IPhreeqc::Version.c_str();
|
||||
}
|
||||
|
||||
const char* IPhreeqc::GetWarningString(void)
|
||||
{
|
||||
this->WarningString = ((CErrorReporter<std::ostringstream>*)this->WarningReporter)->GetOS()->str();
|
||||
@ -1101,6 +1109,7 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
||||
{
|
||||
ASSERT(this->SelectedOutputMap[(*mit).first] == this->CurrentSelectedOutputMap[&(*mit).second]);
|
||||
}
|
||||
/**
|
||||
if (this->PhreeqcPtr->simulation > 1 && save_punch_in && (*mit).second.Get_new_def() && !bWarning)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -1108,13 +1117,16 @@ void IPhreeqc::do_run(const char* sz_routine, std::istream* pis, PFN_PRERUN_CALL
|
||||
this->PhreeqcPtr->warning_msg(oss.str().c_str());
|
||||
bWarning = true;
|
||||
}
|
||||
**/
|
||||
}
|
||||
/**
|
||||
if (this->PhreeqcPtr->simulation > 1 && this->PhreeqcPtr->keycount[Keywords::KEY_USER_PUNCH] > 0)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << sz_routine << ": Warning USER_PUNCH has been redefined.\n";
|
||||
this->PhreeqcPtr->warning_msg(oss.str().c_str());
|
||||
}
|
||||
**/
|
||||
|
||||
if (this->PhreeqcPtr->title_x != NULL)
|
||||
{
|
||||
|
||||
@ -1329,6 +1329,28 @@ Headings
|
||||
IPQ_DLL_EXPORT IPQ_RESULT GetSelectedOutputValue2(int id, int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the string buffer containing the version in the form of X.X.X-XXXX.
|
||||
* @return A null terminated string containing the IPhreeqc version number.
|
||||
* @par Fortran90 Interface:
|
||||
* @htmlonly
|
||||
* <CODE>
|
||||
* <PRE>
|
||||
* SUBROUTINE GetVersionString(VERSION)
|
||||
* CHARACTER(LEN=*), INTENT(OUT) :: VERSION
|
||||
* END SUBROUTINE GetVersionString
|
||||
* </PRE>
|
||||
* </CODE>
|
||||
* @endhtmlonly
|
||||
*
|
||||
* @par C Example:
|
||||
* @include GetVersionString.c
|
||||
*
|
||||
* @par Fortran90 Example:
|
||||
* @include GetVersionString.f90
|
||||
*/
|
||||
IPQ_DLL_EXPORT const char* GetVersionString(void);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the warning messages from the last call to @ref RunAccumulated, @ref RunFile, @ref RunString, @ref LoadDatabase, or @ref LoadDatabaseString.
|
||||
|
||||
@ -584,6 +584,12 @@ public:
|
||||
*/
|
||||
VRESULT GetSelectedOutputValue2(int row, int col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
||||
|
||||
/**
|
||||
* Retrieves the string buffer containing the version in the form of X.X.X-XXXX.
|
||||
* @return A null terminated string containing the IPhreeqc version number.
|
||||
*/
|
||||
static const char* GetVersionString(void);
|
||||
|
||||
/**
|
||||
* Retrieves the warning messages from the last call to @ref RunAccumulated, @ref RunFile, @ref RunString, @ref LoadDatabase, or @ref LoadDatabaseString.
|
||||
* @return A null terminated string containing warning messages.
|
||||
@ -945,6 +951,8 @@ protected:
|
||||
static size_t InstancesIndex;
|
||||
size_t Index;
|
||||
|
||||
static std::string Version;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
/* reset warning C4251 */
|
||||
#pragma warning(default:4251)
|
||||
|
||||
@ -378,6 +378,12 @@
|
||||
GetSelectedOutputValue = GetSelectedOutputValueF(ID,ROW,
|
||||
& COL,VTYPE,DVALUE,SVALUE)
|
||||
END FUNCTION GetSelectedOutputValue
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
SUBROUTINE GetVersionString(VERSION)
|
||||
IMPLICIT NONE
|
||||
CHARACTER(LEN=*) :: VERSION
|
||||
CALL GetVersionStringF(VERSION)
|
||||
END SUBROUTINE GetVersionString
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! GetWarningString
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
@ -629,6 +629,12 @@ GetSelectedOutputValue2(int id, int row, int col, int *vtype, double* dvalue, ch
|
||||
return IPQ_BADINSTANCE;
|
||||
}
|
||||
|
||||
const char*
|
||||
GetVersionString(void)
|
||||
{
|
||||
return IPhreeqc::GetVersionString();
|
||||
}
|
||||
|
||||
const char*
|
||||
GetWarningString(int id)
|
||||
{
|
||||
|
||||
35
src/Version.h
Normal file
35
src/Version.h
Normal file
@ -0,0 +1,35 @@
|
||||
#define NAME "IPhreeqc"
|
||||
#define VER_MAJOR 3
|
||||
#define VER_MINOR 0
|
||||
#define VER_PATCH 0
|
||||
#define VER_REVISION 0
|
||||
|
||||
#define RELEASE_DATE "@RELEASE_DATE@"
|
||||
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
|
||||
/** Version number */
|
||||
#define VER_NUM APR_STRINGIFY(VER_MAJOR) \
|
||||
"." APR_STRINGIFY(VER_MINOR) \
|
||||
"." APR_STRINGIFY(VER_PATCH) \
|
||||
"." APR_STRINGIFY(VER_REVISION)
|
||||
|
||||
|
||||
|
||||
#define PRODUCT_NAME NAME \
|
||||
"-" APR_STRINGIFY(VER_MAJOR) \
|
||||
"." APR_STRINGIFY(VER_MINOR)
|
||||
|
||||
#if defined(_WIN64)
|
||||
#define VERSION_STRING APR_STRINGIFY(VER_MAJOR) \
|
||||
"." APR_STRINGIFY(VER_MINOR) \
|
||||
"." APR_STRINGIFY(VER_PATCH) \
|
||||
"-" APR_STRINGIFY(VER_REVISION) \
|
||||
"-x64"
|
||||
#else
|
||||
#define VERSION_STRING APR_STRINGIFY(VER_MAJOR) \
|
||||
"." APR_STRINGIFY(VER_MINOR) \
|
||||
"." APR_STRINGIFY(VER_PATCH) \
|
||||
"-" APR_STRINGIFY(VER_REVISION)
|
||||
#endif
|
||||
@ -359,6 +359,12 @@ GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue,
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
GetVersionStringF(char* version, unsigned int version_length)
|
||||
{
|
||||
padfstring(version, ::GetVersionString(), version_length);
|
||||
}
|
||||
|
||||
/*
|
||||
GetWarningStringF
|
||||
*/
|
||||
@ -794,6 +800,10 @@ IPQ_DLL_EXPORT int __stdcall GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void __stdcall GETVERSIONSTRING(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void __stdcall GETWARNINGSTRINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#define GetSelectedOutputStringLineF FC_FUNC (getselectedoutputstringlinef, GETSELECTEDOUTPUTSTRINGLINEF)
|
||||
#define GetSelectedOutputStringOnF FC_FUNC (getselectedoutputstringonf, GETSELECTEDOUTPUTSTRINGONF)
|
||||
#define GetSelectedOutputValueF FC_FUNC (getselectedoutputvaluef, GETSELECTEDOUTPUTVALUEF)
|
||||
#define GetVersionStringF FC_FUNC (getversionstringf, GETVERSIONSTRINGF)
|
||||
#define GetWarningStringLineCountF FC_FUNC (getwarningstringlinecountf, GETWARNINGSTRINGLINECOUNTF)
|
||||
#define GetWarningStringLineF FC_FUNC (getwarningstringlinef, GETWARNINGSTRINGLINEF)
|
||||
#define LoadDatabaseF FC_FUNC (loaddatabasef, LOADDATABASEF)
|
||||
@ -119,6 +120,7 @@ extern "C" {
|
||||
void GetSelectedOutputStringLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int GetSelectedOutputStringOnF(int *id);
|
||||
IPQ_RESULT GetSelectedOutputValueF(int *id, int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
||||
void GetVersionStringF(char* version, unsigned int version_length);
|
||||
int GetWarningStringLineCountF(int *id);
|
||||
void GetWarningStringLineF(int *id, int* n, char* line, unsigned int line_length);
|
||||
int LoadDatabaseF(int *id, char* filename, unsigned int filename_length);
|
||||
|
||||
@ -171,6 +171,10 @@ IPQ_DLL_EXPORT int GETSELECTEDOUTPUTVALUE(int *id, int *row, int *col, int *vty
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void GETVERSIONSTRING(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void GETWARNINGSTRINGLINE(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
GetWarningStringLineF(id, n, line, line_length);
|
||||
|
||||
@ -171,6 +171,10 @@ IPQ_DLL_EXPORT int getselectedoutputvalue_(int *id, int *row, int *col, int *vt
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void getversionstring_(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void getwarningstringline_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -171,6 +171,10 @@ IPQ_DLL_EXPORT int getselectedoutputvalue(int *id, int *row, int *col, int *vty
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void getversionstring(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void getwarningstringline(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -172,6 +172,10 @@ IPQ_DLL_EXPORT int GETSELECTEDOUTPUTVALUE_(int *id, int *row, int *col, int *vt
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void GETVERSIONSTRING_(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void GETWARNINGSTRINGLINE_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -172,6 +172,10 @@ IPQ_DLL_EXPORT int __stdcall GETSELECTEDOUTPUTVALUE_(int *id, int *row, int *co
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void __stdcall GETVERSIONSTRING_(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void __stdcall GETWARNINGSTRINGLINE_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -171,6 +171,10 @@ IPQ_DLL_EXPORT int __stdcall getselectedoutputvalue_(int *id, int *row, int *co
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void __stdcall getversionstring_(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void __stdcall getwarningstringline_(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -171,6 +171,10 @@ IPQ_DLL_EXPORT int __stdcall getselectedoutputvalue(int *id, int *row, int *col
|
||||
{
|
||||
return GetSelectedOutputValueF(id, row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
IPQ_DLL_EXPORT void __stdcall getversionstring(char* version, unsigned int version_length)
|
||||
{
|
||||
GetVersionStringF(version, version_length);
|
||||
}
|
||||
// GetWarningString
|
||||
IPQ_DLL_EXPORT void __stdcall getwarningstringline(int *id, int *n, char* line, unsigned int line_length)
|
||||
{
|
||||
|
||||
@ -1508,6 +1508,19 @@ void TestIPhreeqc::TestLongHeadings()
|
||||
oss << "-end" << "\n";
|
||||
CPPUNIT_ASSERT_EQUAL( VR_OK, obj.AccumulateLine(oss.str().c_str()) );
|
||||
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} //{{
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} CPPUNIT_ASSERT_EQUAL( VR_OK, obj.AccumulateLine("END") );
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "SELECTED_OUTPUT" << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "-reset false" << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM}
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "USER_PUNCH" << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "-head " << long_header << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "-start" << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "10 PUNCH \"" << long_value << "\"\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} oss << "-end" << "\n";
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} CPPUNIT_ASSERT_EQUAL( VR_OK, obj.AccumulateLine(oss.str().c_str()) );
|
||||
// COMMENT: {10/30/2013 10:39:40 PM} //}}
|
||||
|
||||
obj.SetOutputFileOn(0);
|
||||
obj.SetErrorFileOn(0);
|
||||
obj.SetLogFileOn(0);
|
||||
@ -4063,3 +4076,31 @@ void TestIPhreeqc::TestMultiSetSelectedOutputFileName(void)
|
||||
CPPUNIT_ASSERT( set1.VerifyExists() );
|
||||
CPPUNIT_ASSERT( set2.VerifyExists() );
|
||||
}
|
||||
|
||||
void TestIPhreeqc::TestRunIC(void)
|
||||
{
|
||||
// COMMENT: {9/18/2013 8:54:17 PM} const char dump_file[] = "error.inp";
|
||||
// COMMENT: {9/18/2013 8:54:17 PM}
|
||||
// COMMENT: {9/18/2013 8:54:17 PM} FileTest dfile(dump_file);
|
||||
// COMMENT: {9/18/2013 8:54:17 PM} CPPUNIT_ASSERT( dfile.RemoveExisting() );
|
||||
|
||||
IPhreeqc obj;
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, obj.LoadDatabase("phreeqc.dat"));
|
||||
obj.SetOutputFileOn(true);
|
||||
obj.SetErrorFileOn(true);
|
||||
obj.SetLogFileOn(true);
|
||||
obj.SetSelectedOutputFileOn(true);
|
||||
obj.SetDumpFileOn(true);
|
||||
CPPUNIT_ASSERT_EQUAL(0, obj.RunFile("ic"));
|
||||
|
||||
// COMMENT: {9/18/2013 8:54:49 PM} const char expected[] =
|
||||
// COMMENT: {9/18/2013 8:54:49 PM} "ERROR: Numerical method failed on all combinations of convergence parameters\n";
|
||||
// COMMENT: {9/18/2013 8:54:49 PM} const char* err = obj.GetErrorString();
|
||||
// COMMENT: {9/18/2013 8:54:49 PM}
|
||||
// COMMENT: {9/18/2013 8:54:49 PM} CPPUNIT_ASSERT_EQUAL(std::string(expected), std::string(err));
|
||||
|
||||
// COMMENT: {9/18/2013 8:54:23 PM} // Note: should this file exist since GetDumpFileOn is false?
|
||||
// COMMENT: {9/18/2013 8:54:23 PM} CPPUNIT_ASSERT( dfile.VerifyExists() );
|
||||
// COMMENT: {9/18/2013 8:54:23 PM} CPPUNIT_ASSERT( dfile.Size() > 0 );
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ class TestIPhreeqc : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST( TestLogFileOnOff );
|
||||
CPPUNIT_TEST( TestDumpFileOnOff );
|
||||
CPPUNIT_TEST( TestSelOutFileOnOff );
|
||||
CPPUNIT_TEST( TestLongHeadings );
|
||||
CPPUNIT_TEST( TestLongHeadings );
|
||||
CPPUNIT_TEST( TestDatabaseKeyword );
|
||||
CPPUNIT_TEST( TestDumpString );
|
||||
CPPUNIT_TEST( TestGetDumpStringLineCount );
|
||||
@ -74,6 +74,7 @@ class TestIPhreeqc : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST( TestGetNthSelectedOutputUserNumber );
|
||||
CPPUNIT_TEST( TestGetCurrentSelectedOutputUserNumber );
|
||||
CPPUNIT_TEST( TestMultiSetSelectedOutputFileName );
|
||||
CPPUNIT_TEST( TestRunIC );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -148,6 +149,7 @@ public:
|
||||
void TestGetNthSelectedOutputUserNumber(void);
|
||||
void TestGetCurrentSelectedOutputUserNumber(void);
|
||||
void TestMultiSetSelectedOutputFileName(void);
|
||||
void TestRunIC(void);
|
||||
|
||||
protected:
|
||||
void TestFileOnOff(const char* FILENAME, bool output_file_on, bool error_file_on, bool log_file_on, bool selected_output_file_on, bool dump_file_on);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user