]> git.imager.perl.org - imager.git/blob - imextpl.h
better validate numeric hatch values for fills
[imager.git] / imextpl.h
1 #ifndef IMAGER_IMEXTPL_H_
2 #define IMAGER_IMEXTPL_H_
3
4 #include "imextpltypes.h"
5 #include "immacros.h"
6
7 extern im_pl_ext_funcs *imager_perl_function_ext_table;
8
9 #define DEFINE_IMAGER_PERL_CALLBACKS im_pl_ext_funcs *imager_perl_function_ext_table
10
11 #ifndef IMAGER_MIN_PL_API_LEVEL
12 #define IMAGER_MIN_PL_API_LEVEL IMAGER_PL_API_LEVEL
13 #endif
14
15 #define PERL_INITIALIZE_IMAGER_PERL_CALLBACKS \
16   do {  \
17     imager_perl_function_ext_table = INT2PTR(im_pl_ext_funcs *, SvIV(get_sv(PERL_PL_FUNCTION_TABLE_NAME, 1))); \
18     if (!imager_perl_function_ext_table) \
19       croak("Imager Perl API function table not found!"); \
20     if (imager_perl_function_ext_table->version != IMAGER_PL_API_VERSION) \
21       croak("Imager Perl API version incorrect"); \
22     if (imager_perl_function_ext_table->level < IMAGER_MIN_PL_API_LEVEL) \
23       croak("perl API level %d below minimum of %d", imager_perl_function_ext_table->level, IMAGER_MIN_PL_API_LEVEL); \
24   } while (0)
25
26 /* just for use here */
27 #define im_exttpl imager_perl_function_ext_table
28
29 #define ip_handle_quant_opts  (im_exttpl->f_ip_handle_quant_opts)
30 #define ip_cleanup_quant_opts  (im_exttpl->f_ip_cleanup_quant_opts)
31 #define ip_copy_colors_back (im_exttpl->f_ip_copy_colors_back)
32
33 #endif