#include "spice.h"
#include "ftedefs.h"
#include "fteinp.h"
#include "kwords.h"
#include "spfteext.h"
Go to the source code of this file.
|
static struct line * | doit () |
|
static bool | translate () |
|
static void | finishLine () |
|
static bool | settrans () |
|
static bool | aredups () |
|
static char * | gettrans () |
|
static void | numrefs () |
|
static bool | modtranslate () |
|
static void | devmodtranslate () |
|
static void | looksubmod () |
|
struct line * | inp_subcktexpand (struct line *deck) |
|
static struct line * | doit (struct line *deck) |
|
static bool | translate (struct line *deck, char *formal, char *actual, char *scname, char *subname, char *instr) |
|
static void | finishLine (char *dst, char *src, char *scname) |
|
static bool | settrans (char *formal, char *actual, char *subname, char *instr) |
|
static char * | gettrans (char *name) |
|
static void | numrefs (char *name, int *terms, int *devs) |
|
static bool | modtranslate (struct line *deck, char *subname) |
|
static void | devmodtranslate (struct line *deck, char *subname) |
|
static void | looksubmod (char **t, char *buffer, char *subname) |
|
Definition at line 643 of file subckt.c.
static struct tab table[512]
static void devmodtranslate |
( |
| ) |
|
|
static |
static void devmodtranslate |
( |
struct line * |
deck, |
|
|
char * |
subname |
|
) |
| |
|
static |
Definition at line 800 of file subckt.c.
806 char *buffer, *name, *
t,
c;
807 int terms, devs, soft, hasmod;
809 for (s = deck; s; s = s->
li_next) {
811 while (*t && isspace(*t))
813 c = isupper(*t) ? tolower(*t) : *t;
819 buffer =
tmalloc(strlen(t) + strlen(subname) + 4);
825 copytok1(buffer + strlen(buffer),&t);
830 (void) strcat(buffer, t);
int copytok1(char *dst, char **s)
static struct line* doit |
( |
| ) |
|
|
static |
static struct line* doit |
( |
struct line * |
deck | ) |
|
|
static |
Definition at line 154 of file subckt.c.
158 struct line *
c, *last, *lc, *lcc;
160 char *
s, *
t, *
tt, *scname, *subname;
161 int nest, numpasses =
MAXNEST, i;
174 for (last = deck, lc =
NULL; last; ) {
176 fprintf(
cp_err,
"Error: misplaced %s card: %s\n",
sbend,
223 while (isspace(s[i]))
227 while (s[i] && !isspace(s[i]))
273 for (c = deck, lc =
NULL;
c; ) {
278 tmpscname = scname =
gettok(&s);
280 while ((*scname ==
' ') || (*scname ==
'\t') ||
286 while ((*s ==
' ') || (*s ==
'\t'))
288 while ((*s !=
' ') && (*s !=
'\t'))
326 "Warning: empty subcircuit %s referenced, ignored\n",
377 }
while (numpasses-- && gotone);
380 fprintf(
cp_err,
"Error: infinite subckt recursion\n");
static struct subs * subs
struct line * inp_deckcopy()
static struct line * doit()
struct wordlist * wl_prev
static wordlist * modnames
static void devmodtranslate()
static bool modtranslate()
struct wordlist * wl_next
static void finishLine |
( |
| ) |
|
|
static |
static void finishLine |
( |
char * |
dst, |
|
|
char * |
src, |
|
|
char * |
scname |
|
) |
| |
|
static |
Definition at line 508 of file subckt.c.
524 if (((*src !=
'v') && (*src !=
'V') &&
525 (*src !=
'i') && (*src !=
'I')) ||
527 lastwasalpha = isalpha(*src);
531 for (s = src + 1; *s && isspace(*s); s++)
533 if (!*s || (*s !=
'(')) {
534 lastwasalpha = isalpha(*src);
539 which = *dst++ = *src;
542 while (isspace(*src))
545 *src && !isspace(*src) && *src !=
',' && (*src !=
')'); i++) {
550 if ((which ==
'v') || (which ==
'V'))
564 if (buf[0] ==
'v' || buf[0] ==
'V') {
572 for (s = scname; *s; )
575 for (s = buf + i; *s; )
581 if ((which ==
'v') || (which ==
'V')) {
582 while (*src && (isspace(*src) || *src ==
',')) {
585 if (*src && *src !=
')') {
586 for (i = 0; *src && !isspace(*src) && (*src !=
')'); i++)
596 for (s = scname; *s; )
static char buf[MAXPROMPT]
static char* gettrans |
( |
| ) |
|
|
static |
static char* gettrans |
( |
char * |
name | ) |
|
|
static |
Definition at line 661 of file subckt.c.
671 return (
table[i].t_new);
static struct tab table[512]
struct line* inp_subcktexpand |
( |
struct line * |
deck | ) |
|
Definition at line 80 of file subckt.c.
104 for (s = c->
li_line; *s && (*s !=
'('); s++)
107 while (s[0] && (s[1] !=
')')) {
118 for (s = c->
li_line; *s && !isspace(*s); s++)
123 while (s[0] && (s[1] !=
')')) {
141 fprintf(
cp_err,
"Error: unknown subckt: %s\n",
bool cp_getvar(char *n, int t, char *r)
static struct line * doit()
static void looksubmod |
( |
| ) |
|
|
static |
static void looksubmod |
( |
char ** |
t, |
|
|
char * |
buffer, |
|
|
char * |
subname |
|
) |
| |
|
static |
Definition at line 838 of file subckt.c.
846 if (**
t ==
'\0')
return;
851 (void) sprintf(buffer + strlen(buffer),
"%s:%s ", subname, name);
856 (void) sprintf(buffer + strlen(buffer),
"%s ", name);
struct wordlist * wl_next
static bool modtranslate |
( |
| ) |
|
|
static |
static bool modtranslate |
( |
struct line * |
deck, |
|
|
char * |
subname |
|
) |
| |
|
static |
Definition at line 753 of file subckt.c.
759 char *buffer, *name, *
t;
769 buffer =
tmalloc(strlen(name) + strlen(t) +
770 strlen(subname) + 4);
771 (void) sprintf(buffer,
"%s ",name);
780 (void) sprintf(buffer + strlen(buffer),
"%s:%s ",
782 (void) strcat(buffer, t);
struct wordlist * wl_prev
static wordlist * modnames
struct wordlist * wl_next
static void numrefs |
( |
char * |
name, |
|
|
int * |
terms, |
|
|
int * |
devs |
|
) |
| |
|
static |
Definition at line 677 of file subckt.c.
688 while (*name && isspace(*name))
691 c = (isupper(*name) ? tolower(*name) : *name);
693 (void) strncpy(buf, name,
sizeof(buf));
699 while ((*s ==
' ') || (*s ==
'\t'))
701 while ((*s !=
' ') && (*s !=
'\t'))
710 fprintf(
cp_err,
"Error: no such subcircuit: %s\n", s);
719 if (isalpha(c) && n == 0 && *devs == 0)
720 fprintf(
cp_err,
"Warning: unknown device key: %c\n", c);
726 for (s = buf, i = 0; *s && (i < n); i++)
733 fprintf(
cp_err,
"Error: too few nodes for %s\n", name);
static char buf[MAXPROMPT]
static wordlist * modnames
struct wordlist * wl_next
static bool settrans |
( |
char * |
formal, |
|
|
char * |
actual, |
|
|
char * |
subname, |
|
|
char * |
instr |
|
) |
| |
|
static |
Definition at line 610 of file subckt.c.
621 fprintf(
cp_err,
"Error: too many params: %s\n", instr);
625 if (
eq(
table[i].t_new, subname))
628 fprintf(
cp_err,
"Error: too few params: %s\n", instr);
635 "Error: duplicate nodes given in subckt %s\n",subname);
static struct tab table[512]
static bool translate |
( |
| ) |
|
|
static |
static bool translate |
( |
struct line * |
deck, |
|
|
char * |
formal, |
|
|
char * |
actual, |
|
|
char * |
scname, |
|
|
char * |
subname, |
|
|
char * |
instr |
|
) |
| |
|
static |
Definition at line 402 of file subckt.c.
414 char *buffer, *name, *
s, *
t, ch;
415 int nnodes, ndevs, i;
419 if (
settrans(formal, actual, subname, instr)) {
427 if (ch ==
'.' || ch ==
'*' || ch ==
'\0')
432 tmpname = name =
gettok(&s);
445 (void) sprintf(buffer,
"%c:%s:%s ", ch, scname, name);
447 (
void) sprintf(buffer,
"%c:%s ", ch, scname);
451 while (nnodes-- > 0) {
461 (void) sprintf(buffer + strlen(buffer),
"%s ", t);
463 (
void) sprintf(buffer + strlen(buffer),
464 "%s:%s ", scname, name);
467 while (ndevs-- > 0) {
468 tmpname = name =
gettok(&s);
479 (void) sprintf(buffer + strlen(buffer),
480 "%c:%s:%s ", ch, scname, name);
482 (
void) sprintf(buffer + strlen(buffer),
483 "%c:%s ", ch, scname);
489 finishLine(buffer + strlen(buffer), s, scname);
495 for (i = 0; i < 512; i++) {
static struct tab table[512]