#include "spice.h"
#include "ftedefs.h"
#include "inpdefs.h"
#include "fteinp.h"
#include "spfteext.h"
Go to the source code of this file.
|
static char * | upper () |
|
static void | spsource () |
|
static void | decksource () |
|
static bool | is_ckt () |
|
static wordlist * | get_speccmds () |
|
static wordlist * | get_controls () |
|
static void | varsub () |
|
static wordlist * | wl_separate () |
|
static char * | flatten () |
|
void | com_listing (wordlist *wl) |
|
static char * | upper (char *string) |
|
void | inp_list (FILE *file, struct line *deck, struct line *extras, int type) |
|
void | inp_spsource (FILE *fp, bool comfile, char *filename) |
|
static void | spsource (FILE *fp, bool nospice, bool nocmds, char *filename) |
|
void | inp_decksource (struct line *deck, bool comfile, char *filename) |
|
static void | decksource (struct line *deck, bool nospice, bool nocmds, char *filename) |
|
static bool | is_ckt (struct line *deck) |
|
bool | inp_spdeck (struct line *deck, char *filename) |
|
static wordlist * | get_speccmds (struct line *deck) |
|
static wordlist * | get_controls (struct line *deck, bool allcmds) |
|
static void | varsub (char **str) |
|
static wordlist * | wl_separate (char *str) |
|
static char * | flatten (wordlist *wl) |
|
void | inp_dodeck (struct line *deck, char *tt, wordlist *end, bool reuse, struct line *options, char *filename) |
|
void | com_edit (wordlist *wl) |
|
void | inp_srcedit (char *filename, bool permfile, bool reuse) |
|
void | com_sced (wordlist *wl) |
|
void | com_source (wordlist *wl) |
|
void | inp_source (char *file) |
|
#define VALIDCHARS "_<#?@.()[]&" |
Definition at line 940 of file inp.c.
947 bool permfile, nosource =
false, reuse =
false;
995 if (!(fp = fopen(filename,
"w"))) {
1002 "Warning: editing a temporary file -- circuit not saved\n");
1007 if (!(fp = fopen(filename,
"w"))) {
1011 fprintf(fp,
"SPICE 3 test deck\n");
1017 if ((!rval ||
cieq(ed,
"xeditor")) && !
xeditor(filename)) {
1029 struct stat st1, st2;
1032 i = stat(filename,&st1);
1035 j = stat(filename,&st2);
1038 if (!i && st1.st_mtime == st2.st_mtime) {
bool cp_getvar(char *n, int t, char *r)
struct line * ci_origdeck
void inp_srcedit(char *filename, bool permfile, bool reuse)
struct circ * ft_circuits
void inp_list(FILE *file, struct line *deck, struct line *extras, int type)
struct wordlist * wl_next
void ShowPrompt(char *str)
Definition at line 49 of file inp.c.
79 "Error: bad listing type %s\n", s);
88 fprintf(
cp_err,
"Error: no circuit loaded.\n");
struct line * ci_origdeck
void inp_list(FILE *file, struct line *deck, struct line *extras, int type)
struct wordlist * wl_next
Definition at line 1099 of file inp.c.
1103 FILE *fp,*errfp,*outfp,*errtmp,*outtmp;
1105 bool inter, nosource =
false, reuse =
false;
1106 char *errmsg =
"Error: no symbolic representation found.\n";
1107 char *filename,*errfile,*outfile;
1144 filename =
"noname";
1151 errfp = fopen(errfile,
"w+");
1152 outfp = fopen(outfile,
"w");
1153 if (errfp ==
NULL || outfp ==
NULL) {
1154 fprintf(
cp_err,
"Error: redirection failed.\n");
1167 struct stat st1, st2;
1171 k = stat(filename,&st1);
1172 i =
sced(&filename);
1174 j = stat(filename,&st2);
1177 if (!k &&
eq(f1,filename) && st1.st_mtime == st2.st_mtime) {
1190 i =
sced(&filename);
1204 if (i == 2 || nosource)
1213 fprintf(
cp_err,
"Sourcing the spice text from %s\n",filename);
1215 "Warning: this text may not accurately reflect subcircuit changes\n\ 1216 made after %s was saved in sced\n",filename);
void inp_spsource(FILE *fp, bool comfile, char *filename)
struct circ * ft_circuits
struct wordlist * wl_next
Definition at line 1237 of file inp.c.
1244 char *tempfile =
NULL, *fname;
1247 bool nospice =
false, nocmds =
false, reuse =
false;
1252 for (; wl; wl = wn) {
1258 else if (strchr(wl->
wl_word,
'c'))
1260 else if (strchr(wl->
wl_word,
'r'))
1290 while ((i = fread(buf, 1,
BSIZE_SP, tp)) > 0)
1291 (
void) fwrite(buf, 1, i, fp);
1295 (void) fseek(fp, (
long) 0, 0);
1307 if (reuse && !nospice)
static char buf[MAXPROMPT]
struct wordlist * wl_prev
struct wordlist * wl_next
static void decksource |
( |
| ) |
|
|
static |
static void decksource |
( |
struct line * |
deck, |
|
|
bool |
nospice, |
|
|
bool |
nocmds, |
|
|
char * |
filename |
|
) |
| |
|
static |
Definition at line 378 of file inp.c.
392 FILE *lastin, *lastout, *lasterr;
398 if (!nospice &&
is_ckt(deck)) {
412 if (!nocmds || nospice) {
422 for (wl = controls; wl; wl = wl->
wl_next)
bool inp_spdeck(struct line *deck, char *filename)
static wordlist * get_controls()
struct wordlist * wl_next
Definition at line 771 of file inp.c.
781 for (ww = wl; ww; ww = ww->
wl_next)
782 len += strlen(ww->
wl_word) + 1;
785 for (ww = wl; ww; ww = ww->
wl_next) {
788 while (*s ==
'%') s++;
struct wordlist * wl_next
Definition at line 564 of file inp.c.
571 struct line *dd, *ld;
581 if (commands && !allcmds)
583 "Warning: redundant .control card\n");
594 "Warning: misplaced .endc card\n");
623 while (isspace(*s)) s--;
struct wordlist * wl_prev
static struct ccom * commands
struct wordlist * wl_next
Definition at line 523 of file inp.c.
527 struct line *dd, *ld;
538 while (isspace(*s)) s++;
struct wordlist * wl_prev
struct wordlist * wl_next
void inp_decksource |
( |
struct line * |
deck, |
|
|
bool |
comfile, |
|
|
char * |
filename |
|
) |
| |
void inp_dodeck |
( |
struct line * |
deck, |
|
|
char * |
tt, |
|
|
wordlist * |
end, |
|
|
bool |
reuse, |
|
|
struct line * |
options, |
|
|
char * |
filename |
|
) |
| |
Definition at line 807 of file inp.c.
828 for (dd = deck; dd; dd = dd->
li_next) {
834 for (dd = options; dd; dd = dd->
li_next) {
858 for (dd = deck; dd; dd = dd->
li_next)
861 fprintf(
cp_err,
"Warning, line %d : %s\n%s\n",
903 for (; options; options = options->
li_next) {
906 for (s = options->
li_line; *s && !isspace(*s); s++)
bool cp_getvar(char *n, int t, char *r)
struct line * ci_origdeck
struct variable * cp_setparse()
struct variable * ci_vars
struct variable * va_next
void inp_list |
( |
FILE * |
file, |
|
|
struct line * |
deck, |
|
|
struct line * |
extras, |
|
|
int |
type |
|
) |
| |
Definition at line 122 of file inp.c.
130 struct line *tmp, *next;
132 bool useout = (file ==
cp_out);
160 for (here = deck; here; here = here->
li_next) {
174 fprintf(file,
"%6d : %s\n",
183 fprintf(file,
"%s\n",
197 fprintf(file,
"%6d : .end\n", i);
201 for (here = deck; here; here = here->
li_next) {
216 fprintf(file,
"%6d : %s\n",
225 fprintf(file,
"%s\n",
233 fprintf(file,
"%s\n",
251 fprintf(file,
"%6d : %s\n",
260 fprintf(file,
"%s\n",
269 fprintf(file,
"%s\n",
286 fprintf(file,
"%6d : .end\n", i);
292 fprintf(file,
".end\n");
296 fprintf(
cp_err,
"inp_list: Internal Error: bad type %d\n",
type);
bool cp_getvar(char *n, int t, char *r)
void inp_source |
( |
char * |
file | ) |
|
Definition at line 1341 of file inp.c.
void com_source(wordlist *wl)
bool inp_spdeck |
( |
struct line * |
deck, |
|
|
char * |
filename |
|
) |
| |
Definition at line 463 of file inp.c.
468 struct line *dd, *realdeck, *options;
471 bool nosubckts =
false;
479 if (*dd->
li_line ==
'*')
continue;
501 "Error during subcircuit expansion, circuit not loaded.\n");
510 fprintf(
cp_err,
"Error: no lines in input\n");
bool cp_getvar(char *n, int t, char *r)
static wordlist * get_speccmds()
struct line * inp_deckcopy()
struct line * inp_getopts()
void inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, struct line *options, char *filename)
struct line * inp_subcktexpand()
void inp_spsource |
( |
FILE * |
fp, |
|
|
bool |
comfile, |
|
|
char * |
filename |
|
) |
| |
Definition at line 308 of file inp.c.
314 spsource(fp, comfile, comfile, filename);
void inp_srcedit |
( |
char * |
filename, |
|
|
bool |
permfile, |
|
|
bool |
reuse |
|
) |
| |
Definition at line 1057 of file inp.c.
void inp_spsource(FILE *fp, bool comfile, char *filename)
struct circ * ft_circuits
static bool is_ckt |
( |
struct line * |
deck | ) |
|
|
static |
Definition at line 437 of file inp.c.
452 if (!*s || *s ==
'*' || *s ==
'#') {
static void spsource |
( |
FILE * |
fp, |
|
|
bool |
nospice, |
|
|
bool |
nocmds, |
|
|
char * |
filename |
|
) |
| |
|
static |
Definition at line 319 of file inp.c.
331 if (
prefix(
"(Symbo",buf)) {
344 if (
prefix(
".check",buf)) {
353 if (
prefix(
".stim",buf)) {
356 MB_run(fp,1,filename);
static char buf[MAXPROMPT]
struct wordlist * wl_prev
struct wordlist * wl_next
static char* upper |
( |
char * |
string | ) |
|
|
static |
Definition at line 94 of file inp.c.
static char buf[MAXPROMPT]
static void varsub |
( |
char ** |
str | ) |
|
|
static |
Definition at line 661 of file inp.c.
static wordlist * wl_separate()
static wordlist* wl_separate |
( |
char * |
str | ) |
|
|
static |
Definition at line 680 of file inp.c.
690 while (isspace(*c)) c++;
692 while ((d = strchr(c,
'$')) !=
NULL) {
706 while(isspace(*c)) *c-- =
'\0';
709 if (*++d ==
'\0')
break;
710 if (*++d ==
'\0')
break;
752 while (*d && isspace(*d)) d++;
struct wordlist * wl_prev
struct wordlist * wl_next