Merge branch 'pre-master' into bt_dev

This commit is contained in:
Brian Taylor 2023-06-20 11:12:34 -07:00
commit 1c1ceb4d9d
10 changed files with 66 additions and 9 deletions

View File

@ -7,11 +7,17 @@
#include "com_plot.h"
extern bool ft_batchmode;
/* plot name ... [xl[imit]] xlo xhi] [yl[imit ylo yhi] [vs xname] */
void
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);
}

View File

@ -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,
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_Close_t *) NOP, (disp_fn_Clear_t *) NODEV,
(disp_fn_DrawLine_t *) NODEV, (disp_fn_Arc_t *) NODEV, (disp_fn_Text_t *) NODEV,

View File

@ -980,6 +980,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
}
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
beginning of deck */
if (ciprefix(".para", dd->line)) {

View File

@ -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!
*/
{
if (!s || !*s)
return 1;
/* s has the format: ident = expression; ident= expression ... */
const char * const s_end = s + strlen(s);
const char *p = s;

View File

@ -19,6 +19,7 @@
#ifdef HAVE_GNUREADLINE
# include <readline/readline.h>
# include <readline/history.h>
# include "../misc/tilde.h"
#endif
/* editline development has added the following typdef to readline.h in 06/2018.
@ -614,11 +615,15 @@ static void
app_rl_init(void)
{
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
char *home;
/* --- set up readline params --- */
strcpy(history_file, getenv("HOME"));
strcat(history_file, "/.");
strcat(history_file, application_name);
strcat(history_file, "_history");
if (get_local_home(0, &home) < 0)
return;
snprintf(history_file, sizeof history_file, "%s/.%s_history",
home, application_name);
tfree(home);
using_history();
read_history(history_file);
@ -1403,6 +1408,8 @@ int main(int argc, char **argv)
if (ft_batchmode) {
int error3 = 1;
/* If we get back here in batch mode then something is wrong,
* so exit. */
@ -1425,6 +1432,9 @@ int main(int argc, char **argv)
cp_interactive = FALSE;
/* Check if a simulation has run from a .control section */
cp_getvar("sim_status", CP_NUM, &error3, 0);
if (rflag) {
/* If -r is specified, then dot cards (.width, .plot, .print, .op, .meas, .tf)
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)
sp_shutdown(EXIT_BAD);
}
else if (error3 == 0) {
fprintf(stdout, "Note: Simulation executed from .control section \n");
sp_shutdown(EXIT_NORMAL);
}
else {
fprintf(stderr,
"Note: No \".plot\", \".print\", or \".fourier\" lines; "

View File

@ -2033,7 +2033,8 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
fl_exited = TRUE;
bgtr(fl_exited, ng_ident, userptr);
// 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
#ifdef HAVE_LIBPTHREAD
pthread_exit(NULL);
@ -2042,7 +2043,8 @@ ATTRIBUTE_NORETURN void shared_exit(int status)
#endif
}
// 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
if (!intermj)

View File

@ -42,7 +42,9 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt)
here->ISRCname);
}
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 */
double time0value;
/* determine transient time 0 value */

View File

@ -48,7 +48,9 @@ VSRCtemp(GENmodel *inModel, CKTcircuit *ckt)
here->VSRCname);
}
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 */
double time0value;
/* determine transient time 0 value */

View File

@ -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 */
int which; /* which analysis we are performing */
char *steptype; /* ac analysis, type of stepping function */
bool pdef = FALSE; /* issue a warning if default parameters are used */
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));
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;
GCA(INPapName, (ckt, which, foo, steptype, &ptemp));
tfree(steptype);
parm = INPgetValue(ckt, &line, IF_INTEGER, tab); /* number of points */
if (parm->iValue == 0)
pdef = TRUE;
GCA(INPapName, (ckt, which, foo, "numsteps", parm));
if(!isdigit(*line))
pdef = TRUE;
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstart */
GCA(INPapName, (ckt, which, foo, "start", parm));
parm = INPgetValue(ckt, &line, IF_REAL, tab); /* fstop */
if (parm->rValue == 0)
pdef = TRUE;
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);
}

View File

@ -31,6 +31,11 @@ INPgetTok(char **line, char **token, int gobble)
char *point;
int signstate;
if (!*line) {
*token = NULL;
return (E_PARMVAL);
}
/* scan along throwing away garbage characters until end of line
or a separation char is found */
for (point = *line; *point != '\0'; point++) {