Merge branch 'pre-master' into bt_dev
This commit is contained in:
commit
1c1ceb4d9d
|
|
@ -7,11 +7,17 @@
|
||||||
|
|
||||||
#include "com_plot.h"
|
#include "com_plot.h"
|
||||||
|
|
||||||
|
extern bool ft_batchmode;
|
||||||
|
|
||||||
/* plot name ... [xl[imit]] xlo xhi] [yl[imit ylo yhi] [vs xname] */
|
/* plot name ... [xl[imit]] xlo xhi] [yl[imit ylo yhi] [vs xname] */
|
||||||
void
|
void
|
||||||
com_plot(wordlist *wl)
|
com_plot(wordlist *wl)
|
||||||
{
|
{
|
||||||
|
if (ft_batchmode) {
|
||||||
|
fprintf(stderr, "\nWarning: command 'plot' is not available during batch simulation, ignored!\n");
|
||||||
|
fprintf(stderr, " You may use Gnuplot instead.\n\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
plotit(wl, NULL, NULL);
|
plotit(wl, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ DISPDEVICE device[] = {
|
||||||
(disp_fn_Track_t *) NODEV, (disp_fn_MakeMenu_t *) NODEV, (disp_fn_MakeDialog_t *) NODEV, (disp_fn_Input_t *) NODEV,
|
(disp_fn_Track_t *) NODEV, (disp_fn_MakeMenu_t *) NODEV, (disp_fn_MakeDialog_t *) NODEV, (disp_fn_Input_t *) NODEV,
|
||||||
gen_DatatoScreen, },
|
gen_DatatoScreen, },
|
||||||
|
|
||||||
{ "PrinterOnly", 0, 0, 24, 80, 0, 0,
|
{ "BatchMode/PrinterOnly", 0, 0, 24, 80, 0, 0,
|
||||||
(disp_fn_Init_t *) NODEV, (disp_fn_NewViewport_t *) NODEV,
|
(disp_fn_Init_t *) NODEV, (disp_fn_NewViewport_t *) NODEV,
|
||||||
(disp_fn_Close_t *) NOP, (disp_fn_Clear_t *) NODEV,
|
(disp_fn_Close_t *) NOP, (disp_fn_Clear_t *) NODEV,
|
||||||
(disp_fn_DrawLine_t *) NODEV, (disp_fn_Arc_t *) NODEV, (disp_fn_Text_t *) NODEV,
|
(disp_fn_DrawLine_t *) NODEV, (disp_fn_Arc_t *) NODEV, (disp_fn_Text_t *) NODEV,
|
||||||
|
|
|
||||||
|
|
@ -980,6 +980,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (dd = deck; dd; dd = dd->nextcard) {
|
for (dd = deck; dd; dd = dd->nextcard) {
|
||||||
|
/* first line is title line, skip it */
|
||||||
|
if (deck == dd) {
|
||||||
|
prev_card = dd;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/* all parameter lines should be sequentially ordered and placed at
|
/* all parameter lines should be sequentially ordered and placed at
|
||||||
beginning of deck */
|
beginning of deck */
|
||||||
if (ciprefix(".para", dd->line)) {
|
if (ciprefix(".para", dd->line)) {
|
||||||
|
|
|
||||||
|
|
@ -1395,6 +1395,8 @@ nupa_assignment(dico_t *dico, const char *s, char mode)
|
||||||
bug: we cannot rely on the transformed line, must re-parse everything!
|
bug: we cannot rely on the transformed line, must re-parse everything!
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
if (!s || !*s)
|
||||||
|
return 1;
|
||||||
/* s has the format: ident = expression; ident= expression ... */
|
/* s has the format: ident = expression; ident= expression ... */
|
||||||
const char * const s_end = s + strlen(s);
|
const char * const s_end = s + strlen(s);
|
||||||
const char *p = s;
|
const char *p = s;
|
||||||
|
|
|
||||||
22
src/main.c
22
src/main.c
|
|
@ -19,6 +19,7 @@
|
||||||
#ifdef HAVE_GNUREADLINE
|
#ifdef HAVE_GNUREADLINE
|
||||||
# include <readline/readline.h>
|
# include <readline/readline.h>
|
||||||
# include <readline/history.h>
|
# include <readline/history.h>
|
||||||
|
# include "../misc/tilde.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* editline development has added the following typdef to readline.h in 06/2018.
|
/* editline development has added the following typdef to readline.h in 06/2018.
|
||||||
|
|
@ -614,11 +615,15 @@ static void
|
||||||
app_rl_init(void)
|
app_rl_init(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
||||||
|
char *home;
|
||||||
|
|
||||||
/* --- set up readline params --- */
|
/* --- set up readline params --- */
|
||||||
strcpy(history_file, getenv("HOME"));
|
|
||||||
strcat(history_file, "/.");
|
if (get_local_home(0, &home) < 0)
|
||||||
strcat(history_file, application_name);
|
return;
|
||||||
strcat(history_file, "_history");
|
snprintf(history_file, sizeof history_file, "%s/.%s_history",
|
||||||
|
home, application_name);
|
||||||
|
tfree(home);
|
||||||
|
|
||||||
using_history();
|
using_history();
|
||||||
read_history(history_file);
|
read_history(history_file);
|
||||||
|
|
@ -1403,6 +1408,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (ft_batchmode) {
|
if (ft_batchmode) {
|
||||||
|
|
||||||
|
int error3 = 1;
|
||||||
|
|
||||||
/* If we get back here in batch mode then something is wrong,
|
/* If we get back here in batch mode then something is wrong,
|
||||||
* so exit. */
|
* so exit. */
|
||||||
|
|
||||||
|
|
@ -1425,6 +1432,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
cp_interactive = FALSE;
|
cp_interactive = FALSE;
|
||||||
|
|
||||||
|
/* Check if a simulation has run from a .control section */
|
||||||
|
cp_getvar("sim_status", CP_NUM, &error3, 0);
|
||||||
|
|
||||||
if (rflag) {
|
if (rflag) {
|
||||||
/* If -r is specified, then dot cards (.width, .plot, .print, .op, .meas, .tf)
|
/* If -r is specified, then dot cards (.width, .plot, .print, .op, .meas, .tf)
|
||||||
are ignored, except .save, which has been handled by ft_dotsaves()
|
are ignored, except .save, which has been handled by ft_dotsaves()
|
||||||
|
|
@ -1443,6 +1453,10 @@ int main(int argc, char **argv)
|
||||||
if (ft_cktcoms(FALSE) || error2)
|
if (ft_cktcoms(FALSE) || error2)
|
||||||
sp_shutdown(EXIT_BAD);
|
sp_shutdown(EXIT_BAD);
|
||||||
}
|
}
|
||||||
|
else if (error3 == 0) {
|
||||||
|
fprintf(stdout, "Note: Simulation executed from .control section \n");
|
||||||
|
sp_shutdown(EXIT_NORMAL);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Note: No \".plot\", \".print\", or \".fourier\" lines; "
|
"Note: No \".plot\", \".print\", or \".fourier\" lines; "
|
||||||
|
|
|
||||||
|
|
@ -2033,7 +2033,8 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
|
||||||
fl_exited = TRUE;
|
fl_exited = TRUE;
|
||||||
bgtr(fl_exited, ng_ident, userptr);
|
bgtr(fl_exited, ng_ident, userptr);
|
||||||
// set a flag that ngspice wants to be detached
|
// set a flag that ngspice wants to be detached
|
||||||
ngexit(status, FALSE, coquit, ng_ident, userptr);
|
if(ngexit)
|
||||||
|
ngexit(status, FALSE, coquit, ng_ident, userptr);
|
||||||
// finish and exit the worker thread
|
// finish and exit the worker thread
|
||||||
#ifdef HAVE_LIBPTHREAD
|
#ifdef HAVE_LIBPTHREAD
|
||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
|
|
@ -2042,7 +2043,8 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// set a flag in caller to detach ngspice.dll
|
// set a flag in caller to detach ngspice.dll
|
||||||
ngexit(status, immediate, coquit, ng_ident, userptr);
|
if(ngexit)
|
||||||
|
ngexit(status, immediate, coquit, ng_ident, userptr);
|
||||||
|
|
||||||
// jump back to finish the calling function
|
// jump back to finish the calling function
|
||||||
if (!intermj)
|
if (!intermj)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here->ISRCname);
|
here->ISRCname);
|
||||||
}
|
}
|
||||||
else if (here->ISRCdcGiven && here->ISRCfuncTGiven
|
else if (here->ISRCdcGiven && here->ISRCfuncTGiven
|
||||||
&& here->ISRCfunctionType != TRNOISE && here->ISRCfunctionType != TRRANDOM) {
|
&& here->ISRCfunctionType != TRNOISE
|
||||||
|
&& here->ISRCfunctionType != TRRANDOM
|
||||||
|
&& here->ISRCfunctionType != EXTERNAL) {
|
||||||
/* DC value and transient time 0 values given */
|
/* DC value and transient time 0 values given */
|
||||||
double time0value;
|
double time0value;
|
||||||
/* determine transient time 0 value */
|
/* determine transient time 0 value */
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ VSRCtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here->VSRCname);
|
here->VSRCname);
|
||||||
}
|
}
|
||||||
else if (here->VSRCdcGiven && here->VSRCfuncTGiven
|
else if (here->VSRCdcGiven && here->VSRCfuncTGiven
|
||||||
&& here->VSRCfunctionType != TRNOISE && here->VSRCfunctionType != TRRANDOM) {
|
&& here->VSRCfunctionType != TRNOISE
|
||||||
|
&& here->VSRCfunctionType != TRRANDOM
|
||||||
|
&& here->VSRCfunctionType != EXTERNAL) {
|
||||||
/* DC value and transient time 0 values given */
|
/* DC value and transient time 0 values given */
|
||||||
double time0value;
|
double time0value;
|
||||||
/* determine transient time 0 value */
|
/* determine transient time 0 value */
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, struct card *current,
|
||||||
IFvalue *parm; /* a pointer to a value struct for function returns */
|
IFvalue *parm; /* a pointer to a value struct for function returns */
|
||||||
int which; /* which analysis we are performing */
|
int which; /* which analysis we are performing */
|
||||||
char *steptype; /* ac analysis, type of stepping function */
|
char *steptype; /* ac analysis, type of stepping function */
|
||||||
|
bool pdef = FALSE; /* issue a warning if default parameters are used */
|
||||||
|
|
||||||
NG_IGNORE(gnode);
|
NG_IGNORE(gnode);
|
||||||
|
|
||||||
|
|
@ -193,15 +194,33 @@ dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, struct card *current,
|
||||||
}
|
}
|
||||||
IFC(newAnalysis, (ckt, which, "AC Analysis", &foo, task));
|
IFC(newAnalysis, (ckt, which, "AC Analysis", &foo, task));
|
||||||
INPgetTok(&line, &steptype, 1); /* get DEC, OCT, or LIN */
|
INPgetTok(&line, &steptype, 1); /* get DEC, OCT, or LIN */
|
||||||
|
if (!*steptype || (!ciprefix("dec", steptype) && !ciprefix("oct", steptype) && !ciprefix("lin", steptype))) {
|
||||||
|
current->error = "Missing DEC, OCT, or LIN\n";
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
ptemp.iValue = 1;
|
ptemp.iValue = 1;
|
||||||
GCA(INPapName, (ckt, which, foo, steptype, &ptemp));
|
GCA(INPapName, (ckt, which, foo, steptype, &ptemp));
|
||||||
tfree(steptype);
|
tfree(steptype);
|
||||||
|
|
||||||
parm = INPgetValue(ckt, &line, IF_INTEGER, tab); /* number of points */
|
parm = INPgetValue(ckt, &line, IF_INTEGER, tab); /* number of points */
|
||||||
|
if (parm->iValue == 0)
|
||||||
|
pdef = TRUE;
|
||||||
GCA(INPapName, (ckt, which, foo, "numsteps", parm));
|
GCA(INPapName, (ckt, which, foo, "numsteps", parm));
|
||||||
|
|
||||||
|
if(!isdigit(*line))
|
||||||
|
pdef = TRUE;
|
||||||
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstart */
|
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstart */
|
||||||
GCA(INPapName, (ckt, which, foo, "start", parm));
|
GCA(INPapName, (ckt, which, foo, "start", parm));
|
||||||
|
|
||||||
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstop */
|
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstop */
|
||||||
|
if (parm->rValue == 0)
|
||||||
|
pdef = TRUE;
|
||||||
GCA(INPapName, (ckt, which, foo, "stop", parm));
|
GCA(INPapName, (ckt, which, foo, "stop", parm));
|
||||||
|
|
||||||
|
if (pdef) {
|
||||||
|
fprintf(stderr, "Warning, ngspice assumes default parameter(s) for ac simulation\n");
|
||||||
|
fprintf(stderr, " Check your ac or .ac line\n\n");
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ INPgetTok(char **line, char **token, int gobble)
|
||||||
char *point;
|
char *point;
|
||||||
int signstate;
|
int signstate;
|
||||||
|
|
||||||
|
if (!*line) {
|
||||||
|
*token = NULL;
|
||||||
|
return (E_PARMVAL);
|
||||||
|
}
|
||||||
|
|
||||||
/* scan along throwing away garbage characters until end of line
|
/* scan along throwing away garbage characters until end of line
|
||||||
or a separation char is found */
|
or a separation char is found */
|
||||||
for (point = *line; *point != '\0'; point++) {
|
for (point = *line; *point != '\0'; point++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue