Avoid type 'bool', as ist is a built-in type in C++, not

equaling  'int' which ngspice is using.

Change bool to BOOL and ad a
typedef int BOOL;
This commit is contained in:
Holger Vogt 2021-03-28 18:20:47 +02:00
parent 4dcc243aaf
commit ded0f79c01
1 changed files with 15 additions and 10 deletions

View File

@ -86,6 +86,8 @@ Memory allocated in the calling program has to be freed only there.
ngspice.dll should never call exit() directly, but handle either the 'quit' ngspice.dll should never call exit() directly, but handle either the 'quit'
request to the caller or an request for exiting upon error, request to the caller or an request for exiting upon error,
done by callback function ngexit(). done by callback function ngexit().
All boolean signals (BOOL) are of type int.
*/ */
#ifndef NGSPICE_PACKAGE_VERSION #ifndef NGSPICE_PACKAGE_VERSION
@ -128,6 +130,9 @@ struct ngcomplex {
typedef struct ngcomplex ngcomplex_t; typedef struct ngcomplex ngcomplex_t;
#endif #endif
/* For C++ compatibility */
typedef int BOOL;
/* vector info obtained from any vector in ngspice.dll. /* vector info obtained from any vector in ngspice.dll.
Allows direct access to the ngspice internal vector structure, Allows direct access to the ngspice internal vector structure,
as defined in include/ngspice/devc.h . */ as defined in include/ngspice/devc.h . */
@ -144,8 +149,8 @@ typedef struct vecvalues {
char* name; /* name of a specific vector */ char* name; /* name of a specific vector */
double creal; /* actual data value */ double creal; /* actual data value */
double cimag; /* actual data value */ double cimag; /* actual data value */
bool is_scale; /* if 'name' is the scale vector */ BOOL is_scale; /* if 'name' is the scale vector */
bool is_complex; /* if the data are complex numbers */ BOOL is_complex; /* if the data are complex numbers */
} vecvalues, *pvecvalues; } vecvalues, *pvecvalues;
typedef struct vecvaluesall { typedef struct vecvaluesall {
@ -159,7 +164,7 @@ typedef struct vecinfo
{ {
int number; /* number of vector, as postion in the linked list of vectors, starts with 0 */ int number; /* number of vector, as postion in the linked list of vectors, starts with 0 */
char *vecname; /* name of the actual vector */ char *vecname; /* name of the actual vector */
bool is_real; /* TRUE if the actual vector has real data */ BOOL is_real; /* TRUE if the actual vector has real data */
void *pdvec; /* a void pointer to struct dvec *d, the actual vector */ void *pdvec; /* a void pointer to struct dvec *d, the actual vector */
void *pdvecscale; /* a void pointer to struct dvec *ds, the scale vector */ void *pdvecscale; /* a void pointer to struct dvec *ds, the scale vector */
} vecinfo, *pvecinfo; } vecinfo, *pvecinfo;
@ -216,11 +221,11 @@ typedef int (SendStat)(char*, int, void*);
void* return pointer received from caller void* return pointer received from caller
*/ */
/* asking for controlled exit */ /* asking for controlled exit */
typedef int (ControlledExit)(int, bool, bool, int, void*); typedef int (ControlledExit)(int, BOOL, BOOL, int, void*);
/* /*
int exit status int exit status
bool if true: immediate unloading dll, if false: just set flag, unload is done when function has returned BOOL if true: immediate unloading dll, if false: just set flag, unload is done when function has returned
bool if true: exit upon 'quit', if false: exit due to ngspice.dll error BOOL if true: exit upon 'quit', if false: exit due to ngspice.dll error
int identification number of calling ngspice shared lib int identification number of calling ngspice shared lib
void* return pointer received from caller void* return pointer received from caller
*/ */
@ -242,9 +247,9 @@ typedef int (SendInitData)(pvecinfoall, int, void*);
*/ */
/* indicate if background thread is running */ /* indicate if background thread is running */
typedef int (BGThreadRunning)(bool, int, void*); typedef int (BGThreadRunning)(BOOL, int, void*);
/* /*
bool true if background thread is running BOOL true if background thread is running
int identification number of calling ngspice shared lib int identification number of calling ngspice shared lib
void* return pointer received from caller void* return pointer received from caller
*/ */
@ -399,11 +404,11 @@ char** ngSpice_AllVecs(char* plotname);
/* returns TRUE if ngspice is running in a second (background) thread */ /* returns TRUE if ngspice is running in a second (background) thread */
IMPEXP IMPEXP
bool ngSpice_running(void); BOOL ngSpice_running(void);
/* set a breakpoint in ngspice */ /* set a breakpoint in ngspice */
IMPEXP IMPEXP
bool ngSpice_SetBkpt(double time); BOOL ngSpice_SetBkpt(double time);
#ifdef __cplusplus #ifdef __cplusplus