| 1 |
#include <stdio.h> |
#include <stdio.h> |
| 2 |
|
|
| 3 |
#include <utilities/ascConfig.h> |
#define ASC_USE_IMPORTED_ERROR_REPORTER |
| 4 |
#include <utilities/error.h> |
#include <utilities/error.h> |
| 5 |
|
|
| 6 |
|
|
| 7 |
|
#include <utilities/ascConfig.h> |
| 8 |
|
|
| 9 |
#include <compiler/fractions.h> |
#include <compiler/fractions.h> |
| 10 |
#include <compiler/compiler.h> |
#include <compiler/compiler.h> |
| 11 |
#include <compiler/dimen.h> |
#include <compiler/dimen.h> |
| 25 |
|
|
| 26 |
It sets up the functions in this external function library |
It sets up the functions in this external function library |
| 27 |
*/ |
*/ |
| 28 |
|
|
| 29 |
extern int |
extern int |
| 30 |
DLEXPORT extfntest_register(struct Slv_Interp *dummy1, |
DLEXPORT extfntest_register( |
| 31 |
struct Instance *root, |
const CreateUserFunction_fptr_t CreateUserFunction_fptr |
| 32 |
struct gl_list_t *arglist, |
,const ErrorReporter_fptr_t ErrorReporter_fptr |
|
unsigned long dummy4 |
|
| 33 |
){ |
){ |
| 34 |
const char *addone_help = "This is a test of the dynamic user packages functionality"; |
const char *addone_help = "This is a test of the dynamic user packages functionality"; |
| 35 |
int result = 0; |
int result = 0; |
| 36 |
|
|
| 37 |
(void)dummy1;(void)root;(void)arglist;(void)dummy4; |
extern ErrorReporter_fptr_t g_ErrorReporter_fptr; |
| 38 |
|
g_ErrorReporter_fptr = ErrorReporter_fptr; |
| 39 |
|
|
| 40 |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Initialising EXTFNTEST...\n"); |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"Initialising EXTFNTEST...\n",5,6,7,8); |
| 41 |
|
|
| 42 |
result += CreateUserFunction("add_one", |
result += (CreateUserFunction_fptr)("add_one", |
| 43 |
(ExtEvalFunc *)addone_prepare, |
(ExtEvalFunc *)addone_prepare, |
| 44 |
(ExtEvalFunc **)addone_calc, |
(ExtEvalFunc **)addone_calc, |
| 45 |
(ExtEvalFunc **)NULL, |
(ExtEvalFunc **)NULL, |
| 46 |
(ExtEvalFunc **)NULL, |
(ExtEvalFunc **)NULL, |
| 47 |
1,1,addone_help); |
1,1,addone_help); |
| 48 |
|
|
| 49 |
FPRINTF(ASCERR,"CreateUserFunction result = %d\n",result); |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"CreateUserFunction result = %d\n",result); |
| 50 |
return result; |
return result; |
| 51 |
} |
} |
| 52 |
|
|
| 54 |
struct Instance *data, |
struct Instance *data, |
| 55 |
struct gl_list_t *arglist |
struct gl_list_t *arglist |
| 56 |
){ |
){ |
| 57 |
FPRINTF(ASCERR,"PREPARING PKG EXTFNTEST...\n"); |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"PREPARING PKG EXTFNTEST...\n"); |
| 58 |
const char *mystring = "MY STRING IS HERE"; |
const char *mystring = "MY STRING IS HERE"; |
| 59 |
slv_interp->user_data = (void *)mystring; |
slv_interp->user_data = (void *)mystring; |
| 60 |
} |
} |
| 66 |
){ |
){ |
| 67 |
char *mystring = (char *)slv_interp->user_data; |
char *mystring = (char *)slv_interp->user_data; |
| 68 |
|
|
| 69 |
FPRINTF(ASCERR,"ADDONE_CALC: mystring = %s\n",mystring); |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"ADDONE_CALC: mystring = %s\n",mystring); |
| 70 |
|
|
| 71 |
FPRINTF(ASCERR,"NINPUTS = %d, NOUTPUTS = %d\n",ninputs, noutputs); |
ERROR_REPORTER_HERE(ASC_PROG_NOTE,"NINPUTS = %d, NOUTPUTS = %d\n",ninputs, noutputs); |
| 72 |
|
|
| 73 |
double *x = &(inputs[0]); |
double *x = &(inputs[0]); |
| 74 |
|
|