From d36470bcebf57644464754f5ef045a4f8d057c2b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 24 Dec 2014 17:22:49 +0000 Subject: Structure for callback mechanism --- src/sc_interp.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'src/sc_interp.c') diff --git a/src/sc_interp.c b/src/sc_interp.c index 703b73f..bed8fa2 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -60,6 +60,7 @@ struct sc_state struct macro *macros; /* Contents need to be copied on push */ SCBlock *macro_contents; + SCBlock *macro_real_block; }; @@ -77,6 +78,32 @@ struct _scinterp }; +SCCallbackList *sc_callback_list_new() +{ +} + + +void sc_callback_list_free(SCCallbackList *cbl) +{ +} + + +void sc_callback_list_add_callback(SCCallbackList *cbl, const char *name, + cairo_surface_t *(*func)(SCBlock *bl, void *p)) +{ +} + + +void sc_interp_set_callbacks(SCInterpreter *scin, SCCallbackList *cbl) +{ +} + + +static void do_callback(SCInterpreter *scin, const char *name) +{ +} + + PangoFont *sc_interp_get_font(SCInterpreter *scin) { struct sc_state *st = &scin->state[scin->j]; @@ -331,6 +358,13 @@ struct frame *sc_interp_get_frame(SCInterpreter *scin) } +SCBlock *sc_interp_get_macro_real_block(SCInterpreter *scin) +{ + struct sc_state *st = &scin->state[scin->j]; + return st->macro_real_block; +} + + static void set_frame(SCInterpreter *scin, struct frame *fr) { struct sc_state *st = &scin->state[scin->j]; @@ -705,6 +739,7 @@ static void exec_macro(SCBlock *bl, SCInterpreter *scin, SCBlock *child) struct sc_state *st = &scin->state[scin->j]; st->macro_contents = child; + st->macro_real_block = bl; mchild = sc_block_macro_child(bl); if ( mchild == NULL ) { @@ -801,7 +836,8 @@ int sc_interp_add_blocks(SCInterpreter *scin, SCBlock *bl) } else if ( strcmp(name, "bggradv") == 0 ) { set_frame_bggrad(sc_interp_get_frame(scin), options, GRAD_VERT); - + } else if ( strcmp(name, "callback") == 0 ) { + do_callback(scin, options); } else { -- cgit v1.2.3