hide or rename any symbols that are likely to conflict with other
authorTony Cook <tony@develop=help.com>
Mon, 1 Apr 2002 02:23:06 +0000 (02:23 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 1 Apr 2002 02:23:06 +0000 (02:23 +0000)
libraries or perl

30 files changed:
Imager.xs
draw.c
dynaload.c
dynaload.h
error.c
ext.h
fills.c
filters.c
font.c
freetyp2.c
gaussian.c
gif.c
image.c
image.h
imagei.h
imio.h
io.c
iolayer.c
jpeg.c
log.c
log.h
png.c
polygon.c
quant.c
regmach.c
regmach.h
stackmach.c
stackmach.h
tga.c
trans2.c

index 3db907f528a036e0b3766d720ba36b27359f6caf..2cc3f67293da5f5845f6c336156e5efe97fe5c29 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -38,13 +38,89 @@ typedef TT_Fonthandle* Imager__Font__TT;
 typedef FT2_Fonthandle* Imager__Font__FT2;
 #endif
 
+/* These functions are all shared - then comes platform dependant code */
+static int getstr(void *hv_t,char *key,char **store) {
+  SV** svpp;
+  HV* hv=(HV*)hv_t;
+
+  mm_log((1,"getstr(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+  svpp=hv_fetch(hv, key, strlen(key), 0);
+  *store=SvPV(*svpp, PL_na );
+
+  return 1;
+}
+
+static int getint(void *hv_t,char *key,int *store) {
+  SV** svpp;
+  HV* hv=(HV*)hv_t;  
+
+  mm_log((1,"getint(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+  svpp=hv_fetch(hv, key, strlen(key), 0);
+  *store=(int)SvIV(*svpp);
+  return 1;
+}
+
+static int getdouble(void *hv_t,char* key,double *store) {
+  SV** svpp;
+  HV* hv=(HV*)hv_t;
+
+  mm_log((1,"getdouble(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+  svpp=hv_fetch(hv, key, strlen(key), 0);
+  *store=(float)SvNV(*svpp);
+  return 1;
+}
+
+static int getvoid(void *hv_t,char* key,void **store) {
+  SV** svpp;
+  HV* hv=(HV*)hv_t;
+
+  mm_log((1,"getvoid(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+  svpp=hv_fetch(hv, key, strlen(key), 0);
+  *store = INT2PTR(void*, SvIV(*svpp));
+
+  return 1;
+}
+
+static int getobj(void *hv_t,char *key,char *type,void **store) {
+  SV** svpp;
+  HV* hv=(HV*)hv_t;
+
+  mm_log((1,"getobj(hv_t 0x%X, key %s,type %s, store 0x%X)\n",hv_t,key,type,store));
+
+  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+  svpp=hv_fetch(hv, key, strlen(key), 0);
+
+  if (sv_derived_from(*svpp,type)) {
+    IV tmp = SvIV((SV*)SvRV(*svpp));
+    *store = INT2PTR(void*, tmp);
+  } else {
+    mm_log((1,"getobj: key exists in hash but is not of correct type"));
+    return 0;
+  }
+
+  return 1;
+}
+
+UTIL_table_t i_UTIL_table={getstr,getint,getdouble,getvoid,getobj};
 
 void my_SvREFCNT_dec(void *p) {
   SvREFCNT_dec((SV*)p);
 }
 
 
-void
+static void
 log_entry(char *string, int level) {
   mm_log((level, string));
 }
@@ -376,7 +452,7 @@ static ssize_t io_reader(void *p, void *data, size_t size) {
       cbd->where = 0;
       cbd->used  = did_read;
 
-      copy_size = min(size, cbd->used);
+      copy_size = i_min(size, cbd->used);
       memcpy(out, cbd->buffer, copy_size);
       cbd->where += copy_size;
       out   += copy_size;
@@ -770,7 +846,8 @@ static void copy_colors_back(HV *hv, i_quantize *quant) {
 }
 
 /* loads the segments of a fountain fill into an array */
-i_fountain_seg *load_fount_segs(AV *asegs, int *count) {
+static i_fountain_seg *
+load_fount_segs(AV *asegs, int *count) {
   /* Each element of segs must contain:
      [ start, middle, end, c0, c1, segtype, colortrans ]
      start, middle, end are doubles from 0 to 1
@@ -859,6 +936,10 @@ i_fountain_seg *load_fount_segs(AV *asegs, int *count) {
 #define IFILL_DESTROY(fill) i_fill_destroy(fill);
 typedef i_fill_t* Imager__FillHandle;
 
+/* the m_init_log() function was called init_log(), renamed to reduce
+    potential naming conflicts */
+#define init_log m_init_log
+
 MODULE = Imager                PACKAGE = Imager::Color PREFIX = ICL_
 
 Imager::Color
diff --git a/draw.c b/draw.c
index 882c9b3a190aadb30f28609d1be3b04277d267e0..c57a2d437cfe7066ed6a28773aea3eeaf39bcc93 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -513,7 +513,7 @@ i_line_aa(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
   }
 }
 
-double
+static double
 perm(int n,int k) {
   double r;
   int i;
index cdbf3d9510359a34dd6719bac5fd260b2062d627..28b646c3486c34531b1bf35c90f963f4e23e5f77 100644 (file)
@@ -1,5 +1,6 @@
 #include "dynaload.h"
-#include "XSUB.h" /* so we can compile on threaded perls */
+/* #include "XSUB.h"  so we can compile on threaded perls */
+#include "imagei.h"
 
 static symbol_table_t symbol_table={i_has_format,ICL_set_internal,ICL_info,
                             i_img_new,i_img_empty,i_img_empty_ch,i_img_exorcise,
@@ -7,86 +8,6 @@ static symbol_table_t symbol_table={i_has_format,ICL_set_internal,ICL_info,
                             i_box,i_draw,i_arc,i_copyto,i_copyto_trans,i_rubthru};
 
 
-/* These functions are all shared - then comes platform dependant code */
-
-
-int getstr(void *hv_t,char *key,char **store) {
-  SV** svpp;
-  HV* hv=(HV*)hv_t;
-
-  mm_log((1,"getstr(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
-  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
-  svpp=hv_fetch(hv, key, strlen(key), 0);
-  *store=SvPV(*svpp, PL_na );
-
-  return 1;
-}
-
-int getint(void *hv_t,char *key,int *store) {
-  SV** svpp;
-  HV* hv=(HV*)hv_t;  
-
-  mm_log((1,"getint(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
-  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
-  svpp=hv_fetch(hv, key, strlen(key), 0);
-  *store=(int)SvIV(*svpp);
-  return 1;
-}
-
-int getdouble(void *hv_t,char* key,double *store) {
-  SV** svpp;
-  HV* hv=(HV*)hv_t;
-
-  mm_log((1,"getdouble(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
-  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-  svpp=hv_fetch(hv, key, strlen(key), 0);
-  *store=(float)SvNV(*svpp);
-  return 1;
-}
-
-int getvoid(void *hv_t,char* key,void **store) {
-  SV** svpp;
-  HV* hv=(HV*)hv_t;
-
-  mm_log((1,"getvoid(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
-  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
-  svpp=hv_fetch(hv, key, strlen(key), 0);
-  *store=(void*)SvIV(*svpp);
-
-  return 1;
-}
-
-int getobj(void *hv_t,char *key,char *type,void **store) {
-  SV** svpp;
-  HV* hv=(HV*)hv_t;
-
-  mm_log((1,"getobj(hv_t 0x%X, key %s,type %s, store 0x%X)\n",hv_t,key,type,store));
-
-  if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
-  svpp=hv_fetch(hv, key, strlen(key), 0);
-
-  if (sv_derived_from(*svpp,type)) {
-    IV tmp = SvIV((SV*)SvRV(*svpp));
-    *store = (void*) tmp;
-  } else {
-    mm_log((1,"getobj: key exists in hash but is not of correct type"));
-    return 0;
-  }
-
-  return 1;
-}
-
-
-UTIL_table_t UTIL_table={getstr,getint,getdouble,getvoid,getobj};
-
 /*
   Dynamic loading works like this:
   dynaload opens the shared object and
@@ -125,13 +46,13 @@ DSO_open(char* file,char** evalstring) {
   if ( (shl_findsym(&tt_handle, "symbol_table",TYPE_UNDEFINED,(void*)&plugin_symtab))) return NULL;
   if ( (shl_findsym(&tt_handle, "util_table",TYPE_UNDEFINED,&plugin_utiltab))) return NULL;
   (*plugin_symtab)=&symbol_table;
-  (*plugin_utiltab)=&UTIL_table;
+  (*plugin_utiltab)=&i_UTIL_table;
   */
 
   if ( (shl_findsym(&tt_handle, I_INSTALL_TABLES ,TYPE_UNDEFINED, &f ))) return NULL; 
  
   mm_log( (1,"Calling install_tables\n") );
-  f(&symbol_table,&UTIL_table);
+  f(&symbol_table,&i_UTIL_table);
   mm_log( (1,"Call ok.\n") ); 
  
   if ( (shl_findsym(&tt_handle, I_FUNCTION_LIST ,TYPE_UNDEFINED,(func_ptr*)&function_list))) return NULL; 
@@ -181,7 +102,7 @@ DSO_open(char *file, char **evalstring) {
     return NULL;
   }
   mm_log((1, "Calling install tables\n"));
-  f(&symbol_table, &UTIL_table);
+  f(&symbol_table, &i_UTIL_table);
   mm_log((1, "Call ok\n"));
   
   if ( (function_list = (func_ptr *)GetProcAddress(d_handle, I_FUNCTION_LIST)) == NULL) {
@@ -351,11 +272,11 @@ DSO_open(char* file,char** evalstring) {
   }
 
   mm_log( (1,"Calling install_tables\n") );
-  f(&symbol_table,&UTIL_table);
+  f(&symbol_table,&i_UTIL_table);
   mm_log( (1,"Call ok.\n") );
 
   /* (*plugin_symtab)=&symbol_table;
-     (*plugin_utiltab)=&UTIL_table; */
+     (*plugin_utiltab)=&i_UTIL_table; */
   
   mm_log( (1,"DSO_open: going to dlsym '%s'\n", I_FUNCTION_LIST ));
   if ( (function_list=(func_ptr *)dlsym(d_handle, I_FUNCTION_LIST)) == NULL) {
index 40f83b7932ae245c59200eb3f99cf50b4ba9110b..507188718e361b3cefacf4bc24b3c6069374bb49 100644 (file)
@@ -42,11 +42,12 @@ typedef struct {
   void *store;
 } UTIL_args;
 
+#if 0
 int getobj(void *hv_t,char *key,char *type,void **store);
 int getint(void *hv_t,char *key,int *store);
 int getdouble(void *hv_t,char *key,double *store);
 int getvoid(void *hv_t,char *key,void **store);
-
+#endif
 
 void *DSO_open(char* file,char** evalstring);
 int DSO_close(void *);
diff --git a/error.c b/error.c
index 1737bc421f4fa428f65043bbb1300b98a58ec27e..b1e87d38d77a10eff2d562b8990dbb114d057720 100644 (file)
--- a/error.c
+++ b/error.c
@@ -67,13 +67,13 @@ C).  The Perl level won't use all of this.
 
 /* we never actually use the last item - it's the NULL terminator */
 #define ERRSTK 20
-i_errmsg error_stack[ERRSTK];
-int error_sp = ERRSTK - 1;
+static i_errmsg error_stack[ERRSTK];
+static int error_sp = ERRSTK - 1;
 /* we track the amount of space used each string, so we don't reallocate 
    space unless we need to.
    This also means that a memory tracking library may see the memory 
    allocated for this as a leak. */
-int error_space[ERRSTK];
+static int error_space[ERRSTK];
 
 static i_error_cb error_cb;
 static i_failed_cb failed_cb;
diff --git a/ext.h b/ext.h
index ebd9a7502196f3feeb412768f0842f2ae036977d..15cb3ffa3a6851d04d0a8c8901ca4b47fff2640b 100644 (file)
--- a/ext.h
+++ b/ext.h
@@ -1,5 +1,8 @@
 #include "image.h"
 
+#ifndef IMAGER_EXT_H
+#define IMAGER_EXT_H
+
 /* structures for passing data between Imager-plugin and the Imager-module */
 
 typedef struct {
@@ -16,3 +19,5 @@ typedef struct {
   int (*getvoid)(void *hv_t,char* key,void **store);
   int (*getobj)(void *hv_t,char* key,char* type,void **store);
 } UTIL_table_t;
+
+#endif
diff --git a/fills.c b/fills.c
index bcd0604965813f2774e15f941f31e14341157086..de9f1628ecb6762ac7f0ad11a9181d72cc8382fd 100644 (file)
--- a/fills.c
+++ b/fills.c
@@ -892,7 +892,7 @@ static void combine_valuef(i_fcolor *, i_fcolor *, int, int);
 static void combine_color(i_color *, i_color *, int, int);
 static void combine_colorf(i_fcolor *, i_fcolor *, int, int);
 
-struct i_combines {
+static struct i_combines {
   i_fill_combine_f combine;
   i_fill_combinef_f combinef;
 } combines[] =
index e801488e0898427c9a149ad413a3a431331de8d4..04c3926d135422a737c9304615c5538ccc20e779 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -960,7 +960,7 @@ i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) {
        fdist[p]  = xd*xd + yd*yd; /* euclidean distance */
        break;
       case 2: /* euclidean squared */
-       fdist[p]  = max(xd*xd, yd*yd); /* manhattan distance */
+       fdist[p]  = i_max(xd*xd, yd*yd); /* manhattan distance */
        break;
       default:
        m_fatal(3,"i_gradgen: Unknown distance measure\n");
@@ -1013,7 +1013,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme
       mindist = xd*xd + yd*yd; /* euclidean distance */
       break;
     case 2: /* euclidean squared */
-      mindist = max(xd*xd, yd*yd); /* manhattan distance */
+      mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
       break;
     default:
       m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1030,7 +1030,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme
        curdist = xd*xd + yd*yd; /* euclidean distance */
        break;
       case 2: /* euclidean squared */
-       curdist = max(xd*xd, yd*yd); /* manhattan distance */
+       curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
        break;
       default:
        m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1083,7 +1083,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
       mindist = xd*xd + yd*yd; /* euclidean distance */
       break;
     case 2: /* euclidean squared */
-      mindist = max(xd*xd, yd*yd); /* manhattan distance */
+      mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
       break;
     default:
       m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1100,7 +1100,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
        curdist = xd*xd + yd*yd; /* euclidean distance */
        break;
       case 2: /* euclidean squared */
-       curdist = max(xd*xd, yd*yd); /* manhattan distance */
+       curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
        break;
       default:
        m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1225,8 +1225,8 @@ i_diff_image(i_img *im1, i_img *im2, int mindiff) {
   if (outchans == 1 || outchans == 3)
     ++outchans;
 
-  xsize = min(im1->xsize, im2->xsize);
-  ysize = min(im1->ysize, im2->ysize);
+  xsize = i_min(im1->xsize, im2->xsize);
+  ysize = i_min(im1->ysize, im2->ysize);
 
   out = i_sametype_chans(im1, xsize, ysize, outchans);
   
diff --git a/font.c b/font.c
index 35d333d1a235f77fe05a33d0223a25365abdab0e..c3796bec8fe2d544a84ca06238bd6f5e0b6eff2d 100644 (file)
--- a/font.c
+++ b/font.c
@@ -70,11 +70,11 @@ i_init_fonts(int t1log) {
   mm_log((1,"Initializing fonts\n"));
 
 #ifdef HAVE_LIBT1
-  init_t1(t1log);
+  i_init_t1(t1log);
 #endif
   
 #ifdef HAVE_LIBTT
-  init_tt();
+  i_init_tt();
 #endif
 
 #ifdef HAVE_FT2
@@ -101,7 +101,7 @@ Initializes the t1lib font rendering engine.
 */
 
 undef_int
-init_t1(int t1log) {
+i_init_t1(int t1log) {
   int init_flags = IGNORE_CONFIGFILE|IGNORE_FONTDATABASE;
   mm_log((1,"init_t1()\n"));
   
@@ -430,7 +430,7 @@ Initializes the freetype font rendering engine
 */
 
 undef_int
-init_tt() {
+i_init_tt() {
   TT_Error  error;
   mm_log((1,"init_tt()\n"));
   error = TT_Init_FreeType( &engine );
index b933060c9d831e0c6c9d1c2cb9ac8d21f683b005..2faf2b0273318753dac161c8e69e7afa7d586893 100644 (file)
@@ -400,10 +400,10 @@ void ft2_transform_box(FT2_Fonthandle *handle, int bbox[4]) {
   work[6] = matrix[0] * bbox[2] + matrix[1] * bbox[3];
   work[7] = matrix[3] * bbox[2] + matrix[4] * bbox[3];
 
-  bbox[0] = floor(min(min(work[0], work[2]),min(work[4], work[6])));
-  bbox[1] = floor(min(min(work[1], work[3]),min(work[5], work[7])));
-  bbox[2] = ceil(max(max(work[0], work[2]),max(work[4], work[6])));
-  bbox[3] = ceil(max(max(work[1], work[3]),max(work[5], work[7])));
+  bbox[0] = floor(i_min(i_min(work[0], work[2]),i_min(work[4], work[6])));
+  bbox[1] = floor(i_min(i_min(work[1], work[3]),i_min(work[5], work[7])));
+  bbox[2] = ceil(i_max(i_max(work[0], work[2]),i_max(work[4], work[6])));
+  bbox[3] = ceil(i_max(i_max(work[1], work[3]),i_max(work[5], work[7])));
 }
 
 /*
@@ -415,10 +415,10 @@ bounding box in bbox[] that encloses both.
 =cut
 */
 static void expand_bounds(int bbox[4], int bbox2[4]) {
-  bbox[0] = min(bbox[0], bbox2[0]);
-  bbox[1] = min(bbox[1], bbox2[1]);
-  bbox[2] = max(bbox[2], bbox2[2]);
-  bbox[3] = max(bbox[3], bbox2[3]);
+  bbox[0] = i_min(bbox[0], bbox2[0]);
+  bbox[1] = i_min(bbox[1], bbox2[1]);
+  bbox[2] = i_max(bbox[2], bbox2[2]);
+  bbox[3] = i_max(bbox[3], bbox2[3]);
 }
 
 /*
index c3025b7f89ad36afd7f386f0178f08ff68d30e43..dee1f57915d99233e5add95311aecd4e8849e7dd 100644 (file)
@@ -1,6 +1,6 @@
 #include "image.h"
 
-float
+static float
 gauss(int x,float std) {
   return 1.0/(sqrt(2.0*PI)*std)*exp(-(float)(x)*(float)(x)/(2*std*std));
 }
diff --git a/gif.c b/gif.c
index 3830ff621db72bb0b08fc5c2ffb3776d50744336..f22d5e105072c22151229451f1e35e3bcb20feea 100644 (file)
--- a/gif.c
+++ b/gif.c
@@ -871,7 +871,7 @@ i_readgif_multi_callback(i_read_callback_t cb, char *userdata, int *count) {
   }
 
   result = i_readgif_multi_low(GifFile, count);
-  free_gen_read_data(gci);
+  i_free_gen_read_data(gci);
 
   return result;
 #else
@@ -1023,7 +1023,7 @@ i_readgif_callback(i_read_callback_t cb, char *userdata, int **colour_table, int
   }
 
   result = i_readgif_low(GifFile, colour_table, colours);
-  free_gen_read_data(gci);
+  i_free_gen_read_data(gci);
 
   return result;
 #else
@@ -1926,12 +1926,12 @@ i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata,
     gif_push_error();
     i_push_error(0, "Cannot create GIF file object");
     mm_log((1, "Error in EGifOpenFileHandle, unable to write image.\n"));
-    free_gen_write_data(gwd, 0);
+    i_free_gen_write_data(gwd, 0);
     return 0;
   }
 
   result = i_writegif_low(quant, gf, imgs, count);
-  return free_gen_write_data(gwd, result);
+  return i_free_gen_write_data(gwd, result);
 #else
   i_clear_error();
   i_push_error(0, "callbacks not supported with giflib3");
diff --git a/image.c b/image.c
index e3fa3a70f2fc820a674ac73b48e05aeb1c0483cd..b4c7100d03ea3c28215685b1073e191999b92a9a 100644 (file)
--- a/image.c
+++ b/image.c
@@ -38,7 +38,7 @@ Some of these functions are internal.
 #define minmax(a,b,i) ( ((a>=i)?a: ( (b<=i)?b:i   )) )
 
 /* Hack around an obscure linker bug on solaris - probably due to builtin gcc thingies */
-void fake(void) { ceil(1); }
+static void fake(void) { ceil(1); }
 
 static int i_ppix_d(i_img *im, int x, int y, i_color *val);
 static int i_gpix_d(i_img *im, int x, int y, i_color *val);
@@ -1138,8 +1138,8 @@ i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int par
     parm[1]=(double)ny;
 
     /*     fprintf(stderr,"(%d,%d) ->",nx,ny);  */
-    rx=op_run(opx,opxl,parm,parmlen);
-    ry=op_run(opy,opyl,parm,parmlen);
+    rx=i_op_run(opx,opxl,parm,parmlen);
+    ry=i_op_run(opy,opyl,parm,parmlen);
     /*    fprintf(stderr,"(%f,%f)\n",rx,ry); */
     i_gpix(im,rx,ry,&val);
     i_ppix(new_img,nx,ny,&val);
@@ -1897,7 +1897,7 @@ i_gen_reader(i_gen_read_data *gci, char *buf, int length) {
       gci->cpos = 0;
       gci->length = did_read;
 
-      copy_size = min(length, gci->length);
+      copy_size = i_min(length, gci->length);
       memcpy(buf, gci->buffer, copy_size);
       gci->cpos += copy_size;
       buf += copy_size;
@@ -1940,13 +1940,13 @@ i_gen_read_data_new(i_read_callback_t cb, char *userdata) {
 }
 
 /*
-=item free_gen_read_data(i_gen_read_data *)
+=item i_free_gen_read_data(i_gen_read_data *)
 
 Cleans up.
 
 =cut
 */
-void free_gen_read_data(i_gen_read_data *self) {
+void i_free_gen_read_data(i_gen_read_data *self) {
   myfree(self);
 }
 
@@ -1990,7 +1990,7 @@ int size)
 
 Allocates and initializes the data structure used by i_gen_writer.
 
-This should be released with L<image.c/free_gen_write_data>
+This should be released with L<image.c/i_free_gen_write_data>
 
 =cut
 */
@@ -2000,7 +2000,7 @@ i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb,
   i_gen_write_data *self = mymalloc(sizeof(i_gen_write_data));
   self->cb = cb;
   self->userdata = userdata;
-  self->maxlength = min(max_length, sizeof(self->buffer));
+  self->maxlength = i_min(max_length, sizeof(self->buffer));
   if (self->maxlength < 0)
     self->maxlength = sizeof(self->buffer);
   self->filledto = 0;
@@ -2009,7 +2009,7 @@ i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb,
 }
 
 /*
-=item free_gen_write_data(i_gen_write_data *info, int flush)
+=item i_free_gen_write_data(i_gen_write_data *info, int flush)
 
 Cleans up the write buffer.
 
@@ -2023,7 +2023,7 @@ ie. if it fails.
 =cut
 */
 
-int free_gen_write_data(i_gen_write_data *info, int flush)
+int i_free_gen_write_data(i_gen_write_data *info, int flush)
 {
   int result = !flush || 
     info->filledto == 0 ||
diff --git a/image.h b/image.h
index 25e231e4706d186ebd431417b4d0da1e841ec3d8..ae728dcd8cc803efe7ae10aec07782ce9fd8ea53 100644 (file)
--- a/image.h
+++ b/image.h
@@ -243,7 +243,7 @@ undef_int i_init_fonts( int t1log );
 #ifdef HAVE_LIBT1
 #include <t1lib.h>
 
-undef_int init_t1( int t1log );
+undef_int i_init_t1( int t1log );
 int       i_t1_new( char *pfb, char *afm );
 int       i_t1_destroy( int font_id );
 undef_int i_t1_cp( i_img *im, int xb, int yb, int channel, int fontnum, float points, char* str, int len, int align );
@@ -282,7 +282,7 @@ typedef struct TT_Fonthandle_ TT_Fonthandle;
 
 
 
-undef_int init_tt( void );
+undef_int i_init_tt( void );
 TT_Fonthandle* i_tt_new(char *fontname);
 void i_tt_destroy( TT_Fonthandle *handle );
 undef_int i_tt_cp( TT_Fonthandle *handle,i_img *im,int xb,int yb,int channel,float points,char* txt,int len,int smooth);
@@ -357,7 +357,7 @@ typedef struct {
 
 extern int  i_gen_reader(i_gen_read_data *info, char *buffer, int need);
 extern      i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata);
-extern void free_gen_read_data(i_gen_read_data *);
+extern void i_free_gen_read_data(i_gen_read_data *);
 
 /* general writer callback
    userdata - the data the user passed into the writer
@@ -377,7 +377,7 @@ typedef struct {
 
 extern int i_gen_writer(i_gen_write_data *info, char const *data, int size);
 extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength);
-extern int free_gen_write_data(i_gen_write_data *, int flush);
+extern int i_free_gen_write_data(i_gen_write_data *, int flush);
 
 /* transparency handling for quantized output */
 typedef enum i_transp_tag {
index b9a8dc3a481fc6863d383614fcac3352ef3f632d..1fbfdd2227743f7d44ff1c5f28eed85fa3e3eb2e 100644 (file)
--- a/imagei.h
+++ b/imagei.h
@@ -41,4 +41,8 @@ extern int i_setcolors_forward(i_img *im, int index, i_color *colors,
 
 extern void i_get_combine(int combine, i_fill_combine_f *, i_fill_combinef_f *);
 
+#include "ext.h"
+
+extern UTIL_table_t i_UTIL_table;
+
 #endif
diff --git a/imio.h b/imio.h
index 5d746042034a1a56eb7f6721ba15639745a37277..88031bf5c88508080dc6772de8800f4f6aebb73a 100644 (file)
--- a/imio.h
+++ b/imio.h
@@ -57,7 +57,7 @@ void  i_mempool_destroy(i_mempool *mp);
 
 /* XXX Shouldn't these go away? */
 
-int min(int a,int b);
-int max(int x,int y);
+int i_min(int a,int b);
+int i_max(int x,int y);
 
 #endif
diff --git a/io.c b/io.c
index 73fbd3be5ce1728807d07f0933c56f43478c7f49..cbdce634a7f0e91ab74a796da60c713f8c85a87b 100644 (file)
--- a/io.c
+++ b/io.c
@@ -300,12 +300,12 @@ i_mempool_destroy(i_mempool *mp) {
 #undef max
 
 int
-min(int a,int b) {
+i_min(int a,int b) {
   if (a<b) return a; else return b;
 }
 
 int
-max(int a,int b) {
+i_max(int a,int b) {
   if (a>b) return a; else return b;
 }
 
index efcbf552c161554dfbd01d3edd868055b5a40b7e..4ef32811b5f5e6a985825c7e2b66fe8ee5a2ce67 100644 (file)
--- a/iolayer.c
+++ b/iolayer.c
@@ -676,7 +676,7 @@ bufchain_seek(io_glue *ig, off_t offset, int whence) {
       ieb->cpos = ieb->tfill;
 
       while(wrlen > 0) {
-       ssize_t rc, wl = min(wrlen, BBSIZ);
+       ssize_t rc, wl = i_min(wrlen, BBSIZ);
        mm_log((1, "bufchain_seek: wrlen = %d, wl = %d\n", wrlen, wl));
        rc = bufchain_write( ig, TB, wl );
        if (rc != wl) m_fatal(0, "bufchain_seek: Unable to extend file\n");
diff --git a/jpeg.c b/jpeg.c
index e3bc7725d15b42d5467c4d7cd4b8a07fcec8580b..6aa9eb0d12665683769f2010dcb3a0871511f490 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -36,7 +36,7 @@ Reads and writes JPEG images
 #define JPEG_APP13       0xED    /* APP13 marker code */
 #define JPGS 16384
 
-unsigned char fake_eoi[]={(JOCTET) 0xFF,(JOCTET) JPEG_EOI};
+static unsigned char fake_eoi[]={(JOCTET) 0xFF,(JOCTET) JPEG_EOI};
 
 /* Bad design right here */
 
diff --git a/log.c b/log.c
index a571fda2fe70c0558432c49bbc52d23841408839..17aeb48009e3320628666cd1222cf6a60bcb7cbf 100644 (file)
--- a/log.c
+++ b/log.c
@@ -17,7 +17,7 @@ static char  data_buffer[DATABUFF];
  */
 
 void
-init_log(const char* name,int level) {
+m_init_log(const char* name,int level) {
   log_level = level;
   if (level < 0) {
     lg_file = NULL;
diff --git a/log.h b/log.h
index cd8b12134a2d6eedde5076aa8b19a3a68aa139e1..7c9cc97c483c63360cd20cce47c980bcddd1dd47 100644 (file)
--- a/log.h
+++ b/log.h
@@ -11,7 +11,7 @@
 */
 
 void m_lhead ( const char *file, int line  );
-void init_log( const char *name, int onoff );
+void m_init_log( const char *name, int onoff );
 void m_loog(int level,const char *msg, ... );
 void m_fatal ( int exitcode,const char *fmt, ... );
 
diff --git a/png.c b/png.c
index 65c3c181c850fce104c998c17e806f2814f575ce..6a15fff2233e90ab9e1d4274dc075053b5fc904a 100644 (file)
--- a/png.c
+++ b/png.c
@@ -26,7 +26,7 @@
 /* this is a way to get number of channels from color space 
  * Color code to channel number */
 
-int CC2C[PNG_COLOR_MASK_PALETTE|PNG_COLOR_MASK_COLOR|PNG_COLOR_MASK_ALPHA];
+static int CC2C[PNG_COLOR_MASK_PALETTE|PNG_COLOR_MASK_COLOR|PNG_COLOR_MASK_ALPHA];
 
 #define PNG_BYTES_TO_CHECK 4
  
index 271513238f0500da370195caaf4ceecd2d4fae86..9e53bb2e738eb085cd1638a85debd1cf28fe8ce2 100644 (file)
--- a/polygon.c
+++ b/polygon.c
@@ -101,10 +101,10 @@ line_set_new(double *x, double *y, int l) {
     lset[i].y1 = IMTRUNC(y[i]);
     lset[i].x2 = IMTRUNC(x[(i+1)%l]);
     lset[i].y2 = IMTRUNC(y[(i+1)%l]);
-    lset[i].miny=min(lset[i].y1,lset[i].y2);
-    lset[i].maxy=max(lset[i].y1,lset[i].y2);
-    lset[i].minx=min(lset[i].x1,lset[i].x2);
-    lset[i].maxx=max(lset[i].x1,lset[i].x2);
+    lset[i].miny=i_min(lset[i].y1,lset[i].y2);
+    lset[i].maxy=i_max(lset[i].y1,lset[i].y2);
+    lset[i].minx=i_min(lset[i].x1,lset[i].x2);
+    lset[i].maxx=i_max(lset[i].x1,lset[i].x2);
   }
   return lset;
 }
@@ -265,7 +265,7 @@ typedef void (*scanline_flusher)(i_img *im, ss_scanline *ss, int y, void *ctx);
 
 /* This function must be modified later to do proper blending */
 
-void
+static void
 scanline_flush(i_img *im, ss_scanline *ss, int y, void *ctx) {
   int x, ch, tv;
   i_color t;
@@ -368,22 +368,22 @@ render_slice_scanline(ss_scanline *ss, int y, p_line *l, p_line *r) {
 
   /* Find the y bounds of scanline_slice */
 
-  maxy = min( l->maxy, r->maxy );
-  miny = max( l->miny, r->miny );
+  maxy = i_min( l->maxy, r->maxy );
+  miny = i_max( l->miny, r->miny );
 
-  maxy = min( maxy, (y+1)*16 );
-  miny = max( miny,  y*16 );
+  maxy = i_min( maxy, (y+1)*16 );
+  miny = i_max( miny,  y*16 );
 
-  lminx = min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
-  lmaxx = max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+  lminx = i_min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+  lmaxx = i_max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
 
-  rminx = min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
-  rmaxx = max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+  rminx = i_min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+  rmaxx = i_max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
 
   thin = coarse(lmaxx) >= coarse(rminx);
 
-  startpix = max( coarse(lminx), 0 );
-  stoppix  = min( coarse(rmaxx-1), ss->linelen-1 );
+  startpix = i_max( coarse(lminx), 0 );
+  stoppix  = i_min( coarse(rmaxx-1), ss->linelen-1 );
   
   for(cpix=startpix; cpix<=stoppix; cpix++) {
     int lt = coarse(lmaxx-1) >= cpix;
@@ -422,24 +422,24 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
 
   /* Find the y bounds of scanline_slice */
 
-  maxy = min( l->maxy, r->maxy );
-  miny = max( l->miny, r->miny );
+  maxy = i_min( l->maxy, r->maxy );
+  miny = i_max( l->miny, r->miny );
 
-  maxy = min( maxy, (y+1)*16 );
-  miny = max( miny,  y*16 );
+  maxy = i_min( maxy, (y+1)*16 );
+  miny = i_max( miny,  y*16 );
 
-  lminx = min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
-  lmaxx = max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+  lminx = i_min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+  lmaxx = i_max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
 
-  rminx = min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
-  rmaxx = max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+  rminx = i_min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+  rmaxx = i_max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
 
   thin = coarse(lmaxx) >= coarse(rminx);
 
 
   /* First step */
   startpix = coarse(lminx);                            /* includes tricky starting pixel */
-  stoppix  = min(coarse(lmaxx), coarse(rminx) );       /* last pixel is tricky */
+  stoppix  = i_min(coarse(lmaxx), coarse(rminx) );     /* last pixel is tricky */
   
   /* handle start pixel */
 
@@ -468,7 +468,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
       printf("%2d: step2a pixel\n", cpix);
       ss->line[cpix] += 
        pixel_coverage(l, cpix*16, cpix*16+16, miny, maxy)
-       +(cpix*16+16-min(cpix*16+16, l->maxx))*(maxy-miny)
+       +(cpix*16+16-i_min(cpix*16+16, l->maxx))*(maxy-miny)
        -pixel_coverage(r, cpix*16, cpix*16+16, miny, maxy);
     }
   } else { /* step 2b */
@@ -481,7 +481,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
   
   /* step 3 */
 
-  cpix = max(coarse(rminx), coarse(lmaxx+15));
+  cpix = i_max(coarse(rminx), coarse(lmaxx+15));
   stoppix = coarse(rmaxx-15);
   
   printf("step3 from %d to %d\n", cpix, stoppix);
@@ -533,7 +533,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
  */
 
 
-void
+static void
 i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flusher flusher) {
   int i ,k;                    /* Index variables */
   int clc;                     /* Lines inside current interval */
@@ -579,8 +579,8 @@ i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flushe
 
   /* loop on intervals */
   for(i=0; i<l-1; i++) {
-    int startscan = max( coarse(pset[i].y), 0);
-    int stopscan = min( coarse(pset[i+1].y+15), im->ysize);
+    int startscan = i_max( coarse(pset[i].y), 0);
+    int stopscan = i_min( coarse(pset[i+1].y+15), im->ysize);
     pcord cc = (pset[i].y + pset[i+1].y)/2;
 
     if (pset[i].y == pset[i+1].y) {
@@ -615,7 +615,7 @@ i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flushe
               );
     }
     for(cscl=startscan; cscl<stopscan; cscl++) {
-      tempy = min(cscl*16+16, pset[i+1].y);
+      tempy = i_min(cscl*16+16, pset[i+1].y);
       POLY_DEB( printf("evaluating scan line %d \n", cscl) );
       for(k=0; k<clc-1; k+=2) {
        POLY_DEB( printf("evaluating slice %d\n", k) );
@@ -657,7 +657,7 @@ struct poly_cfill_state {
   i_fill_t *fill;
 };
 
-void
+static void
 scanline_flush_cfill(i_img *im, ss_scanline *ss, int y, void *ctx) {
   int x, ch, tv;
   i_color t;
@@ -720,7 +720,7 @@ struct poly_cfill_state_f {
   i_fill_t *fill;
 };
 
-void
+static void
 scanline_flush_cfill_f(i_img *im, ss_scanline *ss, int y, void *ctx) {
   int x, ch, tv;
   int pos;
diff --git a/quant.c b/quant.c
index be67662e926bea40865b9cf0a0cf4af79f6342e3..2c11a5580bc98dec1ceffbdfcbfc924d7d70fe22 100644 (file)
--- a/quant.c
+++ b/quant.c
@@ -1525,9 +1525,9 @@ maxdist(int boxnum,cvec *cv) {
   
   bbox(boxnum,&r0,&r1,&g0,&g1,&b0,&b1);
 
-  mr=max(abs(b-b0),abs(b-b1));
-  mg=max(abs(g-g0),abs(g-g1));
-  mb=max(abs(r-r0),abs(r-r1));
+  mr=i_max(abs(b-b0),abs(b-b1));
+  mg=i_max(abs(g-g0),abs(g-g1));
+  mb=i_max(abs(r-r0),abs(r-r1));
   
   return PWR2(mr)+PWR2(mg)+PWR2(mb);
 }
@@ -1547,9 +1547,9 @@ mindist(int boxnum,cvec *cv) {
 
   if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0;
 
-  mr=min(abs(b-b0),abs(b-b1));
-  mg=min(abs(g-g0),abs(g-g1));
-  mb=min(abs(r-r0),abs(r-r1));
+  mr=i_min(abs(b-b0),abs(b-b1));
+  mg=i_min(abs(g-g0),abs(g-g1));
+  mb=i_min(abs(r-r0),abs(r-r1));
   
   mr=PWR2(mr);
   mg=PWR2(mg);
@@ -1670,7 +1670,8 @@ transparent_errdiff(i_quantize *quant, i_palidx *data, i_img *img,
 }
 
 /* builtin ordered dither maps */
-unsigned char orddith_maps[][64] =
+static unsigned char 
+orddith_maps[][64] =
 {
   { /* random 
        this is purely random - it's pretty awful
index d088713225031e6f69ab81aefd4600a941412492..694ed2d9c44d22ab6305993202fff4fd58a4ca72 100644 (file)
--- a/regmach.c
+++ b/regmach.c
 */
 
 /* returns the value (brightness) of color from 0 to 1 */
-double hsv_value(i_color color) {
-  return max(max(color.rgb.r, color.rgb.g), color.rgb.b) / 255.0;
+static double hsv_value(i_color color) {
+  return i_max(i_max(color.rgb.r, color.rgb.g), color.rgb.b) / 255.0;
 }
 
 /* returns the hue (color) of color from 0 to 360 */
-double hsv_hue(i_color color) {
+static double hsv_hue(i_color color) {
   int val;
   int temp;
-  temp = min(min(color.rgb.r, color.rgb.g), color.rgb.b);
-  val = max(color.rgb.r, max(color.rgb.g, color.rgb.b));
+  temp = i_min(i_min(color.rgb.r, color.rgb.g), color.rgb.b);
+  val = i_max(color.rgb.r, i_max(color.rgb.g, color.rgb.b));
   if (val == 0 || val==temp) {
     return 0;
   }
@@ -55,18 +55,18 @@ double hsv_hue(i_color color) {
 }
 
 /* return the saturation of color from 0 to 1 */
-double hsv_sat(i_color color) {
-  int value = max(max(color.rgb.r, color.rgb.g), color.rgb.b);
+static double hsv_sat(i_color color) {
+  int value = i_max(i_max(color.rgb.r, color.rgb.g), color.rgb.b);
   if (value == 0) {
     return 0;
   }
   else {
-    int temp = min(max(color.rgb.r, color.rgb.g), color.rgb.b);
+    int temp = i_min(i_max(color.rgb.r, color.rgb.g), color.rgb.b);
     return (value - temp) / (double)value;
   }
 }
 
-i_color make_hsv(double hue, double sat, double val) {
+static i_color make_hsv(double hue, double sat, double val) {
   int i;
   i_color c;
   for( i=0; i< MAXCHANNELS; i++) c.channel[i]=0;
@@ -123,7 +123,7 @@ i_color make_hsv(double hue, double sat, double val) {
   return c;
 }
 
-i_color make_rgb(int r, int g, int b) {
+static i_color make_rgb(int r, int g, int b) {
   i_color c;
   if (r < 0)
     r = 0;
@@ -163,7 +163,7 @@ i_color make_rgb(int r, int g, int b) {
 #define n_epsilon(x, y) (abs(x)+abs(y))*0.001
 static i_color bcol = {{ 0 }};
 
-i_color rm_run(struct rm_op codes[], size_t code_count, 
+i_color i_rm_run(struct rm_op codes[], size_t code_count, 
               double n_regs[],  size_t n_regs_count,
               i_color c_regs[], size_t c_regs_count,
               i_img *images[],  size_t image_count) {
index 275a084fa0e609c755ce4f5a816db7f1ca016728..083dad53b783c37333ccb0d30d2d7dbba8ea0c1f 100644 (file)
--- a/regmach.h
+++ b/regmach.h
@@ -73,10 +73,10 @@ struct rm_op {
   rm_word rout; /* output register */
 };
 
-i_color rm_run(struct rm_op codes[], size_t code_count, 
-              double n_regs[], size_t n_regs_count,
-              i_color c_regs[], size_t c_regs_count,
-              i_img *images[], size_t image_count);
+i_color i_rm_run(struct rm_op codes[], size_t code_count, 
+                double n_regs[], size_t n_regs_count,
+                i_color c_regs[], size_t c_regs_count,
+                i_img *images[], size_t image_count);
 
 /* op_run(fx, sizeof(fx), parms, 2)) */
 
index fa526429e8b260e97a62974661aa0c1641d8c169..d996e054da9736b00a71ad46a7c13f7d567630f6 100644 (file)
@@ -1,7 +1,7 @@
 #include "stackmach.h"
 
 double
-op_run(int codes[], size_t code_size, double parms[], size_t parm_size) {
+i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size) {
   double stack[100];
   double *sp = stack;
 
index 20c3133190a07d37cda40b3a1b2cc98f19bfed8a..d70572b227e7a1583492f9c2b282671a7bc2299f 100644 (file)
@@ -14,7 +14,7 @@ enum ByteCodes {
   bcCos
 };
 
-double op_run(int codes[], size_t code_size, double parms[], size_t parm_size);
+double i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size);
 
 /* op_run(fx, sizeof(fx), parms, 2)) */
 
diff --git a/tga.c b/tga.c
index 361f732e6a765f0bf5580e252f39172c4ee5e169..bd574187bf1c6309e3feec81c9fc76301f2003c6 100644 (file)
--- a/tga.c
+++ b/tga.c
@@ -395,14 +395,14 @@ tga_source_read(tga_source *s, unsigned char *buf, size_t pixels) {
 
       break;
     case Rle:
-      ml = min(s->len, pixels-cp);
+      ml = i_min(s->len, pixels-cp);
       for(k=0; k<ml; k++) for(j=0; j<s->bytepp; j++) 
        buf[(cp+k)*s->bytepp+j] = s->cval[j];
       cp     += ml;
       s->len -= ml;
       break;
     case Raw:
-      ml = min(s->len, pixels-cp);
+      ml = i_min(s->len, pixels-cp);
       if (s->ig->readcb(s->ig, buf+cp*s->bytepp, ml*s->bytepp) != ml*s->bytepp) return 0;
       cp     += ml;
       s->len -= ml;
index 810c436b0476927ad13aa8a5caaf36094d982e14..daf74b0591d20110a3988322f5293375cd3e961e 100644 (file)
--- a/trans2.c
+++ b/trans2.c
@@ -69,7 +69,7 @@ i_img* i_transform2(int width, int height, int channels,
     for (y = 0; y < height; ++y) {
       n_regs[0] = x;
       n_regs[1] = y;
-      val = rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count, 
+      val = i_rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count, 
                   in_imgs, in_imgs_count);
       i_ppix(new_img, x, y, &val);
     }