mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
checkin to test on linux
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4159 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
59e3083acd
commit
37359f2ec7
101
IPhreeqc.cpp
101
IPhreeqc.cpp
@ -46,22 +46,46 @@ AccumulateLine(const char *line)
|
|||||||
return IPhreeqc::LibraryInstance()->AccumulateLine(line);
|
return IPhreeqc::LibraryInstance()->AccumulateLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
Run(int output_on, int error_on, int log_on, int selected_output_on)
|
SetSelectedOutputOn(int value)
|
||||||
{
|
{
|
||||||
return IPhreeqc::LibraryInstance()->Run(output_on, error_on, log_on, selected_output_on);
|
return IPhreeqc::LibraryInstance()->SetSelectedOutputOn(value != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetOutputOn(int value)
|
||||||
|
{
|
||||||
|
return IPhreeqc::LibraryInstance()->SetOutputOn(value != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetErrorOn(int value)
|
||||||
|
{
|
||||||
|
return IPhreeqc::LibraryInstance()->SetErrorOn(value != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetLogOn(int value)
|
||||||
|
{
|
||||||
|
return IPhreeqc::LibraryInstance()->SetLogOn(value != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RunFile(const char* filename, int output_on, int error_on, int log_on, int selected_output_on)
|
Run(void)
|
||||||
{
|
{
|
||||||
return IPhreeqc::LibraryInstance()->RunFile(filename, output_on, error_on, log_on, selected_output_on);
|
return IPhreeqc::LibraryInstance()->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RunString(const char* input, int output_on, int error_on, int log_on, int selected_output_on)
|
RunFile(const char* filename)
|
||||||
{
|
{
|
||||||
return IPhreeqc::LibraryInstance()->RunString(input, output_on, error_on, log_on, selected_output_on);
|
return IPhreeqc::LibraryInstance()->RunFile(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
RunString(const char* input)
|
||||||
|
{
|
||||||
|
return IPhreeqc::LibraryInstance()->RunString(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -114,11 +138,16 @@ IPhreeqc::IPhreeqc(void)
|
|||||||
, SelectedOutput(0)
|
, SelectedOutput(0)
|
||||||
, DatabaseLoaded(false)
|
, DatabaseLoaded(false)
|
||||||
, SelectedOutputOn(false)
|
, SelectedOutputOn(false)
|
||||||
|
, OutputOn(false)
|
||||||
|
, LogOn(false)
|
||||||
|
, ErrorOn(false)
|
||||||
|
, DumpOn(false)
|
||||||
|
, DumpStringOn(false)
|
||||||
{
|
{
|
||||||
ASSERT(this->phast == 0);
|
ASSERT(this->phast == 0);
|
||||||
this->ErrorReporter = new CErrorReporter<std::ostringstream>;
|
this->ErrorReporter = new CErrorReporter<std::ostringstream>;
|
||||||
this->SelectedOutput = new CSelectedOutput();
|
this->SelectedOutput = new CSelectedOutput();
|
||||||
this->Init();
|
this->init();
|
||||||
this->UnLoadDatabase();
|
this->UnLoadDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,7 +651,12 @@ int istream_getc(void *cookie)
|
|||||||
if (cookie)
|
if (cookie)
|
||||||
{
|
{
|
||||||
std::istream* is = (std::istream*)cookie;
|
std::istream* is = (std::istream*)cookie;
|
||||||
return is->get();
|
int n = is->get();
|
||||||
|
if (n == 13 && is->peek() == 10)
|
||||||
|
{
|
||||||
|
n = is->get();
|
||||||
|
}
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
@ -705,7 +739,7 @@ int IPhreeqc::open_handler(const int type, const char *file_name)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPhreeqc::Init(void)
|
void IPhreeqc::init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1186,6 +1220,31 @@ void IPhreeqc::Init(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetOutputOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->OutputOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetSelectedOutputOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->SelectedOutputOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetLogOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->LogOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetDumpOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->DumpOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPhreeqc::SetErrorOn(bool bValue)
|
||||||
|
{
|
||||||
|
this->ErrorOn = bValue;
|
||||||
|
}
|
||||||
|
|
||||||
void IPhreeqc::AddSelectedOutput(const char* name, const char* format, va_list argptr)
|
void IPhreeqc::AddSelectedOutput(const char* name, const char* format, va_list argptr)
|
||||||
{
|
{
|
||||||
int bInt;
|
int bInt;
|
||||||
@ -1376,7 +1435,7 @@ VRESULT IPhreeqc::AccumulateLine(const char *line)
|
|||||||
return VR_OUTOFMEMORY;
|
return VR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPhreeqc::Run(int output_on, int error_on, int log_on, int selected_output_on)
|
int IPhreeqc::Run(void)
|
||||||
{
|
{
|
||||||
static const char *sz_routine = "Run";
|
static const char *sz_routine = "Run";
|
||||||
try
|
try
|
||||||
@ -1390,6 +1449,10 @@ int IPhreeqc::Run(int output_on, int error_on, int log_on, int selected_output_o
|
|||||||
std::istringstream iss(this->GetAccumulatedLines());
|
std::istringstream iss(this->GetAccumulatedLines());
|
||||||
|
|
||||||
// this may throw
|
// this may throw
|
||||||
|
int output_on = this->OutputOn ? 1 : 0;
|
||||||
|
int error_on = this->ErrorOn ? 1 : 0;
|
||||||
|
int log_on = this->LogOn ? 1 : 0;
|
||||||
|
int selected_output_on = this->SelectedOutputOn ? 1 : 0;
|
||||||
this->do_run(sz_routine, &iss, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
this->do_run(sz_routine, &iss, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
catch (PhreeqcStop)
|
catch (PhreeqcStop)
|
||||||
@ -1414,7 +1477,7 @@ int IPhreeqc::Run(int output_on, int error_on, int log_on, int selected_output_o
|
|||||||
return this->input_error;
|
return this->input_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPhreeqc::RunFile(const char* filename, int output_on, int error_on, int log_on, int selected_output_on)
|
int IPhreeqc::RunFile(const char* filename)
|
||||||
{
|
{
|
||||||
static const char *sz_routine = "RunFile";
|
static const char *sz_routine = "RunFile";
|
||||||
try
|
try
|
||||||
@ -1436,6 +1499,10 @@ int IPhreeqc::RunFile(const char* filename, int output_on, int error_on, int log
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this may throw
|
// this may throw
|
||||||
|
int output_on = this->OutputOn ? 1 : 0;
|
||||||
|
int error_on = this->ErrorOn ? 1 : 0;
|
||||||
|
int log_on = this->LogOn ? 1 : 0;
|
||||||
|
int selected_output_on = this->SelectedOutputOn ? 1 : 0;
|
||||||
this->do_run(sz_routine, &ifs, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
this->do_run(sz_routine, &ifs, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
||||||
#else
|
#else
|
||||||
// open file
|
// open file
|
||||||
@ -1449,6 +1516,10 @@ int IPhreeqc::RunFile(const char* filename, int output_on, int error_on, int log
|
|||||||
}
|
}
|
||||||
|
|
||||||
// this may throw
|
// this may throw
|
||||||
|
int output_on = this->OutputOn ? 1 : 0;
|
||||||
|
int error_on = this->ErrorOn ? 1 : 0;
|
||||||
|
int log_on = this->LogOn ? 1 : 0;
|
||||||
|
int selected_output_on = this->SelectedOutputOn ? 1 : 0;
|
||||||
this->do_run(sz_routine, NULL, f, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
this->do_run(sz_routine, NULL, f, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1473,7 +1544,7 @@ int IPhreeqc::RunFile(const char* filename, int output_on, int error_on, int log
|
|||||||
return this->input_error;
|
return this->input_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPhreeqc::RunString(const char* input, int output_on, int error_on, int log_on, int selected_output_on)
|
int IPhreeqc::RunString(const char* input)
|
||||||
{
|
{
|
||||||
static const char *sz_routine = "RunString";
|
static const char *sz_routine = "RunString";
|
||||||
try
|
try
|
||||||
@ -1488,6 +1559,10 @@ int IPhreeqc::RunString(const char* input, int output_on, int error_on, int log_
|
|||||||
std::istringstream iss(s);
|
std::istringstream iss(s);
|
||||||
|
|
||||||
// this may throw
|
// this may throw
|
||||||
|
int output_on = this->OutputOn ? 1 : 0;
|
||||||
|
int error_on = this->ErrorOn ? 1 : 0;
|
||||||
|
int log_on = this->LogOn ? 1 : 0;
|
||||||
|
int selected_output_on = this->SelectedOutputOn ? 1 : 0;
|
||||||
this->do_run(sz_routine, &iss, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
this->do_run(sz_routine, &iss, NULL, output_on, error_on, log_on, selected_output_on, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
catch (PhreeqcStop)
|
catch (PhreeqcStop)
|
||||||
|
|||||||
26
IPhreeqc.hpp
26
IPhreeqc.hpp
@ -28,9 +28,17 @@ public:
|
|||||||
|
|
||||||
VRESULT AccumulateLine(const char *line);
|
VRESULT AccumulateLine(const char *line);
|
||||||
|
|
||||||
int Run(int output_on, int error_on, int log_on, int selected_output_on);
|
//{{
|
||||||
int RunFile(const char* filename, int output_on, int error_on, int log_on, int selected_output_on);
|
void SetDumpOn(bool bValue);
|
||||||
int RunString(const char* input, int output_on, int error_on, int log_on, int selected_output_on);
|
void SetErrorOn(bool bValue);
|
||||||
|
void SetLogOn(bool bValue);
|
||||||
|
void SetOutputOn(bool bValue);
|
||||||
|
void SetSelectedOutputOn(bool bValue);
|
||||||
|
//}}
|
||||||
|
|
||||||
|
int Run(void);
|
||||||
|
int RunFile(const char* filename);
|
||||||
|
int RunString(const char* input);
|
||||||
|
|
||||||
int GetSelectedOutputRowCount(void)const;
|
int GetSelectedOutputRowCount(void)const;
|
||||||
int GetSelectedOutputColumnCount(void)const;
|
int GetSelectedOutputColumnCount(void)const;
|
||||||
@ -69,7 +77,7 @@ public:
|
|||||||
void do_run(const char* sz_routine, std::istream* pis, FILE* fp, int output_on, int error_on, int log_on, int selected_output_on, PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie);
|
void do_run(const char* sz_routine, std::istream* pis, FILE* fp, int output_on, int error_on, int log_on, int selected_output_on, PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init(void);
|
void init(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Data
|
// Data
|
||||||
@ -77,9 +85,17 @@ protected:
|
|||||||
CSelectedOutput *SelectedOutput;
|
CSelectedOutput *SelectedOutput;
|
||||||
std::string PunchFileName;
|
std::string PunchFileName;
|
||||||
bool DatabaseLoaded;
|
bool DatabaseLoaded;
|
||||||
bool SelectedOutputOn;
|
|
||||||
std::string StringInput;
|
std::string StringInput;
|
||||||
|
|
||||||
|
bool SelectedOutputOn;
|
||||||
|
//{{
|
||||||
|
bool OutputOn;
|
||||||
|
bool LogOn;
|
||||||
|
bool ErrorOn;
|
||||||
|
bool DumpOn;
|
||||||
|
bool DumpStringOn;
|
||||||
|
//}}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static IPhreeqc* Instance;
|
static IPhreeqc* Instance;
|
||||||
};
|
};
|
||||||
|
|||||||
194
fwrap.c
194
fwrap.c
@ -2,36 +2,36 @@
|
|||||||
#include <stdlib.h> /* malloc */
|
#include <stdlib.h> /* malloc */
|
||||||
#include <memory.h> /* memcpy */
|
#include <memory.h> /* memcpy */
|
||||||
#include <assert.h> /* assert */
|
#include <assert.h> /* assert */
|
||||||
#include <stdio.h> /* printf */
|
// COMMENT: {3/11/2010 8:14:05 PM}#include <stdio.h> /* printf */
|
||||||
|
|
||||||
#include "phrqtype.h"
|
#include "phrqtype.h"
|
||||||
|
|
||||||
struct buffer {
|
// COMMENT: {3/11/2010 8:13:47 PM}struct buffer {
|
||||||
char *name;
|
// COMMENT: {3/11/2010 8:13:47 PM} char *name;
|
||||||
struct master *master;
|
// COMMENT: {3/11/2010 8:13:47 PM} struct master *master;
|
||||||
LDBLE moles;
|
// COMMENT: {3/11/2010 8:13:47 PM} LDBLE moles;
|
||||||
LDBLE gfw;
|
// COMMENT: {3/11/2010 8:13:47 PM} LDBLE gfw;
|
||||||
};
|
// COMMENT: {3/11/2010 8:13:47 PM}};
|
||||||
|
|
||||||
/*
|
// COMMENT: {3/11/2010 8:13:17 PM}/*
|
||||||
* Routines
|
// COMMENT: {3/11/2010 8:13:17 PM} * Routines
|
||||||
*/
|
// COMMENT: {3/11/2010 8:13:17 PM} */
|
||||||
extern void add_all_components(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern void add_all_components(void);
|
||||||
extern int build_tally_table(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int build_tally_table(void);
|
||||||
extern int calc_dummy_kinetic_reaction(struct kinetics *kinetics_ptr);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int calc_dummy_kinetic_reaction(struct kinetics *kinetics_ptr);
|
||||||
extern int diff_tally_table(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int diff_tally_table(void);
|
||||||
extern int elt_list_to_tally_table(struct buffer *buffer_ptr);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int elt_list_to_tally_table(struct buffer *buffer_ptr);
|
||||||
extern int entity_exists (char *name, int n_user);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int entity_exists (char *name, int n_user);
|
||||||
extern int extend_tally_table(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int extend_tally_table(void);
|
||||||
extern int free_tally_table(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int free_tally_table(void);
|
||||||
extern int fill_tally_table(int *n_user, int n_buffer);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int fill_tally_table(int *n_user, int n_buffer);
|
||||||
extern int get_tally_table_rows_columns(int *rows, int *columns);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int get_tally_table_rows_columns(int *rows, int *columns);
|
||||||
extern int get_tally_table_column_heading(int column, int *type, char *string);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int get_tally_table_column_heading(int column, int *type, char *string);
|
||||||
extern int get_tally_table_row_heading(int column, char *string);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int get_tally_table_row_heading(int column, char *string);
|
||||||
extern int set_reaction_moles(int n_user, LDBLE moles);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int set_reaction_moles(int n_user, LDBLE moles);
|
||||||
extern int store_tally_table(double *array, int row_dim, int col_dim);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int store_tally_table(double *array, int row_dim, int col_dim);
|
||||||
extern int warning_msg (const char *err_str);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int warning_msg (const char *err_str);
|
||||||
extern int zero_tally_table(void);
|
// COMMENT: {3/11/2010 8:13:17 PM}extern int zero_tally_table(void);
|
||||||
|
|
||||||
#include "IPhreeqc.h"
|
#include "IPhreeqc.h"
|
||||||
|
|
||||||
@ -87,22 +87,38 @@ padfstring(char *dest, const char *src, unsigned int len)
|
|||||||
int
|
int
|
||||||
LoadDatabaseF(char* filename, unsigned int filename_length)
|
LoadDatabaseF(char* filename, unsigned int filename_length)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
char* cfilename;
|
char* cfilename;
|
||||||
|
|
||||||
cfilename = f2cstring(filename, filename_length);
|
cfilename = f2cstring(filename, filename_length);
|
||||||
if (!cfilename) {
|
if (!cfilename)
|
||||||
|
{
|
||||||
AddError("LoadDatabase: Out of memory.\n");
|
AddError("LoadDatabase: Out of memory.\n");
|
||||||
return VR_OUTOFMEMORY;
|
return VR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = LoadDatabase(cfilename);
|
int n = ::LoadDatabase(cfilename);
|
||||||
|
|
||||||
free(cfilename);
|
free(cfilename);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
LoadDatabaseStringF(char* input, unsigned int input_length)
|
||||||
|
{
|
||||||
|
char* cinput;
|
||||||
|
|
||||||
|
cinput = f2cstring(input, input_length);
|
||||||
|
if (!cinput)
|
||||||
|
{
|
||||||
|
AddError("LoadDatabase: Out of memory.\n");
|
||||||
|
return VR_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n = ::LoadDatabaseString(cinput);
|
||||||
|
free(cinput);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VRESULT
|
VRESULT
|
||||||
AccumulateLineF(char *line, unsigned int line_length)
|
AccumulateLineF(char *line, unsigned int line_length)
|
||||||
{
|
{
|
||||||
@ -110,48 +126,91 @@ AccumulateLineF(char *line, unsigned int line_length)
|
|||||||
char* cline;
|
char* cline;
|
||||||
|
|
||||||
cline = f2cstring(line, line_length);
|
cline = f2cstring(line, line_length);
|
||||||
if (!cline) {
|
if (!cline)
|
||||||
|
{
|
||||||
AddError("AccumulateLine: Out of memory.\n");
|
AddError("AccumulateLine: Out of memory.\n");
|
||||||
return VR_OUTOFMEMORY;
|
return VR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = AccumulateLine(cline);
|
n = AccumulateLine(cline);
|
||||||
|
|
||||||
free(cline);
|
free(cline);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
RunF(int* output_on, int* error_on, int* log_on, int* selected_output_on)
|
SetSelectedOutputOnF(int* sel_on)
|
||||||
{
|
{
|
||||||
return Run(*output_on, *error_on, *log_on, *selected_output_on);
|
::SetSelectedOutputOn(*sel_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetOutputOnF(int* output_on)
|
||||||
|
{
|
||||||
|
::SetOutputOn(*output_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetErrorOnF(int* error_on)
|
||||||
|
{
|
||||||
|
::SetErrorOn(*error_on);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetLogOnF(int* log_on)
|
||||||
|
{
|
||||||
|
::SetLogOn(*log_on);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
RunFileF(int* output_on, int* error_on, int* log_on, int* selected_output_on, char* filename, unsigned int filename_length)
|
RunF(void)
|
||||||
{
|
{
|
||||||
char* cline;
|
return ::Run();
|
||||||
|
}
|
||||||
|
|
||||||
cline = f2cstring(filename, filename_length);
|
int
|
||||||
if (!cline) {
|
RunFileF(char* filename, unsigned int filename_length)
|
||||||
|
{
|
||||||
|
char* cfilename;
|
||||||
|
|
||||||
|
cfilename = f2cstring(filename, filename_length);
|
||||||
|
if (!cfilename)
|
||||||
|
{
|
||||||
AddError("RunFile: Out of memory.\n");
|
AddError("RunFile: Out of memory.\n");
|
||||||
return (int)VR_OUTOFMEMORY;
|
return (int)VR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return RunFile(cline, *output_on, *error_on, *log_on, *selected_output_on);
|
int n = ::RunFile(cfilename);
|
||||||
|
free(cfilename);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
RunStringF(char* input, unsigned int input_length)
|
||||||
|
{
|
||||||
|
char* cinput;
|
||||||
|
|
||||||
|
cinput = f2cstring(input, input_length);
|
||||||
|
if (!cinput)
|
||||||
|
{
|
||||||
|
AddError("RunString: Out of memory.\n");
|
||||||
|
return (int)VR_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n = ::RunString(cinput);
|
||||||
|
free(cinput);
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
GetSelectedOutputRowCountF(void)
|
GetSelectedOutputRowCountF(void)
|
||||||
{
|
{
|
||||||
return GetSelectedOutputRowCount();
|
return ::GetSelectedOutputRowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
GetSelectedOutputColumnCountF(void)
|
GetSelectedOutputColumnCountF(void)
|
||||||
{
|
{
|
||||||
return GetSelectedOutputColumnCount();
|
return ::GetSelectedOutputColumnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
VRESULT
|
VRESULT
|
||||||
@ -160,7 +219,7 @@ GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* sv
|
|||||||
VRESULT result;
|
VRESULT result;
|
||||||
VAR v;
|
VAR v;
|
||||||
VarInit(&v);
|
VarInit(&v);
|
||||||
result = GetSelectedOutputValue(*row, *col, &v);
|
result = ::GetSelectedOutputValue(*row, *col, &v);
|
||||||
|
|
||||||
switch (v.type) {
|
switch (v.type) {
|
||||||
case TT_EMPTY:
|
case TT_EMPTY:
|
||||||
@ -184,20 +243,20 @@ GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* sv
|
|||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
VarClear(&v);
|
::VarClear(&v);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OutputLastErrorF(void)
|
OutputLastErrorF(void)
|
||||||
{
|
{
|
||||||
OutputLastError();
|
::OutputLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
OutputLinesF(void)
|
OutputLinesF(void)
|
||||||
{
|
{
|
||||||
OutputLines();
|
::OutputLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -207,15 +266,18 @@ extern "C" {
|
|||||||
int
|
int
|
||||||
SystemF(char* command, unsigned int command_length)
|
SystemF(char* command, unsigned int command_length)
|
||||||
{
|
{
|
||||||
char* cline;
|
char* ccommand;
|
||||||
|
|
||||||
cline = f2cstring(command, command_length);
|
ccommand = f2cstring(command, command_length);
|
||||||
if (!cline) {
|
if (!ccommand)
|
||||||
|
{
|
||||||
AddError("System: Out of memory.\n");
|
AddError("System: Out of memory.\n");
|
||||||
return (int)VR_OUTOFMEMORY;
|
return (int)VR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return system(cline);
|
int n = system(ccommand);
|
||||||
|
free(ccommand);
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -245,13 +307,33 @@ int __stdcall ACCUMULATELINE(char *line, unsigned int len)
|
|||||||
{
|
{
|
||||||
return AccumulateLineF(line, len);
|
return AccumulateLineF(line, len);
|
||||||
}
|
}
|
||||||
int __stdcall RUN(int *output_on, int *error_on, int *log_on, int *selected_on)
|
void __stdcall SETSELECTEDOUTPUTON(int *selected_on)
|
||||||
{
|
{
|
||||||
return RunF(output_on, error_on, log_on, selected_on);
|
SetSelectedOutputOnF(selected_on);
|
||||||
}
|
}
|
||||||
int __stdcall RUNFILE(char *filename, unsigned int len, int *output_on, int *error_on, int *log_on, int *selected_on)
|
void __stdcall SETOUTPUTON(int *output_on)
|
||||||
{
|
{
|
||||||
return RunFileF(output_on, error_on, log_on, selected_on, filename, len);
|
SetOutputOnF(output_on);
|
||||||
|
}
|
||||||
|
void __stdcall SETERRORON(int *error_on)
|
||||||
|
{
|
||||||
|
SetErrorOnF(error_on);
|
||||||
|
}
|
||||||
|
void __stdcall SETLOGON(int *log_on)
|
||||||
|
{
|
||||||
|
SetLogOnF(log_on);
|
||||||
|
}
|
||||||
|
int __stdcall RUN(void)
|
||||||
|
{
|
||||||
|
return RunF();
|
||||||
|
}
|
||||||
|
int __stdcall RUNFILE(char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunFileF(filename, len);
|
||||||
|
}
|
||||||
|
int __stdcall RUNSTRING(char *input, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunStringF(input, len);
|
||||||
}
|
}
|
||||||
void __stdcall OUTPUTLINES(void)
|
void __stdcall OUTPUTLINES(void)
|
||||||
{
|
{
|
||||||
|
|||||||
15
fwrap.h
15
fwrap.h
@ -11,15 +11,26 @@ extern "C" {
|
|||||||
|
|
||||||
VRESULT AccumulateLineF(char *line, unsigned int line_length);
|
VRESULT AccumulateLineF(char *line, unsigned int line_length);
|
||||||
|
|
||||||
int RunF(int* output_on, int* error_on, int* log_on, int* selected_output_on);
|
int RunF(void);
|
||||||
|
|
||||||
|
int RunFileF(char* filename, unsigned int filename_length);
|
||||||
|
|
||||||
|
int RunStringF(char* input, unsigned int input_length);
|
||||||
|
|
||||||
int RunFileF(int* output_on, int* error_on, int* log_on, int* selected_output_on, char* filename, unsigned int filename_length);
|
|
||||||
int GetSelectedOutputRowCountF(void);
|
int GetSelectedOutputRowCountF(void);
|
||||||
|
|
||||||
int GetSelectedOutputColumnCountF(void);
|
int GetSelectedOutputColumnCountF(void);
|
||||||
|
|
||||||
VRESULT GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
VRESULT GetSelectedOutputValueF(int *row, int *col, int *vtype, double* dvalue, char* svalue, unsigned int svalue_length);
|
||||||
|
|
||||||
|
void SetSelectedOutputOnF(int* selected_output_on);
|
||||||
|
|
||||||
|
void SetOutputOnF(int* output_on);
|
||||||
|
|
||||||
|
void SetErrorOnF(int* error_on);
|
||||||
|
|
||||||
|
void SetLogOnF(int* error_on);
|
||||||
|
|
||||||
void OutputLastErrorF(void);
|
void OutputLastErrorF(void);
|
||||||
|
|
||||||
void OutputLinesF(void);
|
void OutputLinesF(void);
|
||||||
|
|||||||
28
fwrap2.c
28
fwrap2.c
@ -22,13 +22,33 @@ int ACCUMULATELINE(char *line, unsigned int len)
|
|||||||
{
|
{
|
||||||
return AccumulateLineF(line, len);
|
return AccumulateLineF(line, len);
|
||||||
}
|
}
|
||||||
int RUN(int *output_on, int *error_on, int *log_on, int *selected_on)
|
void SETSELECTEDOUTPUTON(int *selected_on)
|
||||||
{
|
{
|
||||||
return RunF(output_on, error_on, log_on, selected_on);
|
SetSelectedOutputOnF(selected_on);
|
||||||
}
|
}
|
||||||
int RUNFILE(char *filename, unsigned int len, int *output_on, int *error_on, int *log_on, int *selected_on)
|
void SETOUTPUTON(int *output_on)
|
||||||
{
|
{
|
||||||
return RunFileF(output_on, error_on, log_on, selected_on, filename, len);
|
SetOutputOnF(output_on);
|
||||||
|
}
|
||||||
|
void SETERRORON(int *error_on)
|
||||||
|
{
|
||||||
|
SetErrorOnF(error_on);
|
||||||
|
}
|
||||||
|
void SETLOGON(int *log_on)
|
||||||
|
{
|
||||||
|
SetLogOnF(log_on);
|
||||||
|
}
|
||||||
|
int RUN(void)
|
||||||
|
{
|
||||||
|
return RunF();
|
||||||
|
}
|
||||||
|
int RUNFILE(char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunFileF(filename, len);
|
||||||
|
}
|
||||||
|
int RUNSTRING(char *input, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunFileF(input, len);
|
||||||
}
|
}
|
||||||
void OUTPUTLINES(void)
|
void OUTPUTLINES(void)
|
||||||
{
|
{
|
||||||
|
|||||||
28
fwrap3.c
28
fwrap3.c
@ -22,13 +22,33 @@ int accumulateline_(char *line, unsigned int len)
|
|||||||
{
|
{
|
||||||
return AccumulateLineF(line, len);
|
return AccumulateLineF(line, len);
|
||||||
}
|
}
|
||||||
int run_(int *output_on, int *error_on, int *log_on, int *selected_on)
|
void setselectedoutputon_(int *selected_on)
|
||||||
{
|
{
|
||||||
return RunF(output_on, error_on, log_on, selected_on);
|
SetSelectedOutputOnF(selected_on);
|
||||||
}
|
}
|
||||||
int runfile_(char *filename, unsigned int len, int *output_on, int *error_on, int *log_on, int *selected_on)
|
void setoutputon_(int *output_on)
|
||||||
{
|
{
|
||||||
return RunFileF(output_on, error_on, log_on, selected_on, filename, len);
|
SetOutputOnF(output_on);
|
||||||
|
}
|
||||||
|
void seterroron_(int *error_on)
|
||||||
|
{
|
||||||
|
SetErrorOnF(error_on);
|
||||||
|
}
|
||||||
|
void setlogon_(int *log_on)
|
||||||
|
{
|
||||||
|
SetLogOnF(log_on);
|
||||||
|
}
|
||||||
|
int run_(void)
|
||||||
|
{
|
||||||
|
return RunF();
|
||||||
|
}
|
||||||
|
int runfile_(char *filename, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunFileF(filename, len);
|
||||||
|
}
|
||||||
|
int runstring_(char *input, unsigned int len)
|
||||||
|
{
|
||||||
|
return RunFileF(input, len);
|
||||||
}
|
}
|
||||||
void outputlines_(void)
|
void outputlines_(void)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user