Merge branch 'master' into netgen-1.5

This commit is contained in:
Tim Edwards 2020-07-02 03:00:09 -04:00
commit d73b711e3a
4 changed files with 48 additions and 6 deletions

View File

@ -1 +1 @@
1.5.148 1.5.149

View File

@ -289,6 +289,7 @@ int GetNextLineNoNewline(char *delimiter)
char *newbuf; char *newbuf;
int testc; int testc;
int nested = 0; int nested = 0;
int llen;
if (feof(infile)) return -1; if (feof(infile)) return -1;
@ -306,12 +307,25 @@ int GetNextLineNoNewline(char *delimiter)
linetok = (char *)MALLOC(linesize + 1); linetok = (char *)MALLOC(linesize + 1);
} }
fgets(line, linesize, infile); fgets(line, linesize, infile);
while (strlen(line) == linesize - 1) { /* Immediately resolve backslash-EOL */
llen = strlen(line);
while ((llen > 1) && (llen < linesize - 1) && *(line + llen - 2) == '\\') {
*(line + llen - 2) = '\n';
fgets(line + llen - 1, linesize - llen + 1, infile);
llen = strlen(line);
}
while (llen == linesize - 1) {
newbuf = (char *)MALLOC(linesize + 501); newbuf = (char *)MALLOC(linesize + 501);
strcpy(newbuf, line); strcpy(newbuf, line);
FREE(line); FREE(line);
line = newbuf; line = newbuf;
fgets(line + linesize - 1, 501, infile); fgets(line + linesize - 1, 501, infile);
llen = strlen(line);
while ((llen > 1) && (llen < linesize - 1) && *(line + llen - 2) == '\\') {
*(line + llen - 2) = '\n';
fgets(line + llen - 1, linesize - llen + 1, infile);
llen = strlen(line);
}
linesize += 500; linesize += 500;
FREE(linetok); FREE(linetok);
linetok = (char *)MALLOC(linesize + 1); linetok = (char *)MALLOC(linesize + 1);
@ -329,7 +343,7 @@ int GetNextLineNoNewline(char *delimiter)
for (s = line; *s != '\0'; s++) { for (s = line; *s != '\0'; s++) {
if (*s == '`') { if (*s == '`') {
w = s + 1; w = s + 1;
while (isalnum(*w)) w++; while (isalnum(*w) || (*w == '_') || (*w == '$')) w++;
e = *w; e = *w;
*w = '\0'; *w = '\0';
kl = (struct property *)HashLookup(s + 1, definitions); kl = (struct property *)HashLookup(s + 1, definitions);
@ -365,7 +379,7 @@ int GetNextLineNoNewline(char *delimiter)
for (s = line; *s != '\0'; s++) { for (s = line; *s != '\0'; s++) {
if (*s == '`') { if (*s == '`') {
w = s + 1; w = s + 1;
while (isalnum(*w)) w++; while (isalnum(*w) || (*w == '_') || (*w == '$')) w++;
e = *w; e = *w;
*w = '\0'; *w = '\0';
kl = (struct property *)HashLookup(s + 1, definitions); kl = (struct property *)HashLookup(s + 1, definitions);
@ -496,6 +510,24 @@ void GetNextLine(char *delimiter)
} while (nexttok == NULL); } while (nexttok == NULL);
} }
/*----------------------------------------------------------------------*/
/* Return a pointer to the line at the position of nexttok */
/* This is used only when returning the entire line, untokenized, and */
/* is only called by the verilog read routine when reading the value of */
/* a `define statement. */
/*----------------------------------------------------------------------*/
char *GetLineAtTok()
{
char *lpos;
if (nexttok == NULL) return NULL;
if (line == NULL) return NULL;
lpos = strstr(line, nexttok);
return lpos;
}
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/* if nexttok is already NULL, force scanner to read new line */ /* if nexttok is already NULL, force scanner to read new line */
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/

View File

@ -31,6 +31,7 @@ extern struct hashdict *definitions;
extern char *nexttok; extern char *nexttok;
#define SKIPTO(a) do {SkipTok(NULL);} while (!match(nexttok,a)) #define SKIPTO(a) do {SkipTok(NULL);} while (!match(nexttok,a))
extern char *strdtok(char *pstring, char *delim1, char *delim2); extern char *strdtok(char *pstring, char *delim1, char *delim2);
extern char *GetLineAtTok();
extern void SkipTok(char *delimiter); extern void SkipTok(char *delimiter);
extern void SkipTokNoNewline(char *delimiter); extern void SkipTokNoNewline(char *delimiter);
extern void SkipTokComments(char *delimiter); extern void SkipTokComments(char *delimiter);

View File

@ -1115,10 +1115,17 @@ skip_endmodule:
kl->slop.dval = 0.01; // One percent default kl->slop.dval = 0.01; // One percent default
} }
else { else {
/* Treat the parameter as a string */ char *toks;
/* Treat the parameter as a string; BUT pull everything to */
/* EOL, not just the current token. */
toks = GetLineAtTok();
kl->type = PROP_STRING; kl->type = PROP_STRING;
kl->pdefault.string = strsave(nexttok); kl->pdefault.string = strsave(toks);
kl->slop.dval = 0.0; kl->slop.dval = 0.0;
SkipNewLine(VLOG_DELIMITERS);
} }
if (kl) HashPtrInstall(kl->key, kl, &verilogdefs); if (kl) HashPtrInstall(kl->key, kl, &verilogdefs);
} }
@ -1218,9 +1225,11 @@ skip_endmodule:
lhs = LookupObject(nodename, CurrentCell); lhs = LookupObject(nodename, CurrentCell);
*aptr = '['; *aptr = '[';
} }
else strcpy(noderoot, nexttok);
} }
else { else {
lhs = LookupObject(nexttok, CurrentCell); lhs = LookupObject(nexttok, CurrentCell);
strcpy(noderoot, nexttok);
} }
SkipTokComments(VLOG_DELIMITERS); SkipTokComments(VLOG_DELIMITERS);
if (lhs && ((!nexttok) || (!match(nexttok, "=")))) { if (lhs && ((!nexttok) || (!match(nexttok, "=")))) {