49 #define def_fn(name) \ 50 static int name(v,flag) \ 62 "Warning: program not compiled with cshpar debug messages\n");
69 if (!flag)
return (
US_OK);
94 static char *
huhmsg =
"Excuse me??\n";
95 static char *
pltmsg =
"Error: can't set plot";
104 fprintf(
cp_err,
"Error: plot name not a string\n");
140 if (
eq(word,
"async"))
142 else if (
eq(word,
"control"))
144 else if (
eq(word,
"cshpar"))
146 else if (
eq(word,
"eval"))
148 else if (
eq(word,
"ginterface"))
150 else if (
eq(word,
"graf"))
152 else if (
eq(word,
"parser"))
154 else if (
eq(word,
"siminterface"))
156 else if (
eq(word,
"vecdb"))
163 char *dbgmsg =
"Error: bad type for debug var\n";
169 else if (v->va_type ==
VT_LIST) {
170 for (tv = v->va_vlist; tv; tv = tv->
va_next) {
174 setdb(tv->va_string);
184 fprintf(
cp_err,
"Warning: %s compiled without debug messages\n",
194 if ((v->va_type ==
VT_BOOL) && (flag ==
false))
196 else if (v->va_type ==
VT_REAL)
198 else if (v->va_type ==
VT_NUM)
201 fprintf(
cp_err,
"Bad 'height' \"%s\"\n", v->va_name);
209 else if (v->va_type ==
VT_REAL) {
210 if (v->va_real <
M_PI/50 || v->va_real >
M_PI/2)
212 JJdphi = v->va_real*3.3e-16;
214 else if (v->va_type ==
VT_NUM) {
215 if (v->va_num <
M_PI/50 || v->va_num >
M_PI/2)
217 JJdphi = v->va_num*3.3e-16;
223 fprintf(
cp_err,
"Error: must be between pi/50 and pi/2\n");
236 if ((v->va_type ==
VT_BOOL) && (flag ==
false))
238 else if (v->va_type ==
VT_REAL)
240 else if (v->va_type ==
VT_NUM)
270 if ((v->va_type ==
VT_BOOL) && (flag ==
false))
272 else if (v->va_type ==
VT_REAL)
274 else if (v->va_type ==
VT_NUM)
277 fprintf(
cp_err,
"Bad 'rawfileprec' \"%s\"\n", v->va_name);
285 if (
false && ((*v->va_string ==
'd') ||
286 (*v->va_string ==
'D')))
304 "Warning: no PATH in environment.\n");
319 if ((v->va_type ==
VT_BOOL) && (flag ==
false))
321 else if (v->va_type ==
VT_REAL)
323 else if (v->va_type ==
VT_NUM)
326 fprintf(
cp_err,
"Bad 'width' \"%s\"\n", v->va_name);
448 {&
kw_abstol,
"real Absolute error tolerance, default 1e-12.",
NULL},
449 {&
kw_acct,
"bool Print accounting summary.", _iv_acct},
450 {&
kw_appendwrite,
"bool Append to file with write command, no overwrite.", NULL},
451 {&
kw_checkiterate,
"int Binary search iterations in range analysis.", NULL},
452 {&
kw_chgtol,
"real Charge tolerance, default 1e-14.", NULL},
453 {&
kw_color,
"list X window colors, see help.", NULL},
454 {&
kw_cpdebug,
"bool Enable command processor debugging.", _iv_cpdebug},
455 {&
kw_curplot,
"str Current plot.", _iv_curplot},
456 {&
kw_curplotname,
"str Current plot name, read only.", _iv_curplotname},
457 {&
kw_curplottitle,
"str Current plot title, read only.", _iv_curplottitle},
458 {&
kw_curplotdate,
"str Current plot date, read only", _iv_curplotdate},
459 {&
kw_debug,
"list Enable debugging, see help for keywords.", _iv_debug},
460 {&
kw_defad,
"real MOS drain diffusion area, default 0.", NULL},
461 {&
kw_defas,
"real MOS source diffusion area, defalut 0", NULL},
462 {&
kw_defl,
"real MOS channel length, default 100 microns.", NULL},
463 {&
kw_defw,
"real MOS channel width, default 100 microns.", NULL},
464 {&
kw_device,
"str UNIX /dev/tty?? device for output.", NULL},
465 {&
kw_display,
"str X uses this display, read only.", _iv_display},
466 {&
kw_dontplot,
"bool Don't send graphics code to output device.", NULL},
467 {&
kw_editor,
"str Editor invocation string.", NULL},
468 {&
kw_filetype,
"str Rawfile type: ascii or binary.", NULL},
469 {&
kw_fourgridsize,
"int Number of interpolation points in fourier analysis.", NULL},
470 {&
kw_gmin,
"real Minimum conductance allowed, default 1e-12.", NULL},
471 {&
kw_gridsize,
"real Number of y-axis grid lines.", NULL},
472 {&
kw_gridstyle,
"str Plot default grid type (lingrid, loglog, nogrid, \n\t\t xlog, ylog, polar, smith).", NULL},
473 {&
kw_hcopydev,
"str UNIX: send hardcopy using LPR -P??. DOS: prn,lpt?.", NULL},
474 {&
kw_hcopydevtype,
"str Hardcopy device type: postscript, etc.", NULL},
475 {&
kw_height,
"real Screen height in characters.", _iv_height},
476 {&
kw_history,
"int Number of remembered commands, default 1000.", _iv_history},
477 {&
kw_hitusertp,
"bool Force transient analysis at user time points.", NULL},
478 {&
kw_ignoreeof,
"bool Ignore end of file (^D) in UNIX.", _iv_ignoreeof},
479 {&
kw_itl1,
"int DC iteration limit, default 100.", NULL},
480 {&
kw_itl2,
"int DC transfer curve iteration limit, default 50", NULL},
481 {&
kw_itl3,
"int Lower transient iteration limit, default 4.", NULL},
482 {&
kw_itl4,
"int Upper transient iteration limit, default 10.", NULL},
483 {&
kw_itl5,
"int Unused.", NULL},
484 {&
kw_jjdphimax,
"real Max Josephson phase delta per step, default pi/10.", _iv_jjdphimax},
485 {&
kw_level,
"str Level for newhelp, (b, i, or a).", NULL},
486 {&
kw_list,
"bool Causes the input to be listed.", _iv_list},
487 {&
kw_maxwins,
"int Maximum number of windows in X.", NULL},
488 {&
kw_modelcard,
"str Name of model card, default .model.", NULL},
489 {&
kw_mplot_cur,
"str Name of current output file for check command", NULL},
490 {&
kw_nfreqs,
"int Number of frequencies in fourier command, default 10.", NULL},
492 {&
kw_noaskquit,
"bool Don't verify before termination.", NULL},
493 {&
kw_nobjthack,
"bool Assume BJT's have 4 nodes.", NULL},
494 {&
kw_nobreak,
"bool No break between pages in asciiplot.", NULL},
495 {&
kw_nocc,
"bool No command completion.", _iv_nocc},
496 {&
kw_noclobber,
"bool Don't overwrite files when redirecting output.", _iv_noclobber},
497 {&
kw_node,
"bool Print node table.", _iv_node},
498 {&
kw_noglob,
"bool Don't expand wildcard characters.", _iv_noglob},
499 {&
kw_nogrid,
"bool Don't plot a grid.", NULL},
500 {&
kw_noiter,
"bool No transient iterations past predictor.", _iv_noiter},
501 {&
kw_nojjtp,
"bool No Josephson phase change timestep, use trunc error.", NULL},
502 {&
kw_nomoremode,
"bool Turn off more mode.", _iv_nomoremode},
503 {&
kw_nonomatch,
"bool Use wildcard characters literally if no match.", _iv_nonomatch},
504 {&
kw_nopage,
"bool Supress page ejects.", _iv_nopage},
505 {&
kw_noparse,
"bool Don't parse circuit.", NULL},
507 {&
kw_nosort,
"bool Supress sorting of variable names.", NULL},
508 {&
kw_nosubckt,
"bool No subcircuit expansion.", NULL},
509 {&
kw_nousertp,
"bool Save raw time point values in transient analysis.", NULL},
510 {&
kw_numdgt,
"int Number of significant digits to print, default 4.", _iv_numdgt},
511 {&
kw_opts,
"bool Print options.", _iv_opts},
512 {&
kw_pivrel,
"real Relative pivot value, default 1e-3.", NULL},
513 {&
kw_pivtol,
"real Minimum pivot value, default 1e-13.", NULL},
514 {&
kw_plots,
"list Read only, list of plots.", _iv_plots},
515 {&
kw_plotstyle,
"str Default plot type (linplot, combplot, pointplot).", NULL},
516 {&
kw_pointchars,
"str Point characters for plotting.", NULL},
517 {&
kw_polydegree,
"int Degree of interpolating polynomial.", NULL},
518 {&
kw_polysteps,
"int Number of interpolating points, default 10.", NULL},
519 {&
kw_printinfo,
"bool Print debugging info when plot starts.", NULL},
520 {&
kw_program,
"str Program name.", _iv_program},
521 {&
kw_prompt,
"str Prompt string.", _iv_prompt},
522 {&
kw_rawfile,
"str Rawfile path.", _iv_rawfile},
523 {&
kw_rawfileprec,
"int Significant digits in rawfile.", _iv_rawfileprec},
524 {&
kw_reltol,
"real Relative error tolerance, default 1e-3.", NULL},
525 {&
kw_renumber,
"bool Renumber source lines after subcircuit expansion.", NULL},
526 {&
kw_rhost,
"str Remote host name, for UNIX remote simulations.", NULL},
527 {&
kw_rprogram,
"str Remote simulation program name, for UNIX.", NULL},
528 {&
kw_scedfont,
"str Name of X font used in SCED.", NULL},
529 {&
kw_slowplot,
"bool Wait for input between plots.", NULL},
530 {&
kw_sourcepath,
"str Path to search for source command.", NULL},
531 {&
kw_spicepath,
"str Path to use in aspice command.", NULL},
532 {&
kw_strictnumparse,
"bool Don't allow trailing characters after number.", _iv_strictnumparse},
533 {&
kw_subend,
"str End subcircuits, default .ends.", NULL},
534 {&
kw_subinvoke,
"str Prefix to invoke subcircuits, default x.", NULL},
535 {&
kw_substart,
"str Start subcircuit definition, default .subckt.", NULL},
536 {&
kw_term,
"str Name of current terminal, for MFB.", NULL},
537 {&
kw_ticmarks,
"bool Plot tic marks, if int, set tic mark separation.", NULL},
538 {&
kw_tnom,
"real Nominal temperature, default 27C.", NULL},
539 {&
kw_trtol,
"real Truncation error tolerance, default 7.", NULL},
540 {&
kw_units,
"str If \"degrees\", trig functions don't use radians.", _iv_units},
541 {&
kw_unixcom,
"bool Execute operating system commands.", _iv_unixcom},
542 {&
kw_vntol,
"real Voltage error tolerance, default 1e-6.", NULL},
543 {&
kw_width,
"int Width of screen in characters.", _iv_width},
544 {&
kw_wpboxh,
"real Graphics box height for WordPerfect plot, (4\").", NULL},
545 {&
kw_wpboxw,
"real Graphics box width for WordPerfect plot (4\").", NULL},
546 {&
kw_xglinewidth,
"int Pixel linewidth used in xgraph, default 1.", NULL},
547 {&
kw_xgmarkers,
"bool Use markers in xgraph pointplot, else big pixels.", NULL},
548 {&
kw_xfont,
"str Name of X font for graphics, default \"fixed\".", NULL}
564 if (int_vars[i].
func) {
589 if (
eq(wl->wl_word,*(int_vars[i].
name))) {
594 if (i ==
sizeof(int_vars)/
sizeof(
struct intvar))
595 out_printf(
"%-18s %s\n",wl->wl_word,
"not an internal variable");
622 i = (*x->
func)(v,flag);
638 switch (v->va_type) {
651 (void)
strcpy(val, v->va_string);
655 (void) sprintf(val,
"%d", v->va_num);
669 "cp_usrset: Internal Error: Bad var type %d\n",
709 tt = strrchr(word,
')');
711 fprintf(
cp_err,
"Error: closing ')' not found.\n");
714 r = range = strchr(tt,
'[');
717 r = range = strchr(word,
'[');
722 if (!isdigit(*r) && *r !=
'-')
724 "Warning: nonparseable range specified, %s[%s\n",
726 for (low = 0; isdigit(*r); r++)
727 low = low * 10 + *r -
'0';
728 if ((*r ==
'-') && isdigit(r[1]))
729 for (up = 0, r++; isdigit(*r); r++)
730 up = up * 10 + *r -
'0';
743 fprintf(
cp_err,
"Error: parse failed.\n");
755 "Warning: only one vector may be accessed with the $& notation.\n");
815 tv->va_next = vv->va_vlist;
843 sn = ((hi < lo) ? -1 : 1);
844 sz = d->v_length/d->v_dims[0];
846 for (i = lo; ((sn == 1) ? (i <= hi) : (i >= hi)); i += sn) {
847 if (i >= d->v_dims[0])
855 if (d->v_numdims == 1) {
857 vv->va_real = d->v_realdata[i];
859 vv->va_real =
realpart(&d->v_compdata[i]);
864 x = (
char*)&d->v_realdata[i*sz];
866 x = (
char*)&d->v_compdata[i*sz];
868 vv->va_vlist =
getlist(d,1,&x);
893 for (i = d->v_dims[dim] - 1; i >= 0; i--) {
900 if (dim == d->v_numdims-1) {
902 vv->va_real = *(*(
double**)x);
903 *x +=
sizeof(double);
906 vv->va_real = (*(
complex**)x)->cx_real;
912 vv->va_vlist =
getlist(d,dim+1,x);
973 struct line *last, *opts =
NULL, *dd, *next;
976 for (dd = deck->li_next; dd; dd = next) {
979 if (
ciprefix(
".opt", dd->li_line)) {
struct dvec * ft_evaluate()
static struct intvar int_vars[]
static struct variable * vec2var()
int cp_internalset(struct variable *v, bool flag)
void com_usrset(wordlist *wl)
struct pnode * ft_getpnames()
struct variable * va_copy()
static struct variable * getlist()
void if_option(char *ckt, char *name, int type, char *value)
static void setdb(char *word)
char * kw_noasciiplotvalue
struct wordlist * wl_prev
struct line * inp_getopts(struct line *deck)
void cp_usrvars(struct variable **v1, struct variable **v2)
struct variable * ci_vars
struct variable * cp_enqvar(char *word)
struct wordlist * wl_next
struct variable * va_next
static void * internalvars