2009-12-04 07:09:57 +00:00
|
|
|
--- src/main.c 2009-10-24 08:28:09.000000000 +0200
|
2009-12-08 00:33:42 +00:00
|
|
|
+++ main.c 2009-12-07 22:42:09.000000000 +0100
|
|
|
|
@@ -5,7 +5,7 @@
|
|
|
|
Author: 1985 Wayne A. Christopher
|
|
|
|
|
|
|
|
The main routine for ngspice
|
|
|
|
- $Id: main.c,v 1.58 2009/10/24 06:28:09 dwarning Exp $
|
|
|
|
+ $Id: main.c,v 1.60 2009/12/07 21:42:09 h_vogt Exp $
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ngspice.h"
|
|
|
|
@@ -53,6 +53,7 @@
|
|
|
|
#include "frontend/variable.h"
|
|
|
|
#include "frontend/display.h" /* added by SDB to pick up Input() fcn */
|
|
|
|
#include "frontend/signal_handler.h"
|
|
|
|
+#include "compatmode.h"
|
|
|
|
|
|
|
|
/* saj xspice headers */
|
|
|
|
#ifdef XSPICE
|
|
|
|
@@ -188,9 +189,14 @@
|
|
|
|
extern struct comm spcp_coms[ ];
|
|
|
|
struct comm *cp_coms = spcp_coms;
|
|
|
|
|
|
|
|
-extern int OUTpBeginPlot(), OUTpData(), OUTwBeginPlot(), OUTwReference();
|
|
|
|
-extern int OUTwData(), OUTwEnd(), OUTendPlot(), OUTbeginDomain();
|
|
|
|
-extern int OUTendDomain(), OUTstopnow(), OUTerror(), OUTattributes();
|
|
|
|
+extern int OUTpBeginPlot(void *,void *,IFuid,IFuid,int,int,IFuid *,int,void **);
|
|
|
|
+extern int OUTpData(void *,IFvalue *,IFvalue *);
|
|
|
|
+extern int OUTwBeginPlot(void *,void *,IFuid,IFuid,int,int,IFuid *,int,void **);
|
|
|
|
+extern int OUTwReference(void *,IFvalue *,void **);
|
|
|
|
+extern int OUTwData(void *,int,IFvalue *,void *), OUTwEnd(void *), OUTendPlot(void *);
|
|
|
|
+extern int OUTbeginDomain(void *,IFuid,int,IFvalue *);
|
|
|
|
+extern int OUTendDomain(void *), OUTstopnow(void), OUTerror(int,char *,IFuid *);
|
|
|
|
+extern int OUTattributes(void *,IFuid *,int,IFvalue *);
|
|
|
|
|
|
|
|
IFfrontEnd nutmeginfo = {
|
|
|
|
IFnewUid,
|
|
|
|
@@ -347,6 +353,26 @@
|
|
|
|
int DEVmaxnum = 0;
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
+/* Set a compatibility flag.
|
|
|
|
+ Currently available are flags for:
|
|
|
|
+ ngspice (standard)
|
|
|
|
+ HSPICE
|
|
|
|
+ Spice3
|
|
|
|
+*/
|
|
|
|
+COMPATMODE_T ngspice_compat_mode(void)
|
|
|
|
+{
|
|
|
|
+ char behaviour[80] ;
|
|
|
|
+
|
|
|
|
+ if( cp_getvar("ngbehavior", VT_STRING, behaviour)){
|
|
|
|
+ if (strcasecmp(behaviour,"hspice")==0)
|
|
|
|
+ return( COMPATMODE_HSPICE ) ;
|
|
|
|
+ if (strcasecmp(behaviour,"spice3")==0)
|
|
|
|
+ return( COMPATMODE_SPICE3 ) ;
|
|
|
|
+ }
|
|
|
|
+ return(COMPATMODE_NATIVE) ;
|
|
|
|
+} /* end ngspice_compat_mode() */
|
|
|
|
+
|
|
|
|
+/* -------------------------------------------------------------------------- */
|
|
|
|
int
|
|
|
|
SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator)
|
|
|
|
{
|
|
|
|
@@ -553,6 +579,7 @@
|
2009-08-09 15:58:12 +00:00
|
|
|
" -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"
|
2009-12-08 00:33:42 +00:00
|
|
|
+ " -p, --pipe run in I/O pipe mode\n"
|
2009-08-09 15:58:12 +00:00
|
|
|
" -q, --completion activate command completion\n"
|
2009-12-04 07:09:57 +00:00
|
|
|
" -r, --rawfile=FILE set the rawfile output\n"
|
2009-08-09 15:58:12 +00:00
|
|
|
" -s, --server run spice as a server process\n"
|
2009-12-08 00:33:42 +00:00
|
|
|
@@ -759,6 +786,7 @@
|
2009-08-09 15:58:12 +00:00
|
|
|
{"interactive", 0, 0, 'i'},
|
|
|
|
{"no-spiceinit", 0, 0, 'n'},
|
|
|
|
{"output", 1, 0, 'o'},
|
|
|
|
+ {"pipe", 0, 0, 'p'},
|
|
|
|
{"completion", 0, 0, 'q'},
|
|
|
|
{"rawfile", 1, 0, 'r'},
|
|
|
|
{"server", 0, 0, 's'},
|
2009-12-08 00:33:42 +00:00
|
|
|
@@ -766,7 +794,7 @@
|
2009-08-09 15:58:12 +00:00
|
|
|
{0, 0, 0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
- c = getopt_long (argc, argv, "hvbac:ihno:qr:st:",
|
|
|
|
+ c = getopt_long (argc, argv, "hvbac:ihno:pqr:st:",
|
|
|
|
long_options, &option_index);
|
|
|
|
if (c == -1)
|
|
|
|
break;
|
2009-12-08 00:33:42 +00:00
|
|
|
@@ -826,6 +854,11 @@
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case 'p': /* Run in pipe mode */
|
|
|
|
+ iflag = TRUE;
|
|
|
|
+ istty = TRUE;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
case 'q': /* Command completion */
|
|
|
|
qflag = TRUE;
|
|
|
|
break;
|