diff options
author | Thomas White <taw@bitwiz.org.uk> | 2014-09-11 23:53:24 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2014-09-11 23:53:24 +0200 |
commit | 28026ebf0fde1eb1b51f3808b4f3fc681039e887 (patch) | |
tree | 76cfe260aa428894bf358c59385251865060408c /src/sc_interp.c | |
parent | 71e298fd373d5afea429b88f83b8be677e1e2c83 (diff) |
Fix \slidenumber
Diffstat (limited to 'src/sc_interp.c')
-rw-r--r-- | src/sc_interp.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/sc_interp.c b/src/sc_interp.c index e6f5680..541c259 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -704,16 +704,6 @@ int sc_interp_add_blocks(SCInterpreter *scin, SCBlock *bl) } -static int add_macro(struct macro *m, char *mname, SCBlock *bl) -{ - m->name = mname; - m->bl = bl; - m->prev = NULL; /* FIXME: Stacking */ - - return 0; -} - - static int try_add_macro(SCInterpreter *scin, const char *options, SCBlock *bl) { struct sc_state *st = &scin->state[scin->j]; @@ -729,7 +719,10 @@ static int try_add_macro(SCInterpreter *scin, const char *options, SCBlock *bl) for ( i=0; i<st->n_macros; i++ ) { if ( strcmp(st->macros[i].name, nn) == 0 ) { - return add_macro(&st->macros[i], nn, bl); + st->macros[i].name = nn; + st->macros[i].bl = bl; + st->macros[i].prev = NULL; /* FIXME: Stacking */ + return 0; } } @@ -750,7 +743,19 @@ static int try_add_macro(SCInterpreter *scin, const char *options, SCBlock *bl) } i = st->n_macros++; - return add_macro(&st->macros[i], nn, bl); + + st->macros[i].name = nn; + st->macros[i].bl = bl; + st->macros[i].prev = NULL; /* FIXME: Stacking */ + + return 0; +} + + +void add_macro(SCInterpreter *scin, const char *mname, const char *contents) +{ + SCBlock *bl = sc_parse(contents); + try_add_macro(scin, mname, bl); } |