version conflict rersolved in sharedspice.c

This commit is contained in:
h_vogt 2017-06-10 14:14:02 +02:00 committed by Holger Vogt
parent 25a324ba6e
commit b5f31ec2b1
3 changed files with 24 additions and 9 deletions

View File

@ -285,8 +285,13 @@ typedef int (GetSyncData)(double, double*, double, int, int, int, void*);
/* callback functions
addresses received from caller with ngSpice_Init_Evt() function
*/
typedef int (SendEvtData)();
typedef int (SendInitEvtData)();
typedef int (SendEvtData)(int, double, double, char *, void *, int, int, void*);
/* int index, double step, double dvalue, char *svalue, void *pvalue, int plen, int mode */
typedef int (SendInitEvtData)(char*, void*);
/*
char* string with node info: "index name udn-name"
void* return pointer received from caller
*/
#endif
/* ngspice initialization,
@ -335,8 +340,8 @@ IMPEXP
char** ngSpice_AllEvtNodes(void);
/* initialization of XSPICE callback functions
sevtdata:
sinitevtdata:
sevtdata: data for a specific event node at time 'step'
sinitevtdata: single line entry of event node dictionary (list)
userData: pointer to user-defined data, will not be modified, but
handed over back to caller during Callback, e.g. address of calling object */
IMPEXP

View File

@ -232,6 +232,9 @@ static bool coquit = FALSE;
static jmp_buf errbufm, errbufc;
static int intermj = 1;
bool wantevtdata = FALSE;
static SendInitEvtData* sendinitevt;
static SendEvtData* sendevt;
static void* euserptr;
// thread IDs
@ -600,7 +603,7 @@ ngSpice_Init(SendChar* printfcn, SendStat* statusfcn, ControlledExit* ngspiceexi
if (!bgtr)
nobgtrwanted = TRUE;
immediate = FALSE;
wantevtdata = TRUE;
#ifdef THREADS
/* init the mutexes */
#ifdef HAVE_LIBPTHREAD
@ -971,6 +974,11 @@ int ngSpice_Init_Evt(SendEvtData* sevtdata, SendInitEvtData* sinitevtdata, void
{
if (sevtdata)
wantevtdata = TRUE;
else
wantevtdata = FALSE;
sendinitevt = sinitevtdata;
sendevt = sevtdata;
euserptr = userData;
return(TRUE);
}
@ -1940,12 +1948,14 @@ sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt,
void shared_send_event(int index, double step, double dvalue, char *svalue, void *pvalue, int plen, int mode)
{
printf("");
if(wantevtdata)
sendevt(index, step, dvalue, svalue, pvalue, plen, mode, euserptr);
return;
}
void shared_send_dict(char* dictline)
{
printf("%s", dictline);
if (sendinitevt)
sendinitevt(dictline, euserptr);
}

View File

@ -571,7 +571,7 @@ This function formats the event node data and sends it to the caller via shareds
static void EVTsharedsend_line(
int ipc_index, /* The index used in the dictionary */
int dict_index, /* The index used in the dictionary */
double step, /* The analysis step */
void *node_value, /* The node value */
int udn_index, /* The user-defined node index */
@ -601,7 +601,7 @@ static void EVTsharedsend_line(
}
/* Send it to sharedspice.c */
shared_send_event(ipc_index, step, dvalue, svalue, pvalue, len, mode);
shared_send_event(dict_index, step, dvalue, svalue, pvalue, len, mode);
}