ngspice.exe and .dll (.so): seperate the main files:
main.c now belongs to exe, sharedspice.c to dll (so)
This commit is contained in:
parent
55359e36e0
commit
8de513e8e9
|
|
@ -493,7 +493,6 @@ if SHARED_MODULE
|
|||
lib_LTLIBRARIES = libngspice.la
|
||||
|
||||
libngspice_la_SOURCES = \
|
||||
main.c \
|
||||
conf.c \
|
||||
conf.h \
|
||||
ngspice.c \
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
|
||||
#include "ngspice/inpdefs.h"
|
||||
|
||||
#if defined(XSPICE) && defined(SIMULATOR)
|
||||
#if defined(XSPICE) && (defined(SIMULATOR) || defined(SHARED_MODULE))
|
||||
#include "ngspice/evtproto.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ com_remcirc(wordlist *wl)
|
|||
/* The next lines stem from com_rset */
|
||||
INPkillMods();
|
||||
|
||||
#if defined(XSPICE) && defined(SIMULATOR)
|
||||
#if defined(XSPICE) && (defined(SIMULATOR) || defined(SHARED_MODULE))
|
||||
/* remove event queues, if XSPICE and not nutmeg */
|
||||
if (ft_curckt->ci_ckt)
|
||||
EVTunsetup(ft_curckt->ci_ckt);
|
||||
|
|
|
|||
14
src/main.c
14
src/main.c
|
|
@ -165,10 +165,9 @@ struct variable *(*if_getparam)(CKTcircuit *ckt, char **name, char *param, int i
|
|||
|
||||
/* static functions */
|
||||
int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
|
||||
#ifndef SHARED_MODULE
|
||||
|
||||
static ATTRIBUTE_NORETURN void sp_shutdown(int exitval);
|
||||
static void app_rl_readlines(void);
|
||||
#endif /* SHARED_MODULE */
|
||||
|
||||
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
||||
static char *prompt(void);
|
||||
|
|
@ -178,14 +177,13 @@ static int app_event_func(void);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SHARED_MODULE
|
||||
static void show_help(void);
|
||||
static bool read_initialisation_file(const char *dir, const char *name);
|
||||
|
||||
#ifdef SIMULATOR
|
||||
static void append_to_stream(FILE *dest, FILE *source);
|
||||
#endif
|
||||
#endif /* SHARED_MODULE */
|
||||
|
||||
extern IFsimulator SIMinfo;
|
||||
|
||||
#ifdef SIMULATOR
|
||||
|
|
@ -514,7 +512,6 @@ SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator)
|
|||
} /* end of function SIMinit */
|
||||
|
||||
|
||||
#ifndef SHARED_MODULE
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Shutdown gracefully. */
|
||||
static ATTRIBUTE_NORETURN void
|
||||
|
|
@ -531,7 +528,6 @@ sp_shutdown(int exitval)
|
|||
exitval = EXIT_NORMAL;
|
||||
exit(exitval);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
|
@ -597,7 +593,6 @@ app_event_func(void)
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef SHARED_MODULE
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* This is the command processing loop for spice and nutmeg.
|
||||
The function is called even when GNU readline is unavailable, in which
|
||||
|
|
@ -788,13 +783,11 @@ static void print_news(void)
|
|||
}
|
||||
}
|
||||
} /* end of function print_news */
|
||||
#endif
|
||||
|
||||
#ifdef HAS_WINGUI
|
||||
#define main xmain
|
||||
#endif
|
||||
|
||||
#ifndef SHARED_MODULE
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char log_file[BSIZE_SP];
|
||||
|
|
@ -1432,6 +1425,3 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
} /* end of function main */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -189,14 +189,134 @@ typedef void (*sighandler)(int);
|
|||
extern bool wantevtdata;
|
||||
#endif
|
||||
|
||||
extern IFfrontEnd nutmeginfo;
|
||||
|
||||
/********** includes copied from main.c ************/
|
||||
#ifdef CIDER
|
||||
# include "ngspice/numenum.h"
|
||||
# include "maths/misc/accuracy.h"
|
||||
#endif
|
||||
|
||||
/********** global variables copied from main.c ************/
|
||||
FILE* slogp = NULL; /* soa log file ('--soa-log file' command line option) */
|
||||
|
||||
/* Frontend and circuit options */
|
||||
IFsimulator* ft_sim = NULL;
|
||||
|
||||
char* errRtn; /* name of the routine declaring error */
|
||||
char* errMsg = NULL; /* descriptive message about what went wrong */
|
||||
char* cp_program; /* program name 'ngspice' */
|
||||
|
||||
char* Infile_Path = NULL; /* Path to netlist input file */
|
||||
|
||||
char* hlp_filelist[] = { "ngspice", NULL };
|
||||
|
||||
|
||||
/* Allocate space for global constants declared in const.h
|
||||
* and set their values */
|
||||
double CONSTroot2 = CONSTsqrt2;
|
||||
double CONSTvt0 = CONSTboltz * REFTEMP / CHARGE;
|
||||
double CONSTKoverQ = CONSTboltz / CHARGE;
|
||||
double CONSTe = CONSTnap;
|
||||
|
||||
IFfrontEnd* SPfrontEnd = NULL;
|
||||
int DEVmaxnum = 0;
|
||||
|
||||
const bool ft_nutmeg = FALSE;
|
||||
extern struct comm spcp_coms[];
|
||||
struct comm* cp_coms = spcp_coms;
|
||||
|
||||
/* Main options */
|
||||
static bool ft_servermode = FALSE;
|
||||
bool ft_batchmode = FALSE;
|
||||
bool ft_pipemode = FALSE;
|
||||
bool rflag = FALSE; /* has rawfile */
|
||||
|
||||
/* Frontend options */
|
||||
bool ft_intrpt = FALSE; /* Set by the (void) signal handlers. TRUE = we've been interrupted. */
|
||||
bool ft_setflag = FALSE; /* TRUE = Don't abort simulation after an interrupt. */
|
||||
char* ft_rawfile = "rawspice.raw";
|
||||
|
||||
#ifdef XSPICE
|
||||
bool wantevtdata = FALSE;
|
||||
#endif
|
||||
|
||||
bool orflag = FALSE; /* global for -o option */
|
||||
|
||||
/* Globals definitions for Machine Accuracy Limits
|
||||
* (needed by CIDER)
|
||||
*/
|
||||
double BMin; /* lower limit for B(x) */
|
||||
double BMax; /* upper limit for B(x) */
|
||||
double ExpLim; /* limit for exponential */
|
||||
double Accuracy; /* accuracy of the machine */
|
||||
double MuLim, MutLim;
|
||||
|
||||
IFfrontEnd nutmeginfo = {
|
||||
IFnewUid,
|
||||
IFdelUid,
|
||||
OUTstopnow,
|
||||
seconds,
|
||||
OUTerror,
|
||||
OUTerrorf,
|
||||
OUTpBeginPlot,
|
||||
OUTpData,
|
||||
OUTwBeginPlot,
|
||||
OUTwReference,
|
||||
OUTwData,
|
||||
OUTwEnd,
|
||||
OUTendPlot,
|
||||
OUTbeginDomain,
|
||||
OUTendDomain,
|
||||
OUTattributes
|
||||
};
|
||||
|
||||
|
||||
#ifdef CIDER
|
||||
/* Global debug flags from CIDER, soon they will become
|
||||
* spice variables :)
|
||||
*/
|
||||
BOOLEAN ONEacDebug = FALSE;
|
||||
BOOLEAN ONEdcDebug = TRUE;
|
||||
BOOLEAN ONEtranDebug = TRUE;
|
||||
BOOLEAN ONEjacDebug = FALSE;
|
||||
|
||||
BOOLEAN TWOacDebug = FALSE;
|
||||
BOOLEAN TWOdcDebug = TRUE;
|
||||
BOOLEAN TWOtranDebug = TRUE;
|
||||
BOOLEAN TWOjacDebug = FALSE;
|
||||
|
||||
/* CIDER Global Variable Declarations */
|
||||
|
||||
int BandGapNarrowing;
|
||||
int TempDepMobility, ConcDepMobility, FieldDepMobility, TransDepMobility;
|
||||
int SurfaceMobility, MatchingMobility, MobDeriv;
|
||||
int CCScattering;
|
||||
int Srh, Auger, ConcDepLifetime, AvalancheGen;
|
||||
int FreezeOut = FALSE;
|
||||
int OneCarrier;
|
||||
|
||||
int MaxIterations = 100;
|
||||
int AcAnalysisMethod = DIRECT;
|
||||
|
||||
double Temp, RelTemp, Vt;
|
||||
double RefPsi;/* potential at Infinity */
|
||||
double EpsNorm, VNorm, NNorm, LNorm, TNorm, JNorm, GNorm, ENorm;
|
||||
|
||||
/* end cider globals */
|
||||
#endif /* CIDER */
|
||||
|
||||
struct variable* (*if_getparam)(CKTcircuit* ckt, char** name, char* param, int ind, int do_model);
|
||||
/***********************************************************/
|
||||
|
||||
extern IFsimulator SIMinfo;
|
||||
|
||||
extern struct comm spcp_coms[ ];
|
||||
extern void DevInit(void);
|
||||
extern int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
|
||||
extern wordlist *cp_varwl(struct variable *var);
|
||||
extern void create_circbyline(char *line, bool reset, bool lastline);
|
||||
|
||||
static int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
|
||||
|
||||
void exec_controls(wordlist *shcontrols);
|
||||
void rem_controls(void);
|
||||
|
||||
|
|
@ -300,7 +420,29 @@ get_plot_byname(char* plotname)
|
|||
return pl;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static int
|
||||
SIMinit(IFfrontEnd* frontEnd, IFsimulator** simulator)
|
||||
{
|
||||
spice_init_devices();
|
||||
SIMinfo.numDevices = DEVmaxnum = num_devices();
|
||||
SIMinfo.devices = devices_ptr();
|
||||
SIMinfo.numAnalyses = spice_num_analysis();
|
||||
|
||||
/* va: we recast, because we use only the public part */
|
||||
SIMinfo.analyses = (IFanalysis**)spice_analysis_ptr();
|
||||
|
||||
|
||||
#ifdef CIDER
|
||||
/* Evaluates limits of machine accuracy for CIDER */
|
||||
evalAccLimits();
|
||||
#endif /* CIDER */
|
||||
|
||||
SPfrontEnd = frontEnd;
|
||||
*simulator = &SIMinfo;
|
||||
|
||||
return OK;
|
||||
} /* end of function SIMinit */
|
||||
|
||||
/******************************************************************/
|
||||
/* Main spice command executions and thread control */
|
||||
|
|
|
|||
|
|
@ -1088,7 +1088,6 @@
|
|||
<ClCompile Include="..\src\frontend\variable.c" />
|
||||
<ClCompile Include="..\src\frontend\vectors.c" />
|
||||
<ClCompile Include="..\src\frontend\where.c" />
|
||||
<ClCompile Include="..\src\main.c" />
|
||||
<ClCompile Include="..\src\maths\cmaths\cmath1.c" />
|
||||
<ClCompile Include="..\src\maths\cmaths\cmath2.c" />
|
||||
<ClCompile Include="..\src\maths\cmaths\cmath3.c" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue