Found a more efficient construct for M0-macro.c

This commit is contained in:
Jeremiah Orians 2016-09-06 21:19:32 -04:00
parent c67f062bcc
commit 6361f1127f
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
1 changed files with 6 additions and 5 deletions

View File

@ -156,8 +156,9 @@ void identify_macros(struct Token* p)
if(0 == strncmp(p->Text, "DEFINE", max_string)) if(0 == strncmp(p->Text, "DEFINE", max_string))
{ {
p->type = macro; p->type = macro;
p->next->type = macro; p->Text = p->next->Text;
p->next->next->type = macro; p->Expression = p->next->next->Text;
p->next = p->next->next->next;
} }
if(NULL != p->next) if(NULL != p->next)
@ -168,9 +169,9 @@ void identify_macros(struct Token* p)
void line_macro(struct Token* p) void line_macro(struct Token* p)
{ {
if(0 == strncmp(p->Text, "DEFINE", max_string)) if(p->type & macro)
{ {
setExpression(p, p->next->Text, p->next->next->Text); setExpression(p->next, p->Text, p->Expression);
} }
if(NULL != p->next) if(NULL != p->next)
@ -271,7 +272,7 @@ void eval_immediates(struct Token* p)
void print_hex(struct Token* p) void print_hex(struct Token* p)
{ {
if(NULL != p->Expression) if(p->type ^ macro)
{ {
fprintf(stdout, "\n%s", p->Expression); fprintf(stdout, "\n%s", p->Expression);
} }