From b5f31ec2b10e2d6fe352fc1652b9cfb4998b6494 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 10 Jun 2017 14:14:02 +0200 Subject: [PATCH] version conflict rersolved in sharedspice.c --- src/include/ngspice/sharedspice.h | 13 +++++++++---- src/sharedspice.c | 16 +++++++++++++--- src/xspice/evt/evtdump.c | 4 ++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/include/ngspice/sharedspice.h b/src/include/ngspice/sharedspice.h index c71524d55..e853cf0e8 100644 --- a/src/include/ngspice/sharedspice.h +++ b/src/include/ngspice/sharedspice.h @@ -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 diff --git a/src/sharedspice.c b/src/sharedspice.c index d7cfc0e4c..c6d5449ea 100644 --- a/src/sharedspice.c +++ b/src/sharedspice.c @@ -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); } diff --git a/src/xspice/evt/evtdump.c b/src/xspice/evt/evtdump.c index b6d52757d..87e77c455 100644 --- a/src/xspice/evt/evtdump.c +++ b/src/xspice/evt/evtdump.c @@ -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); }