From a2ef3f8b5c1504d33f300ef6b14625ccf199ed98 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 6 Jul 2018 22:53:59 +0200 Subject: Expose sc_interp_run_style() --- src/frame.c | 1 + src/sc_interp.c | 10 ++++++---- src/sc_interp.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/frame.c b/src/frame.c index 785ec7b..c7c1b2f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -573,6 +573,7 @@ double total_height(struct frame *fr) Paragraph *last_para(struct frame *fr) { + if ( fr == NULL ) return NULL; if ( fr->paras == NULL ) return NULL; return fr->paras[fr->n_paras-1]; } diff --git a/src/sc_interp.c b/src/sc_interp.c index 3b7d913..20593a1 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -763,6 +763,8 @@ static void set_padding(struct frame *fr, const char *opts) if ( parse_tuple(opts, p) ) return; + if ( fr == NULL ) return; + fr->pad_l = p[0]; fr->pad_r = p[1]; fr->pad_t = p[2]; @@ -1083,7 +1085,7 @@ static int add_text(struct frame *fr, PangoContext *pc, SCBlock *bl, } -static void run_style(SCInterpreter *scin, const char *sname) +void sc_interp_run_style(SCInterpreter *scin, const char *sname) { int i; struct sc_state *st = &scin->state[scin->j]; @@ -1148,7 +1150,7 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin) maybe_recurse_before(scin, child); set_frame(scin, fr); - run_style(scin, "frame"); + sc_interp_run_style(scin, "frame"); maybe_recurse_after(scin, child); } else if ( strcmp(name, "newpara")==0 ) { @@ -1256,7 +1258,7 @@ int sc_interp_add_block(SCInterpreter *scin, SCBlock *bl) } else if ( strcmp(name, "presentation") == 0 ) { maybe_recurse_before(scin, child); - run_style(scin, "narrative"); + sc_interp_run_style(scin, "narrative"); maybe_recurse_after(scin, child); } else if ( strcmp(name, "stylesheet") == 0 ) { @@ -1264,7 +1266,7 @@ int sc_interp_add_block(SCInterpreter *scin, SCBlock *bl) } else if ( strcmp(name, "slide") == 0 ) { maybe_recurse_before(scin, child); - run_style(scin, "slide"); + sc_interp_run_style(scin, "slide"); maybe_recurse_after(scin, child); } else if ( strcmp(name, "font") == 0 ) { diff --git a/src/sc_interp.h b/src/sc_interp.h index 4316468..f71148d 100644 --- a/src/sc_interp.h +++ b/src/sc_interp.h @@ -53,6 +53,7 @@ extern int sc_interp_add_blocks(SCInterpreter *scin, SCBlock *bl); extern int sc_interp_add_block(SCInterpreter *scin, SCBlock *bl); extern void sc_interp_run_stylesheet(SCInterpreter *scin, SCBlock *bl); +extern void sc_interp_run_style(SCInterpreter *scin, const char *sname); extern void add_macro(SCInterpreter *scin, const char *mname, const char *contents); -- cgit v1.2.3