319 lines
8.7 KiB
Diff
319 lines
8.7 KiB
Diff
--- src/main.c 2005-05-31 18:47:48.000000000 +0200
|
|
+++ main.c 2006-12-23 12:47:24.000000000 +0100
|
|
@@ -69,7 +69,7 @@
|
|
#ifdef CIDER
|
|
#include "numenum.h"
|
|
#include "maths/misc/accuracy.h"
|
|
-#endif
|
|
+#endif
|
|
|
|
|
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
|
@@ -108,7 +108,7 @@
|
|
#ifdef CIDER
|
|
/* 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 */
|
|
@@ -118,19 +118,19 @@
|
|
|
|
/* 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;
|
|
-
|
|
+BOOLEAN TWOjacDebug = FALSE;
|
|
+
|
|
/* CIDER Global Variable Declarations */
|
|
-
|
|
+
|
|
int BandGapNarrowing;
|
|
int TempDepMobility, ConcDepMobility, FieldDepMobility, TransDepMobility;
|
|
int SurfaceMobility, MatchingMobility, MobDeriv;
|
|
@@ -138,14 +138,14 @@
|
|
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 */
|
|
|
|
@@ -255,7 +255,7 @@
|
|
bool
|
|
if_tranparams(struct circ *ckt, double *start, double *stop, double *step)
|
|
{
|
|
- return (FALSE);
|
|
+ return (FALSE);
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
@@ -325,15 +325,15 @@
|
|
SIMinfo.numDevices = DEVmaxnum = num_devices();
|
|
SIMinfo.devices = devices_ptr();
|
|
SIMinfo.numAnalyses = spice_num_analysis();
|
|
- SIMinfo.analyses = (IFanalysis **)spice_analysis_ptr(); /* va: we recast, because we use
|
|
- * only the public part
|
|
+ SIMinfo.analyses = (IFanalysis **)spice_analysis_ptr(); /* va: we recast, because we use
|
|
+ * only the public part
|
|
*/
|
|
-
|
|
+
|
|
#ifdef CIDER
|
|
/* Evaluates limits of machine accuracy for CIDER */
|
|
evalAccLimits();
|
|
-#endif /* CIDER */
|
|
-
|
|
+#endif /* CIDER */
|
|
+
|
|
#endif /* SIMULATOR */
|
|
|
|
SPfrontEnd = frontEnd;
|
|
@@ -374,13 +374,13 @@
|
|
|
|
if (cp_interactive == FALSE)
|
|
return NULL; /* NULL means no prompt */
|
|
-
|
|
+
|
|
s = get_alt_prompt();
|
|
if(s==NULL)
|
|
s = cp_promptstring;
|
|
if(s==NULL)
|
|
s = "->";
|
|
-
|
|
+
|
|
while (*s) {
|
|
switch (strip(*s)) {
|
|
case '!':
|
|
@@ -419,7 +419,7 @@
|
|
/* Process device events in Readline's hook since there is no where
|
|
else to do it now - AV */
|
|
static int
|
|
-rl_event_func()
|
|
+rl_event_func()
|
|
/* called by GNU readline periodically to know what to do about keypresses */
|
|
{
|
|
static REQUEST reqst = { checkup_option, 0 };
|
|
@@ -433,7 +433,7 @@
|
|
/* Process device events in Editline's hook.
|
|
similar to the readline function above but returns void */
|
|
static void
|
|
-rl_event_func()
|
|
+rl_event_func()
|
|
/* called by GNU readline periodically to know what to do about keypresses */
|
|
{
|
|
static REQUEST reqst = { checkup_option, 0 };
|
|
@@ -452,28 +452,28 @@
|
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
|
/* GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
|
|
char *line, *expanded_line;
|
|
-
|
|
+
|
|
/* --- set up readline params --- */
|
|
strcpy(history_file, getenv("HOME"));
|
|
strcat(history_file, "/.");
|
|
strcat(history_file, application_name);
|
|
strcat(history_file, "_history");
|
|
-
|
|
+
|
|
using_history();
|
|
read_history(history_file);
|
|
-
|
|
+
|
|
rl_readline_name = application_name;
|
|
rl_instream = cp_in;
|
|
rl_outstream = cp_out;
|
|
rl_event_hook = rl_event_func;
|
|
rl_catch_signals = 0; /* disable signal handling */
|
|
-
|
|
+
|
|
/* sjb - what to do for editline?
|
|
- This variable is not supported by editline. */
|
|
-#if defined(HAVE_GNUREADLINE)
|
|
+ This variable is not supported by editline. */
|
|
+#if defined(HAVE_GNUREADLINE)
|
|
rl_catch_sigwinch = 1; /* allow readline to respond to resized windows */
|
|
-#endif
|
|
-
|
|
+#endif
|
|
+
|
|
/* note that we want some mechanism to detect ctrl-D and expand it to exit */
|
|
while (1) {
|
|
history_set_pos(history_length);
|
|
@@ -497,7 +497,7 @@
|
|
if (line) free(line);
|
|
}
|
|
/* History gets written in ../fte/misccoms.c com_quit */
|
|
-
|
|
+
|
|
#else
|
|
while (cp_evloop((char *) NULL) == 1) ;
|
|
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
|
|
@@ -516,8 +516,9 @@
|
|
" -i, --interactive run in interactive mode\n"
|
|
" -n, --no-spiceinit don't load the local or user's config file\n"
|
|
" -o, --output=FILE set the outputfile\n"
|
|
+ " -p, --pipe run in I/O pipe mode\n"
|
|
" -q, --completion activate command completion\n"
|
|
- " -r, --rawfile=FILE set the rawfile output\n"
|
|
+ " -r, --rawfile=FILE set the rawfile output\n"
|
|
" -s, --server run spice as a server process\n"
|
|
" -t, --term=TERM set the terminal type\n"
|
|
" -h, --help display this help and exit\n"
|
|
@@ -566,11 +567,11 @@
|
|
#endif /* not HAVE_ASPRINTF */
|
|
char * path;
|
|
bool result = FALSE;
|
|
-
|
|
+
|
|
/* check name */
|
|
if(name==NULL || name[0]=='\0')
|
|
return FALSE; /* Fail; name needed */
|
|
-
|
|
+
|
|
/* contruct the full path */
|
|
if(dir == NULL || dir[0]=='\0') {
|
|
path = name;
|
|
@@ -587,7 +588,7 @@
|
|
|
|
/* now access the file */
|
|
#ifdef HAVE_UNISTD_H
|
|
- if (access(path, R_OK) == 0) {
|
|
+ if (access(path, R_OK) == 0) {
|
|
#else
|
|
if ((fp = fopen(path, "r")) != NULL) {
|
|
(void) fclose(fp);
|
|
@@ -595,10 +596,10 @@
|
|
inp_source(path);
|
|
#ifdef TRACE
|
|
printf("Init file: '%s'\n",path);
|
|
-#endif /* TRACE */
|
|
+#endif /* TRACE */
|
|
result = TRUE; /* loaded okay */
|
|
}
|
|
-
|
|
+
|
|
/* if dir was not NULL and not empty then we allocated memory above */
|
|
if(dir!=NULL && dir[0] !='\0')
|
|
#ifdef HAVE_ASPRINTF
|
|
@@ -606,7 +607,7 @@
|
|
#else
|
|
tfree(path);
|
|
#endif /* HAVE_ASPRINTF */
|
|
-
|
|
+
|
|
return result;
|
|
}
|
|
|
|
@@ -616,7 +617,7 @@
|
|
extern int OUTpBeginPlot(), OUTpData(), OUTwBeginPlot(), OUTwReference();
|
|
extern int OUTwData(), OUTwEnd(), OUTendPlot(), OUTbeginDomain();
|
|
extern int OUTendDomain(), OUTstopnow(), OUTerror(), OUTattributes();
|
|
-#endif /* SIMULATOR */
|
|
+#endif /* SIMULATOR */
|
|
|
|
int
|
|
#ifdef HAS_WINDOWS
|
|
@@ -631,7 +632,7 @@
|
|
char* copystring;/*DG*/
|
|
#ifdef SIMULATOR
|
|
int error2;
|
|
-
|
|
+
|
|
static IFfrontEnd nutmeginfo = {
|
|
IFnewUid,
|
|
IFdelUid,
|
|
@@ -742,10 +743,11 @@
|
|
{"rawfile", 1, 0, 'r'},
|
|
{"server", 0, 0, 's'},
|
|
{"terminal", 1, 0, 't'},
|
|
+ {"pipe", 0, 0, 'p'},
|
|
{0, 0, 0, 0}
|
|
};
|
|
|
|
- c = getopt_long (argc, argv, "hvbc:ihno:qr:st:",
|
|
+ c = getopt_long (argc, argv, "hvbc:ihno:pqr:st:",
|
|
long_options, &option_index);
|
|
if (c == -1)
|
|
break;
|
|
@@ -793,10 +795,10 @@
|
|
/* Open the log file */
|
|
#ifdef HAS_WINDOWS
|
|
/* flogp goes to winmain's putc and writes to file buf */
|
|
- if (!(flogp = fopen(buf, "w"))) {
|
|
+ if (!(flogp = fopen(buf, "w"))) {
|
|
#else
|
|
/* Connect stdout to file buf and log stdout */
|
|
- if (!(freopen (buf, "w", stdout))) {
|
|
+ if (!(freopen (buf, "w", stdout))) {
|
|
#endif
|
|
perror (buf);
|
|
shutdown (EXIT_BAD);
|
|
@@ -877,7 +879,7 @@
|
|
if (!ft_batchmode)
|
|
goto bot;
|
|
}
|
|
-
|
|
+
|
|
/* Set up signal handling */
|
|
if (!ft_batchmode) {
|
|
/* Set up interrupt handler */
|
|
@@ -909,14 +911,14 @@
|
|
/* load user's initialisation file */
|
|
if (readinit) {
|
|
bool good;
|
|
-
|
|
+
|
|
/* Try accessing the initialisation file in the current directory */
|
|
good = read_initialisation_file("",INITSTR);
|
|
-
|
|
+
|
|
/* if that fail try the alternate name */
|
|
if(good == FALSE)
|
|
good = read_initialisation_file("",ALT_INITSTR);
|
|
-
|
|
+
|
|
/* if that failed try in the user's home directory
|
|
if their HOME environment variable is set */
|
|
if(good == FALSE) {
|
|
@@ -964,7 +966,7 @@
|
|
if (!ft_servermode && !ft_nutmeg) {
|
|
/* Concatenate all non-option arguments into a temporary file
|
|
and load that file into the spice core.
|
|
-
|
|
+
|
|
The original routine took a special path if there was only
|
|
one non-option argument. In that case, it didn't create
|
|
the temporary file but used the original file instead. The
|
|
@@ -1046,7 +1048,7 @@
|
|
"no simulations run\n");
|
|
shutdown(EXIT_BAD);
|
|
}
|
|
- } /* --- if (ft_batchmode) --- */
|
|
+ } /* --- if (ft_batchmode) --- */
|
|
else {
|
|
cp_interactive = TRUE;
|
|
app_rl_readlines(); /* enter the command processing loop */
|