mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-26 12:11:47 +00:00
Add ^pl and ^ph expressions from 2.11BSD's m11.
I hope I understood what this is doing!
This commit is contained in:
36
parse.c
36
parse.c
@@ -755,6 +755,42 @@ EX_TREE *parse_unary(
|
||||
tp = new_ex_lit(flt[0]);
|
||||
tp->cp = endcp;
|
||||
}
|
||||
return tp;
|
||||
}
|
||||
case 'p':
|
||||
/* psect limits, low or high */ {
|
||||
char bound = tolower((unsigned char)cp[2]);
|
||||
char *cp2 = skipwhite(cp + 3);
|
||||
int islocal = 0;
|
||||
char *endcp;
|
||||
char *psectname = get_symbol(cp2, &endcp, &islocal);
|
||||
SYMBOL *sectsym = lookup_sym(psectname, §ion_st);
|
||||
|
||||
if (sectsym && !islocal) {
|
||||
SECTION *psect = sectsym->section;
|
||||
|
||||
tp = new_ex_tree();
|
||||
tp->type = EX_SYM;
|
||||
tp->data.symbol = sectsym;
|
||||
tp->cp = cp;
|
||||
|
||||
if (bound == 'l') {
|
||||
; /* that's it */
|
||||
} else if (bound == 'h') {
|
||||
EX_TREE *rightp = new_ex_lit(psect->size);
|
||||
tp = new_ex_bin(EX_ADD, tp, rightp);
|
||||
} else {
|
||||
tp = ex_err(tp, endcp);
|
||||
/* report(stack->top, "^p: %c not recognized", bound); */
|
||||
}
|
||||
} else {
|
||||
/* report(stack->top, "psect name %s not found"); */
|
||||
tp = ex_err(new_ex_lit(0), endcp);
|
||||
}
|
||||
free(psectname);
|
||||
tp->cp = endcp;
|
||||
cp = endcp;
|
||||
|
||||
return tp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user