]> git.imager.perl.org - imager.git/commitdiff
add some context dependent functions to the API
authorTony Cook <tony@develop-help.com>
Sat, 11 Aug 2012 04:39:00 +0000 (14:39 +1000)
committerTony Cook <tony@develop-help.com>
Sat, 24 Nov 2012 03:59:24 +0000 (14:59 +1100)
imext.c
imext.h
imexttypes.h

diff --git a/imext.c b/imext.c
index e2e1877027c3d4edaec2d96d3d8b02664d991789..245d5f28a4cc2b670bb0396a258906675c94ba28 100644 (file)
--- 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 35072ebe52e24c9d42e7fa9191dfb751da6acf3d..3f08bd99f056a31ff36ed1ef79e536ebe0b111c5 100644 (file)
--- 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
index 3613a7aeeb29dcec406a2a1eff9e59c7f826a4b6..8329f1e95b62472891e75d58b81d72103574ddd6 100644 (file)
@@ -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"