mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4184 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
761c7de03e
commit
14e1791753
22
IPhreeqc.cpp
22
IPhreeqc.cpp
@ -1,4 +1,5 @@
|
||||
#include <memory>
|
||||
#include <cassert>
|
||||
#include "IPhreeqc.h"
|
||||
#include "IPhreeqc.hpp"
|
||||
#include "ErrorReporter.hxx"
|
||||
@ -824,29 +825,36 @@ int IPhreeqc::handler(const int action, const int type, const char *err_str, con
|
||||
|
||||
int IPhreeqc::output_handler(const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args)
|
||||
{
|
||||
IPhreeqc* pIPhreeqc = (IPhreeqc*) cookie;
|
||||
assert(cookie == this);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case OUTPUT_ERROR:
|
||||
if (pIPhreeqc)
|
||||
if (this)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ERROR: " << err_str << "\n";
|
||||
if (stop == STOP)
|
||||
{
|
||||
static std::string str(200, ' ');
|
||||
static std::ostringstream oss(str);
|
||||
oss << "ERROR: " << err_str << "\n";
|
||||
oss << "Stopping.\n";
|
||||
this->AddError(oss.str().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ERROR: " << err_str << "\n";
|
||||
this->AddError(oss.str().c_str());
|
||||
}
|
||||
pIPhreeqc->AddError(oss.str().c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
case OUTPUT_WARNING:
|
||||
if (pIPhreeqc)
|
||||
if (this)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "WARNING: " << err_str << "\n";
|
||||
pIPhreeqc->AddWarning(oss.str().c_str());
|
||||
this->AddWarning(oss.str().c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
21
fwrap.cpp
21
fwrap.cpp
@ -222,7 +222,12 @@ RunStringF(char* input, unsigned int input_length)
|
||||
int
|
||||
GetSelectedOutputRowCountF(void)
|
||||
{
|
||||
return ::GetSelectedOutputRowCount();
|
||||
int rows = ::GetSelectedOutputRowCount();
|
||||
if (rows > 0)
|
||||
{
|
||||
rows -= 1;
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
int
|
||||
@ -237,7 +242,10 @@ GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* sv
|
||||
VRESULT result;
|
||||
VAR v;
|
||||
VarInit(&v);
|
||||
result = ::GetSelectedOutputValue(*row, *col, &v);
|
||||
char buffer[100];
|
||||
|
||||
int adjcol = *col - 1;
|
||||
result = ::GetSelectedOutputValue(*row, adjcol, &v);
|
||||
|
||||
switch (v.type) {
|
||||
case TT_EMPTY:
|
||||
@ -249,10 +257,14 @@ GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* sv
|
||||
case TT_LONG:
|
||||
*vtype = TT_DOUBLE;
|
||||
*dvalue = (double)v.lVal;
|
||||
::sprintf(buffer, "%d", v.lVal);
|
||||
padfstring(svalue, buffer, svalue_length);
|
||||
break;
|
||||
case TT_DOUBLE:
|
||||
*vtype = v.type;
|
||||
*dvalue = v.dVal;
|
||||
::sprintf(buffer, "%23.15e", v.dVal);
|
||||
padfstring(svalue, buffer, svalue_length);
|
||||
break;
|
||||
case TT_STRING:
|
||||
*vtype = v.type;
|
||||
@ -391,7 +403,7 @@ void __stdcall OUTPUTLINES(void)
|
||||
}
|
||||
int __stdcall GETSELECTEDOUTPUTROWCOUNT(void)
|
||||
{
|
||||
return GetSelectedOutputRowCountF() - 1;
|
||||
return GetSelectedOutputRowCountF();
|
||||
}
|
||||
int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(void)
|
||||
{
|
||||
@ -399,8 +411,7 @@ int __stdcall GETSELECTEDOUTPUTCOLUMNCOUNT(void)
|
||||
}
|
||||
int __stdcall GETSELECTEDOUTPUTVALUE(int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
{
|
||||
int adjcol = *col - 1;
|
||||
return GetSelectedOutputValueF(row, &adjcol, vtype, dvalue, svalue, svalue_length);
|
||||
return GetSelectedOutputValueF(row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ void OUTPUTLINES(void)
|
||||
}
|
||||
int GETSELECTEDOUTPUTROWCOUNT(void)
|
||||
{
|
||||
return GetSelectedOutputRowCountF() - 1;
|
||||
return GetSelectedOutputRowCountF();
|
||||
}
|
||||
int GETSELECTEDOUTPUTCOLUMNCOUNT(void)
|
||||
{
|
||||
@ -96,8 +96,7 @@ int GETSELECTEDOUTPUTCOLUMNCOUNT(void)
|
||||
}
|
||||
int GETSELECTEDOUTPUTVALUE(int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
{
|
||||
int adjcol = *col - 1;
|
||||
return GetSelectedOutputValueF(row, &adjcol, vtype, dvalue, svalue, svalue_length);
|
||||
return GetSelectedOutputValueF(row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@ -88,7 +88,7 @@ void outputlines_(void)
|
||||
}
|
||||
int getselectedoutputrowcount_(void)
|
||||
{
|
||||
return GetSelectedOutputRowCountF() - 1;
|
||||
return GetSelectedOutputRowCountF();
|
||||
}
|
||||
int getselectedoutputcolumncount_(void)
|
||||
{
|
||||
@ -96,8 +96,7 @@ int getselectedoutputcolumncount_(void)
|
||||
}
|
||||
int getselectedoutputvalue_(int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length)
|
||||
{
|
||||
int adjcol = *col - 1;
|
||||
return GetSelectedOutputValueF(row, &adjcol, vtype, dvalue, svalue, svalue_length);
|
||||
return GetSelectedOutputValueF(row, col, vtype, dvalue, svalue, svalue_length);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user