Skip to content

Commit

Permalink
Change PCEAS to allow "/* */" comments in macro parameters, and change
Browse files Browse the repository at this point in the history
HuCC's symbol output to use that for displaying global-to-local names.
  • Loading branch information
jbrandwood committed Oct 3, 2024
1 parent 8e76ec3 commit e196ad3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/hucc/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,9 @@ void outsymbol (SYMBOL *ptr)
outstr(ptr->name);
}
if (ptr->linked) {
outstr(" ; ");
outstr(" /* ");
outstr(ptr->linked->name);
outstr(" */");
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/mkit/as/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,10 @@ do_kickc(int *ip)
/* enable forward-references when building KickC code */
asm_opt[OPT_FORWARD] |= kickc_mode;

/* disable C comments in HuCC code, it breaks HuCC's macro comments */
if (hucc_mode)
asm_opt[OPT_CCOMMENT] = 0;

/* output line */
if (pass == LAST_PASS)
println();
Expand Down
17 changes: 15 additions & 2 deletions src/mkit/as/macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,19 @@ macro_getargs(int ip)
f = 0;
level = 0;
while (c) {
if (c == '/' && prlnbuf[ip] == '*') {
++ip;
do {
c = prlnbuf[ip++];
if (c == '\0') {
error("Macro argument comment cannot span multiple lines!");
return (0);
}
} while (c != '*' && prlnbuf[ip] != '/');
++ip;
c = prlnbuf[ip++];
continue;
}
if (c == ',') {
if (level == 0)
break;
Expand Down Expand Up @@ -296,8 +309,8 @@ macro_getargs(int ip)
else {
ptr[i++] = c;
}
if (i == 80) {
error("Macro argument string too long, max. 80 characters!");
if (i == 255) {
error("Macro argument string too long, max. 255 characters!");
return (0);
}
j++;
Expand Down

0 comments on commit e196ad3

Please sign in to comment.