Added substitution for commas in SPICE output, because commas in

instance names and node names are basically fatal to running
ngspice.
This commit is contained in:
Tim Edwards
2019-10-14 21:46:07 -04:00
parent 57a5ff6094
commit e9f3dcadef
4 changed files with 43 additions and 15 deletions
+3 -1
View File
@@ -209,8 +209,10 @@ EFArgs(argc, argv, err_result, argsProc, cdata)
goto usage;
if (strchr(cp, '!')) EFTrimFlags |= EF_TRIMGLOB;
if (strchr(cp, '#')) EFTrimFlags |= EF_TRIMLOCAL;
if (strchr(cp, ',')) EFTrimFlags |= EF_CONVERTCOMMAS;
if (strchr(cp, ',')) EFTrimFlags |= EF_CONVERTCOMMA;
if (strchr(cp, '=')) EFTrimFlags |= EF_CONVERTEQUAL;
if (strchr(cp, '[')) EFTrimFlags |= EF_CONVERTBRACKETS;
if (strchr(cp, ']')) EFTrimFlags |= EF_CONVERTBRACKETS;
break;
case 'C':
EFCapThreshold = (EFCapValue)INFINITE_THRESHOLD_F;
+10 -4
View File
@@ -859,7 +859,7 @@ EFHNOut(hierName, outf)
HierName *hierName;
FILE *outf;
{
bool trimGlob, trimLocal, trimComma;
bool trimGlob, trimLocal, convComma, convBrackets;
char *cp, c;
if (hierName->hn_parent) efHNOutPrefix(hierName->hn_parent, outf);
@@ -868,13 +868,19 @@ EFHNOut(hierName, outf)
cp = hierName->hn_name;
trimGlob = (EFTrimFlags & EF_TRIMGLOB);
trimLocal = (EFTrimFlags & EF_TRIMLOCAL);
trimComma = (EFTrimFlags & EF_CONVERTCOMMAS);
convComma = (EFTrimFlags & EF_CONVERTCOMMA);
convBrackets = (EFTrimFlags & EF_CONVERTBRACKETS);
while (c = *cp++)
{
if (*cp)
{
if (trimComma && (c == ','))
putc(';', outf);
if (c == ',')
{
if (convComma)
putc('|', outf);
}
else if (convBrackets && ((c == '[') || (c == ']')))
putc('_', outf);
else
putc(c, outf);
}
+3 -2
View File
@@ -40,8 +40,9 @@ typedef unsigned char U_char;
/* Flags to control output of node names. Stored in EFTrimFlags */
#define EF_TRIMGLOB 0x01 /* Delete trailing '!' from names */
#define EF_TRIMLOCAL 0x02 /* Delete trailing '#' from names */
#define EF_CONVERTCOMMAS 0x04 /* Change ',' to ';' in names */
#define EF_CONVERTEQUAL 0x08 /* Change '=' to ':' in names */
#define EF_CONVERTCOMMA 0x04 /* Change ',' to '|' in names, else remove */
#define EF_CONVERTEQUAL 0x08 /* Change '=' to ':' in names, else remove */
#define EF_CONVERTBRACKETS 0x10 /* Change '[' and ']' to '_' in names */
/*
* capacitance type now set to float