mirror of
https://github.com/open-simh/simtools.git
synced 2026-02-26 16:54:31 +00:00
Prepare for macros being defined in "other ways" which are not yet put in the macro definition table.
This commit is contained in:
@@ -632,7 +632,7 @@ static int assemble(
|
||||
|
||||
saveline = stmtno;
|
||||
list_level = -1;
|
||||
mac = defmacro(maccp, &macstack, TRUE);
|
||||
mac = defmacro(maccp, &macstack, CALLED_NOLIST);
|
||||
if (mac == NULL) {
|
||||
report(stack->top, "Failed to define macro " "called %s\n", label);
|
||||
}
|
||||
@@ -652,7 +652,7 @@ static int assemble(
|
||||
|
||||
case P_MACRO:
|
||||
{
|
||||
MACRO *mac = defmacro(cp, stack, FALSE);
|
||||
MACRO *mac = defmacro(cp, stack, CALLED_NORMAL);
|
||||
|
||||
return mac != NULL;
|
||||
}
|
||||
|
||||
23
macros.c
23
macros.c
@@ -91,7 +91,8 @@ void read_body(
|
||||
break;
|
||||
}
|
||||
|
||||
if (!called && (list_level - 1 + list_md) > 0) {
|
||||
if (!(called & CALLED_NOLIST) &&
|
||||
(list_level - 1 + list_md) > 0) {
|
||||
list_flush();
|
||||
list_source(stack->top, nextline);
|
||||
}
|
||||
@@ -185,17 +186,21 @@ MACRO *defmacro(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allow redefinition of a macro; new definition replaces the old. */
|
||||
mac = (MACRO *) lookup_sym(label, ¯o_st);
|
||||
if (mac) {
|
||||
/* Remove from the symbol table... */
|
||||
remove_sym(&mac->sym, ¯o_st);
|
||||
free_macro(mac);
|
||||
if (!(called & CALLED_NODEFINE)) {
|
||||
/* Allow redefinition of a macro; new definition replaces the old. */
|
||||
mac = (MACRO *) lookup_sym(label, ¯o_st);
|
||||
if (mac) {
|
||||
/* Remove from the symbol table... */
|
||||
remove_sym(&mac->sym, ¯o_st);
|
||||
free_macro(mac);
|
||||
}
|
||||
}
|
||||
|
||||
mac = new_macro(label);
|
||||
|
||||
add_table(&mac->sym, ¯o_st);
|
||||
if (!(called & CALLED_NODEFINE)) {
|
||||
add_table(&mac->sym, ¯o_st);
|
||||
}
|
||||
|
||||
argtail = &mac->args;
|
||||
cp = skipdelim(cp);
|
||||
@@ -245,7 +250,7 @@ MACRO *defmacro(
|
||||
|
||||
gb = new_buffer();
|
||||
|
||||
if (!called && !list_md) {
|
||||
if (!(called & CALLED_NOLIST) && !list_md) {
|
||||
list_level--;
|
||||
levelmod = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user