replace syntax from inst#devtype to :devtype:inst

This commit is contained in:
Florian Ballenegger 2020-10-02 16:54:09 +02:00
parent 7d43da8ff6
commit eb0123d9a2
2 changed files with 41 additions and 12 deletions

View File

@ -51,9 +51,6 @@ Author: 1985 Wayne A. Christopher
/* gtri - end - 12/12/90 */
#endif
#ifdef WITH_LOOPANA
int INP2gentype(char* line);
#endif
/* SJB - Uncomment this line for debug tracing */
/*#define TRACE*/
@ -4707,7 +4704,7 @@ static void inp_compat(struct card *card)
continue;
#ifdef WITH_LOOPANA
if (INP2gentype(curr_line))
if (*curr_line == ':')
continue;
#endif
@ -5780,10 +5777,6 @@ static void inp_bsource_compat(struct card *card)
else if (skip_control > 0) {
continue;
}
#ifdef WITH_LOOPANA
else if (INP2gentype(curr_line))
continue;
#endif
if (*curr_line == 'b') {
/* remove white spaces of everything inside {}*/
@ -8303,14 +8296,14 @@ static void inp_check_syntax(struct card *deck)
if (*cut_line == '*' || *cut_line == '\0')
continue;
// check for unusable leading characters and change them to '*'
if (strchr("=[]?()&%$§\"!:,", *cut_line)) {
if (strchr("=[]?()&%$§\"!,", *cut_line)) {
if (ft_stricterror) {
fprintf(stderr, "Error: '%c' is not allowed as first character in line %s.\n", *cut_line, cut_line);
controlled_exit(EXIT_BAD);
}
else {
if (!check_ch) {
fprintf(stderr, "Warning: Unusal leading characters like '%c' or others out of '= [] ? () & %%$§\"!:,'\n", *cut_line);
fprintf(stderr, "Warning: Unusal leading characters like '%c' or others out of '= [] ? () & %%$§\"!,'\n", *cut_line);
fprintf(stderr, " in netlist or included files, will be replaced with '*'\n");
check_ch = 1; /* just one warning */
}

View File

@ -956,6 +956,21 @@ translate_inst_name(struct bxx_buffer *buffer, const char *scname, const char *n
if (!name_e)
name_e = strchr(name, '\0');
#ifdef WITH_LOOPANA
if(*name==':') {
/* :devtype:instance -> :devtype:.x1.instname */
/* skip to next : */
while(name<name_e && *name) {
bxx_putc(buffer, *(name++));
if(*name==':') {
name++;
break;
}
}
bxx_putc(buffer, ':');
bxx_putc(buffer, '.');
} else
#endif
if (tolower_c(*name) != 'x') {
bxx_putc(buffer, *name);
bxx_putc(buffer, '.');
@ -1451,7 +1466,26 @@ numnodes(const char *line, struct subs *subs, wordlist const *modnames)
return (nodes);
}
}
#ifdef WITH_LOOPANA
if (c == ':') {
/* handle :devtype:instance syntax here */
int len, type;
for(len=1;line[len];len++)
if(line[len]==':')
break;
/* look if find this device */
for (type = 0; type < ft_sim->numDevices; type++) {
if(ft_sim->devices[type])
if(strlen(ft_sim->devices[type]->name)==(len-1))
if(strncasecmp(line+1, ft_sim->devices[type]->name, len-1)==0)
break;
}
if(type<ft_sim->numDevices)
n = *(ft_sim->devices[type]->terms);
else
n = 0;
} else
#endif
n = inp_numnodes(c);
/* Added this code for variable number of nodes on certain devices. */
@ -1948,6 +1982,8 @@ devmodtranslate(struct card *s, char *subname, wordlist * const orig_modnames)
}
static int inp_numnode_fromdev(const char* line);
/*----------------------------------------------------------------------*
* inp_numnodes returns the maximum number of nodes (netnames) attached
* to the component.
@ -1968,7 +2004,7 @@ inp_numnodes(char c)
case '*':
case '$':
return (0);
case 'b':
return (2);
case 'c':