gnupic: Re: [gnupic] Question about macros in gpasm
Subject:
Re: [gnupic] Question about macros in gpasm
From:
David Willmore ####@####.####
Date:
11 Feb 2005 06:12:34 +0000
Message-Id: <200502110612.j1B6CVFQ007693@localhost.localdomain>
> Add a feature request on sourceforge. Someday I might get to it. I
> doubt it will be anytime soon.
Craig,
I took a swing at doing part of it and got it working with very
few changes. It implements the "don't print EXPAND" line part.
*** gpasm.h 2005-02-11 00:34:44.410632946 -0500
--- /usr/src/util/gputils-0.13.0_beta/gpasm/gpasm.h 2005-01-02 19:25:05.000000000 -0500
***************
*** 170,176 ****
char startdate[80]; /* When assembly started */
gp_boolean enabled; /* listing is enabled */
gp_boolean expand; /* macro listings are expanded */
+ gp_boolean new_expand; /* expand just turned on this line, don't expand this line */
gp_boolean force; /* ignoring nolist directives */
int config_address; /* list config address for 16 bit devices */
char title_name[80]; /* given in TITLE directive */
--- 170,175 ----
*** directive.c 2005-02-11 00:37:19.711996186 -0500
--- /usr/src/util/gputils-0.13.0_beta/gpasm/directive.c 2005-01-02 19:26:40.000000000 -0500
***************
*** 1310,1320 ****
{
state.lst.line.linetype = dir;
if (state.cmd_line.macro_expand) {
gpmessage(GPM_SUPLIN, NULL);
} else {
if (enforce_arity(arity, 0)) {
state.lst.expand = true;
+ state.lst.new_expand = true;
}
}
return r;
--- 1310,1319 ----
{
state.lst.line.linetype = dir;
if (state.cmd_line.macro_expand) {
gpmessage(GPM_SUPLIN, NULL);
} else {
if (enforce_arity(arity, 0)) {
state.lst.expand = true;
}
}
return r;
*** lst.c 2005-02-11 00:46:31.463524713 -0500
--- /usr/src/util/gputils-0.13.0_beta/gpasm/lst.c 2005-01-02 19:25:00.000000000 -0500
***************
*** 81,87 ****
if (!state.cmd_line.macro_expand){
state.lst.expand = true;
}
+ state.lst.new_expand = false;
if (state.cmd_line.lst_force)
state.lst.force = true;
--- 81,86 ----
*** parse.c 2005-02-11 01:00:33.507054155 -0500
--- /usr/src/util/gputils-0.13.0_beta/gpasm/parse.c 2005-01-02 20:02:28.000000000 -0500
***************
*** 306,318 ****
state.mac_body->src_line = strdup(state.src->lst.m->src_line);
}
! if (((state.src->type == src_while) ||
! (state.lst.expand && !state.lst.new_expand)) &&
(state.pass == 2)) {
assert(state.src->lst.m->src_line != NULL);
lst_format_line(state.src->lst.m->src_line, value);
}
+ state.lst.new_expand = false;
if (state.src->lst.m->next) {
state.src->lst.m = state.src->lst.m->next;
--- 306,316 ----
state.mac_body->src_line = strdup(state.src->lst.m->src_line);
}
! if (((state.src->type == src_while) || (state.lst.expand)) &&
(state.pass == 2)) {
assert(state.src->lst.m->src_line != NULL);
lst_format_line(state.src->lst.m->src_line, value);
}
if (state.src->lst.m->next) {
state.src->lst.m = state.src->lst.m->next;
Fairly simple. I don't know much about the parser, so the other
half of showing substituted literal values. I'll try to look.
Cheers,
David