From c9786b6c1b5b5f0f95f59c10c00b2dda71f15fd3 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sat, 11 Aug 2012 14:39:00 +1000 Subject: [PATCH] add some context dependent functions to the API --- imext.c | 8 +++++++- imext.h | 9 +++++++++ imexttypes.h | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/imext.c b/imext.c index e2e18770..245d5f28 100644 --- a/imext.c +++ b/imext.c @@ -154,7 +154,13 @@ im_ext_funcs imager_function_table = io_slurp, io_glue_destroy, - get_context + /* level 8 */ + get_context, + im_push_errorf, + im_lhead, + im_loog, + im_context_refinc, + im_context_refdec }; /* in general these functions aren't called by Imager internally, but diff --git a/imext.h b/imext.h index 35072ebe..3f08bd99 100644 --- a/imext.h +++ b/imext.h @@ -31,6 +31,8 @@ extern im_ext_funcs *imager_function_ext_table; #define im_extt imager_function_ext_table #define im_get_context() ((im_extt->f_im_get_context)()) +#define im_context_refinc(ctx, where) ((im_extt->f_im_context_refinc)((ctx), (where))) +#define im_context_refdec(ctx, where) ((im_extt->f_im_context_refdec)((ctx), (where))) #ifdef IMAGER_DEBUG_MALLOC @@ -175,6 +177,8 @@ extern im_ext_funcs *imager_function_ext_table; #define i_img_get_height(img) ((im_extt->f_i_img_get_height)(img)) #define i_lhead(file, line) ((im_extt->f_i_lhead)((file), (line))) #define i_loog (im_extt->f_i_loog) +#define im_lhead(ctx, file, line) ((im_extt->f_im_lhead)((ctx), (file), (line))) +#define im_loog (im_extt->f_im_loog) #define im_img_alloc(ctx) ((im_extt->f_im_img_alloc)(ctx)) #define im_img_init(ctx, img) ((im_extt->fm_i_img_init)((ctx), (img))) @@ -223,8 +227,13 @@ extern im_ext_funcs *imager_function_ext_table; #define io_slurp(ig, datap) ((im_extt->f_io_slurp)((ig), (datap))) #define io_glue_destroy(ig) ((im_extt->f_io_glue_destroy)(ig)) +#define im_push_errorf (im_extt->f_im_push_errorf) + #ifdef IMAGER_LOG +#ifndef IMAGER_NO_CONTEXT #define mm_log(x) { i_lhead(__FILE__,__LINE__); i_loog x; } +#endif +#define im_log(x) { im_lhead(aIMCTX, __FILE__,__LINE__); im_loog x; } #else #define mm_log(x) #endif diff --git a/imexttypes.h b/imexttypes.h index 3613a7ae..8329f1e9 100644 --- a/imexttypes.h +++ b/imexttypes.h @@ -221,6 +221,12 @@ typedef struct { /* IMAGER_API_LEVEL 8 functions will be added here */ im_context_t (*f_im_get_context)(void); + + void (*f_im_push_errorf)(im_context_t , int code, char const *fmt, ...); + void (*f_im_lhead)( im_context_t, const char *file, int line ); + void (*f_im_loog)(im_context_t, int level,const char *msg, ... ) I_FORMAT_ATTR(3,4); + void (*f_im_context_refinc)(im_context_t, const char *where); + void (*f_im_context_refdec)(im_context_t, const char *where); } im_ext_funcs; #define PERL_FUNCTION_TABLE_NAME "Imager::__ext_func_table" -- 2.39.2