Skip to content

Commit

Permalink
Null MAIN.PORTLISTs no longer produce extraneous comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipCPU committed May 22, 2020
1 parent d296bb0 commit 368481d
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions sw/autofpga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,18 @@ void build_toplevel_v( MAPDHASH &master, FILE *fp, STRING &fname) {
if (!strp)
continue;

STRING tmps(*strp);
STRING::iterator si;
for(si=tmps.end()-1; si>=tmps.begin(); si--) {
if (isspace(*si))
*si = '\0';
else
break;
} if (tmps.size() == 0)
continue;
if (!first)
fprintf(fp, ",\n");
first=0;
STRING tmps(*strp);
while(isspace(*tmps.rbegin()))
*tmps.rbegin() = '\0';
fprintf(fp, "%s", tmps.c_str());
} fprintf(fp, ");\n");

Expand Down Expand Up @@ -748,12 +754,19 @@ void build_main_v( MAPDHASH &master, FILE *fp, STRING &fname) {
STRINGP strp = getstring(*kvpair->second.u.m_m, str);
if (!strp)
continue;

STRING tmps(*strp);
STRING::iterator si;
for(si=tmps.end()-1; si>=tmps.begin(); si--) {
if (isspace(*si))
*si = '\0';
else
break;
} if (tmps.size() == 0)
continue;
if (!first)
fprintf(fp, ",\n");
first=0;
STRING tmps(*strp);
while(isspace(*tmps.rbegin()))
*tmps.rbegin() = '\0';
fprintf(fp, "%s", tmps.c_str());
} fprintf(fp, ");\n");

Expand Down

0 comments on commit 368481d

Please sign in to comment.