From f0ac4d508c7030d7dc0cd5569f4d312129daae31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 11 Sep 2000 18:05:05 +0200
Subject: [PATCH] Moved GIF {en,de}code to _Image_GIF.

Rev: src/modules/Image/acconfig.h:1.5
Rev: src/modules/Image/configure.in:1.16
Rev: src/modules/Image/encodings/Makefile.in:1.32
Rev: src/modules/Image/encodings/any.c:1.19
Rev: src/modules/Image/encodings/configure.in:1.6
Rev: src/modules/Image/encodings/encodings.h:1.2
Rev: src/modules/Image/encodings/gif.c:1.61(DEAD)
Rev: src/modules/Image/encodings/gif_lzw.c:1.10(DEAD)
Rev: src/modules/Image/encodings/gif_lzw.h:1.9(DEAD)
Rev: src/modules/Image/image.h:1.44
Rev: src/modules/Image/initstuff.h:1.10
Rev: src/modules/_Image_GIF/.cvsignore:1.1
Rev: src/modules/_Image_GIF/Makefile.in:1.1
Rev: src/modules/_Image_GIF/acconfig.h:1.1
Rev: src/modules/_Image_GIF/configure.in:1.1
Rev: src/modules/_Image_GIF/gif_lzw.c:1.1
Rev: src/modules/_Image_GIF/gif_lzw.h:1.1
Rev: src/modules/_Image_GIF/image_gif.c:1.1
Rev: src/modules/_Image_GIF/testsuite.in:1.1
---
 .gitattributes                                |   9 +-
 src/modules/Image/acconfig.h                  |   5 +-
 src/modules/Image/configure.in                |   4 +-
 src/modules/Image/encodings/Makefile.in       |   4 +-
 src/modules/Image/encodings/any.c             |  26 ++-
 src/modules/Image/encodings/configure.in      |   4 +-
 src/modules/Image/encodings/encodings.h       |   4 +-
 src/modules/Image/image.h                     |  15 +-
 src/modules/Image/initstuff.h                 |   1 -
 src/modules/_Image_GIF/.cvsignore             |  15 ++
 src/modules/_Image_GIF/.gitignore             |  15 ++
 src/modules/_Image_GIF/Makefile.in            |  10 +
 src/modules/_Image_GIF/acconfig.h             |  18 ++
 src/modules/_Image_GIF/configure.in           |  18 ++
 .../{Image/encodings => _Image_GIF}/gif_lzw.c |  10 +-
 .../{Image/encodings => _Image_GIF}/gif_lzw.h |   2 +-
 .../gif.c => _Image_GIF/image_gif.c}          | 175 +++++++++++-------
 src/modules/_Image_GIF/testsuite.in           |   3 +
 18 files changed, 230 insertions(+), 108 deletions(-)
 create mode 100644 src/modules/_Image_GIF/.cvsignore
 create mode 100644 src/modules/_Image_GIF/.gitignore
 create mode 100644 src/modules/_Image_GIF/Makefile.in
 create mode 100644 src/modules/_Image_GIF/acconfig.h
 create mode 100644 src/modules/_Image_GIF/configure.in
 rename src/modules/{Image/encodings => _Image_GIF}/gif_lzw.c (96%)
 rename src/modules/{Image/encodings => _Image_GIF}/gif_lzw.h (94%)
 rename src/modules/{Image/encodings/gif.c => _Image_GIF/image_gif.c} (94%)
 create mode 100644 src/modules/_Image_GIF/testsuite.in

diff --git a/.gitattributes b/.gitattributes
index cd18ea6f12..4db715e485 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -256,9 +256,6 @@ testfont binary
 /src/modules/Image/encodings/configure.in foreign_ident
 /src/modules/Image/encodings/encodings.h foreign_ident
 /src/modules/Image/encodings/gd.c foreign_ident
-/src/modules/Image/encodings/gif.c foreign_ident
-/src/modules/Image/encodings/gif_lzw.c foreign_ident
-/src/modules/Image/encodings/gif_lzw.h foreign_ident
 /src/modules/Image/encodings/hrz.c foreign_ident
 /src/modules/Image/encodings/iff.c foreign_ident
 /src/modules/Image/encodings/ilbm.c foreign_ident
@@ -432,6 +429,12 @@ testfont binary
 /src/modules/_Crypto/rsa.c foreign_ident
 /src/modules/_Crypto/sha.c foreign_ident
 /src/modules/_Crypto/test_crypto.pike foreign_ident
+/src/modules/_Image_GIF/Makefile.in foreign_ident
+/src/modules/_Image_GIF/acconfig.h foreign_ident
+/src/modules/_Image_GIF/configure.in foreign_ident
+/src/modules/_Image_GIF/gif_lzw.c foreign_ident
+/src/modules/_Image_GIF/gif_lzw.h foreign_ident
+/src/modules/_Image_GIF/image_gif.c foreign_ident
 /src/modules/_Image_JPEG/Makefile.in foreign_ident
 /src/modules/_Image_JPEG/acconfig.h foreign_ident
 /src/modules/_Image_JPEG/configure.in foreign_ident
diff --git a/src/modules/Image/acconfig.h b/src/modules/Image/acconfig.h
index 5f9596c444..d9bae7f519 100644
--- a/src/modules/Image/acconfig.h
+++ b/src/modules/Image/acconfig.h
@@ -1,13 +1,10 @@
 /*
- * $Id: acconfig.h,v 1.4 2000/05/29 09:58:24 per Exp $
+ * $Id: acconfig.h,v 1.5 2000/09/11 16:04:55 grubba Exp $
  */
 
 #ifndef IMAGE_MACHINE_H
 #define IMAGE_MACHINE_H
 
-/* define if you want lzw code to generate only rle packing */
-#undef GIF_LZW_RLE
-
 /* nasm exists and can be used to make .o-files */
 #undef ASSEMBLY_OK
 
diff --git a/src/modules/Image/configure.in b/src/modules/Image/configure.in
index 53a98d0c0e..aadd9fe3e7 100644
--- a/src/modules/Image/configure.in
+++ b/src/modules/Image/configure.in
@@ -1,9 +1,7 @@
-# $Id: configure.in,v 1.15 2000/07/28 07:12:44 hubbe Exp $
+# $Id: configure.in,v 1.16 2000/09/11 16:04:56 grubba Exp $
 AC_INIT(image.c)
 AC_CONFIG_HEADER(image_machine.h)
 
-AC_ARG_WITH(gif-rle,      [  --with-gif-rle        use kind-of-rle packing instead of lzw],[AC_DEFINE(GIF_LZW_RLE)],[])
-
 AC_SET_MAKE
 
 AC_MODULE_INIT()
diff --git a/src/modules/Image/encodings/Makefile.in b/src/modules/Image/encodings/Makefile.in
index 37737a38c4..03ff6e4681 100644
--- a/src/modules/Image/encodings/Makefile.in
+++ b/src/modules/Image/encodings/Makefile.in
@@ -1,7 +1,7 @@
-# $Id: Makefile.in,v 1.31 2000/03/21 06:13:23 peter Exp $
+# $Id: Makefile.in,v 1.32 2000/09/11 16:04:57 grubba Exp $
 SRCDIR=@srcdir@
 VPATH=@srcdir@:@srcdir@/../../..:../../..
-OBJS = gif.o gif_lzw.o pnm.o x.o xwd.o png.o any.o bmp.o tga.o pcx.o xbm.o _xpm.o ilbm.o iff.o xcf.o hrz.o avs.o psd.o gd.o wbf.o ras.o pvr.o tim.o
+OBJS = pnm.o x.o xwd.o png.o any.o bmp.o tga.o pcx.o xbm.o _xpm.o ilbm.o iff.o xcf.o hrz.o avs.o psd.o gd.o wbf.o ras.o pvr.o tim.o
 
 @SET_MAKE@
 
diff --git a/src/modules/Image/encodings/any.c b/src/modules/Image/encodings/any.c
index 49f9ec0c3b..0e170b5647 100644
--- a/src/modules/Image/encodings/any.c
+++ b/src/modules/Image/encodings/any.c
@@ -1,9 +1,9 @@
-/* $Id: any.c,v 1.18 2000/07/28 07:13:06 hubbe Exp $ */
+/* $Id: any.c,v 1.19 2000/09/11 16:04:57 grubba Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: any.c,v 1.18 2000/07/28 07:13:06 hubbe Exp $
+**!	$Id: any.c,v 1.19 2000/09/11 16:04:57 grubba Exp $
 **! submodule ANY
 **!
 **!	This method calls the other decoding methods
@@ -23,7 +23,7 @@
 #include <ctype.h>
 
 #include "stralloc.h"
-RCSID("$Id: any.c,v 1.18 2000/07/28 07:13:06 hubbe Exp $");
+RCSID("$Id: any.c,v 1.19 2000/09/11 16:04:57 grubba Exp $");
 #include "pike_macros.h"
 #include "operators.h"
 #include "builtin_functions.h"
@@ -126,7 +126,15 @@ void image_any__decode(INT32 args)
 
       case CHAR2('G','I'):
 	 /* GIF */
-	 image_gif_decode_map(1);
+	 push_text("Image");
+	 push_int(0);
+	 SAFE_APPLY_MASTER("resolv", 2);
+	 push_text("GIF");
+	 f_index(2);
+	 push_text("decode_map");
+	 f_index(2);
+	 stack_swap();
+	 f_call_function(2);
 	 return;
 
       case CHAR2('F','O'):
@@ -246,7 +254,15 @@ void image_any_decode_header(INT32 args)
 
       case CHAR2('G','I'):
 	 /* GIF */
-	 image_gif_decode_map(1);
+	 push_text("Image");
+	 push_int(0);
+	 SAFE_APPLY_MASTER("resolv", 2);
+	 push_text("GIF");
+	 f_index(2);
+	 push_text("decode_map");
+	 f_index(2);
+	 stack_swap();
+	 f_call_function(2);
 	 return;
 
       case CHAR2('F','O'):
diff --git a/src/modules/Image/encodings/configure.in b/src/modules/Image/encodings/configure.in
index c1f24fade4..22bd07900c 100644
--- a/src/modules/Image/encodings/configure.in
+++ b/src/modules/Image/encodings/configure.in
@@ -1,5 +1,5 @@
-# $Id: configure.in,v 1.5 1998/09/20 08:31:22 hubbe Exp $
-AC_INIT(gif.c)
+# $Id: configure.in,v 1.6 2000/09/11 16:04:57 grubba Exp $
+AC_INIT(pnm.c)
 
 AC_SET_MAKE
 
diff --git a/src/modules/Image/encodings/encodings.h b/src/modules/Image/encodings/encodings.h
index d8c1240bbc..b085534a8c 100644
--- a/src/modules/Image/encodings/encodings.h
+++ b/src/modules/Image/encodings/encodings.h
@@ -1,12 +1,10 @@
 /*
- * $Id: encodings.h,v 1.1 2000/07/03 13:30:32 grubba Exp $
+ * $Id: encodings.h,v 1.2 2000/09/11 16:04:58 grubba Exp $
  */
 
 #ifndef IMAGE_ENCODINGS_ENCODINGS_H
 #define IMAGE_ENCODINGS_ENCODINGS_H
 
-void image_gif__decode(INT32 args);
-void image_gif_decode_map(INT32 args);
 void image_pvr_f__decode(INT32 args);
 void image_pvr_f_decode_header(INT32 args);
 void image_tim_f__decode(INT32 args);
diff --git a/src/modules/Image/image.h b/src/modules/Image/image.h
index e3ce16f970..2fc7fb2308 100644
--- a/src/modules/Image/image.h
+++ b/src/modules/Image/image.h
@@ -1,7 +1,7 @@
 /*
 **! module Image
 **! note
-**!	$Id: image.h,v 1.43 2000/08/09 11:27:13 grubba Exp $
+**!	$Id: image.h,v 1.44 2000/09/11 16:04:56 grubba Exp $
 */
 
 #ifdef PIKE_IMAGE_IMAGE_H
@@ -117,19 +117,6 @@ struct color_struct
 #define tColor tOr3(tArr(tInt),tString,tObj)
 #define tLayerMap tMap(tString,tOr4(tString,tColor,tFloat,tInt))
 
-/* COMPAT: encoding of a gif - from togif */
-
-void image_togif(INT32 args);
-void image_togif_fs(INT32 args);
-void image_fromgif(INT32 args);
-void image_gif_begin(INT32 args);
-void image_gif_add(INT32 args);
-void image_gif_add_fs(INT32 args);
-void image_gif_add_nomap(INT32 args);
-void image_gif_add_fs_nomap(INT32 args);
-void image_gif_end(INT32 args);
-void image_gif_netscape_loop(INT32 args);
-
 /* blit.c */
 
 void img_clear(rgb_group *dest, rgb_group rgb, ptrdiff_t size);
diff --git a/src/modules/Image/initstuff.h b/src/modules/Image/initstuff.h
index 6379305073..e1633f5773 100644
--- a/src/modules/Image/initstuff.h
+++ b/src/modules/Image/initstuff.h
@@ -26,7 +26,6 @@ IMAGE_SUBMODULE("ANY",   init_image_any,  exit_image_any  )
 IMAGE_SUBMODULE("AVS",   init_image_avs,  exit_image_avs  ) 
 IMAGE_SUBMODULE("BMP",   init_image_bmp,  exit_image_bmp  ) 
 IMAGE_SUBMODULE("GD",    init_image_gd,   exit_image_gd   )
-IMAGE_SUBMODULE("GIF",   init_image_gif,  exit_image_gif  )
 IMAGE_SUBMODULE("HRZ",   init_image_hrz,  exit_image_hrz  ) 
 IMAGE_SUBMODULE("ILBM",  init_image_ilbm, exit_image_ilbm ) 
 IMAGE_SUBMODULE("PCX",   init_image_pcx,  exit_image_pcx  ) 
diff --git a/src/modules/_Image_GIF/.cvsignore b/src/modules/_Image_GIF/.cvsignore
new file mode 100644
index 0000000000..a2372d7c30
--- /dev/null
+++ b/src/modules/_Image_GIF/.cvsignore
@@ -0,0 +1,15 @@
+.pure
+Makefile
+config.h
+config.h.in 
+config.log
+config.status
+configure
+dependencies
+linker_options
+make_variables
+modlist_headers
+modlist_segment
+module_testsuite
+stamp-h
+stamp-h.in
diff --git a/src/modules/_Image_GIF/.gitignore b/src/modules/_Image_GIF/.gitignore
new file mode 100644
index 0000000000..14854305fb
--- /dev/null
+++ b/src/modules/_Image_GIF/.gitignore
@@ -0,0 +1,15 @@
+/.pure
+/Makefile
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/dependencies
+/linker_options
+/make_variables
+/modlist_headers
+/modlist_segment
+/module_testsuite
+/stamp-h
+/stamp-h.in
diff --git a/src/modules/_Image_GIF/Makefile.in b/src/modules/_Image_GIF/Makefile.in
new file mode 100644
index 0000000000..4a29659d69
--- /dev/null
+++ b/src/modules/_Image_GIF/Makefile.in
@@ -0,0 +1,10 @@
+# $Id: Makefile.in,v 1.1 2000/09/11 16:05:02 grubba Exp $
+@make_variables@
+VPATH=@srcdir@:@srcdir@/../..:../..
+OBJS=image_gif.o gif_lzw.o
+MODULE_LDFLAGS=@LDFLAGS@ @LIBS@
+
+CONFIG_HEADERS=@CONFIG_HEADERS@
+
+@dynamic_module_makefile@
+@dependencies@
diff --git a/src/modules/_Image_GIF/acconfig.h b/src/modules/_Image_GIF/acconfig.h
new file mode 100644
index 0000000000..a17a13508a
--- /dev/null
+++ b/src/modules/_Image_GIF/acconfig.h
@@ -0,0 +1,18 @@
+/*
+ * $Id: acconfig.h,v 1.1 2000/09/11 16:05:02 grubba Exp $
+ */
+
+#ifndef IMAGE_GIF_CONFIG_H
+#define IMAGE_GIF_CONFIG_H
+
+@TOP@
+
+/* Define this to enable gif support */
+#undef WITH_GIF
+
+/* Define if you want lzw code to generate only rle packing */
+#undef GIF_LZW_RLE
+
+@BOTTOM@
+
+#endif /* !IMAGE_GIF_CONFIG_H */
diff --git a/src/modules/_Image_GIF/configure.in b/src/modules/_Image_GIF/configure.in
new file mode 100644
index 0000000000..9b108fa817
--- /dev/null
+++ b/src/modules/_Image_GIF/configure.in
@@ -0,0 +1,18 @@
+#
+# $Id: configure.in,v 1.1 2000/09/11 16:05:03 grubba Exp $
+#
+AC_INIT(image_gif.c)
+AC_CONFIG_HEADER(config.h)
+AC_ARG_WITH(gif,     [  --with(out)-gif       Support GIF (Image.GIF)],[],[with_gif=yes])
+AC_ARG_WITH(gif-rle, [  --with-gif-rle        use kind-of-rle packing instead of lzw],[],[with_gif_rle=no])
+AC_MODULE_INIT()
+
+if test x$with_gif = xyes ; then
+  AC_DEFINE(WITH_GIF)
+
+  if test x$with_gif_rle = xyes ; then
+    AC_DEFINE(GIF_LZW_RLE)
+  fi
+fi
+
+AC_OUTPUT(Makefile,echo FOO >stamp-h )
diff --git a/src/modules/Image/encodings/gif_lzw.c b/src/modules/_Image_GIF/gif_lzw.c
similarity index 96%
rename from src/modules/Image/encodings/gif_lzw.c
rename to src/modules/_Image_GIF/gif_lzw.c
index 05fef84c84..5f435ac2bf 100644
--- a/src/modules/Image/encodings/gif_lzw.c
+++ b/src/modules/_Image_GIF/gif_lzw.c
@@ -1,11 +1,15 @@
 /*
 **! module Image
 **! note
-**!	$Id: gif_lzw.c,v 1.9 2000/09/08 15:53:32 grubba Exp $
+**!	$Id: gif_lzw.c,v 1.1 2000/09/11 16:05:03 grubba Exp $
 */
 
 #include "global.h"
-#include "image_machine.h"
+#include "config.h"
+
+#ifdef WITH_GIF
+
+#include "../Image/image_machine.h"
 #include "gif_lzw.h"
 
 /* MUST BE INCLUDED LAST */
@@ -218,3 +222,5 @@ void image_gif_lzw_add(struct gif_lzw *lzw, unsigned char *data, size_t len)
 {
    while (len--) lzw_add(lzw,*(data++));
 }
+
+#endif /* WITH_GIF */
diff --git a/src/modules/Image/encodings/gif_lzw.h b/src/modules/_Image_GIF/gif_lzw.h
similarity index 94%
rename from src/modules/Image/encodings/gif_lzw.h
rename to src/modules/_Image_GIF/gif_lzw.h
index 367fa00a2d..2feb999989 100644
--- a/src/modules/Image/encodings/gif_lzw.h
+++ b/src/modules/_Image_GIF/gif_lzw.h
@@ -1,7 +1,7 @@
 /*
 **! module Image
 **! note
-**!	$Id: gif_lzw.h,v 1.8 2000/08/03 21:25:32 grubba Exp $
+**!	$Id: gif_lzw.h,v 1.1 2000/09/11 16:05:04 grubba Exp $
 */
 
 typedef unsigned short lzwcode_t; /* no more than 12 bits used */
diff --git a/src/modules/Image/encodings/gif.c b/src/modules/_Image_GIF/image_gif.c
similarity index 94%
rename from src/modules/Image/encodings/gif.c
rename to src/modules/_Image_GIF/image_gif.c
index 9e69e77f8f..c6dc55d329 100644
--- a/src/modules/Image/encodings/gif.c
+++ b/src/modules/_Image_GIF/image_gif.c
@@ -1,9 +1,9 @@
-/* $Id: gif.c,v 1.60 2000/08/19 11:15:40 grubba Exp $ */
+/* $Id: image_gif.c,v 1.1 2000/09/11 16:05:04 grubba Exp $ */
 
 /*
 **! module Image
 **! note
-**!	$Id: gif.c,v 1.60 2000/08/19 11:15:40 grubba Exp $
+**!	$Id: image_gif.c,v 1.1 2000/09/11 16:05:04 grubba Exp $
 **! submodule GIF
 **!
 **!	This submodule keep the GIF encode/decode capabilities
@@ -27,11 +27,15 @@
 */
 #include "global.h"
 
+#include "config.h"
+
+#ifdef WITH_GIF
+
 #include <math.h>
 #include <ctype.h>
 
 #include "stralloc.h"
-RCSID("$Id: gif.c,v 1.60 2000/08/19 11:15:40 grubba Exp $");
+RCSID("$Id: image_gif.c,v 1.1 2000/09/11 16:05:04 grubba Exp $");
 #include "pike_macros.h"
 #include "object.h"
 #include "constants.h"
@@ -42,8 +46,9 @@ RCSID("$Id: gif.c,v 1.60 2000/08/19 11:15:40 grubba Exp $");
 #include "error.h"
 #include "threads.h"
 
-#include "image.h"
-#include "colortable.h"
+#include "../Image/image.h"
+#include "../Image/colortable.h"
+
 #include "builtin_functions.h"
 #include "operators.h"
 #include "mapping.h"
@@ -51,14 +56,18 @@ RCSID("$Id: gif.c,v 1.60 2000/08/19 11:15:40 grubba Exp $");
 
 #include "gif_lzw.h"
 
-#include "encodings.h"
-
 /* MUST BE INCLUDED LAST */
 #include "module_magic.h"
 
-extern struct program *image_colortable_program;
+#ifdef DYNAMIC_MODULE
+static struct program *image_program = NULL;
+static struct program *image_colortable_program = NULL;
+static struct program *image_layer_program = NULL;
+#else
 extern struct program *image_program;
+extern struct program *image_colortable_program;
 extern struct program *image_layer_program;
+#endif /* DYNAMIC_MODULE */
 
 enum 
 {
@@ -2695,69 +2704,99 @@ static void image_gif_lzw_decode(INT32 args)
 
 struct program *image_encoding_gif_program=NULL;
 
-void init_image_gif(void)
+void pike_module_init(void)
 {
+#ifdef DYNAMIC_MODULE
+   push_string(make_shared_string("Image"));
+   push_int(0);
+   SAFE_APPLY_MASTER("resolv",2);
+   if (sp[-1].type==T_OBJECT) 
+   {
+      stack_dup();
+      stack_dup();
+      push_string(make_shared_string("Image"));
+      f_index(2);
+      image_program=program_from_svalue(sp-1);
+      pop_stack();
+      push_string(make_shared_string("Colortable"));
+      f_index(2);
+      image_colortable_program=program_from_svalue(sp-1);
+      pop_stack();
+      push_string(make_shared_string("Layer"));
+      f_index(2);
+      image_layer_program=program_from_svalue(sp-1);
+   }
+   pop_stack();
+#endif /* DYNAMIC_MODULE */
+
+   if (image_program && image_colortable_program && image_layer_program) {
+      add_function("render_block",image_gif_render_block,
+ 		   "function(object,object,void|int,void|int,void|int,void|object,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)"
+ 		   "|function(object,object,void|int,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)",0);
+      add_function("_gce_block",image_gif__gce_block,
+ 		   "function(int,int,int,int,int:string)",0);
+      add_function("_render_block",image_gif__render_block,
+ 		   "function(int,int,int,int,string,void|string,int:string)",0);
+      add_function("header_block",image_gif_header_block,
+ 		   "function(int,int,int|object,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)",0);
+      add_function("end_block",image_gif_end_block,
+ 		   "function(:string)",0);
+      add_function("encode",image_gif_encode,
+ 		   "function(object,mixed...:string)",0);
+      add_function("encode_trans",image_gif_encode,
+ 		   "function(object,mixed...:string)",0);
+      add_function("encode_fs",image_gif_encode_fs,
+ 		   "function(object,mixed...:string)",0);
+      add_function("netscape_loop_block",image_gif_netscape_loop_block,
+ 		   "function(int|void:string)",0);
    
-   add_function("render_block",image_gif_render_block,
-		"function(object,object,void|int,void|int,void|int,void|object,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)"
-		"|function(object,object,void|int,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)",0);
-   add_function("_gce_block",image_gif__gce_block,
-		"function(int,int,int,int,int:string)",0);
-   add_function("_render_block",image_gif__render_block,
-		"function(int,int,int,int,string,void|string,int:string)",0);
-   add_function("header_block",image_gif_header_block,
-		"function(int,int,int|object,void|int,void|int,void|int,void|int,void|int,void|int,void|int:string)",0);
-   add_function("end_block",image_gif_end_block,
-		"function(:string)",0);
-   add_function("encode",image_gif_encode,
-		"function(object,mixed...:string)",0);
-   add_function("encode_trans",image_gif_encode,
-		"function(object,mixed...:string)",0);
-   add_function("encode_fs",image_gif_encode_fs,
-		"function(object,mixed...:string)",0);
-   add_function("netscape_loop_block",image_gif_netscape_loop_block,
-		"function(int|void:string)",0);
-
-   add_function("__decode",image_gif___decode,
-		"function(string:array)",0);
-   add_function("_decode",image_gif__decode,
-		"function(string|array:array)",0);
-   add_function("decode",image_gif_decode,
-		"function(string|array:object)",0);
-   add_function("decode_layers",image_gif_decode_layers,
-		"function(string|array:array(object))",0);
-   add_function("decode_layer",image_gif_decode_layer,
-		"function(string|array:object)",0);
-   add_function("decode_map",image_gif_decode_map,
-		"function(string|array:mapping)",0);
-
-   add_function("_encode",image_gif__encode,
-		"function(array:string)",0);
-   add_function("_encode_render",image_gif__encode_render,
-		"function(array:string)",0);
-   add_function("_encode_extension",image_gif__encode_extension,
-		"function(array:string)",0);
-
-   add_function("lzw_encode",image_gif_lzw_encode,
-		"function(string,void|int,void|int:string)",0);
-   add_function("lzw_decode",image_gif_lzw_decode,
-		"function(string,void|int,void|int:string)",0);
-
-   /** constants **/
-
-   add_integer_constant("RENDER",GIF_RENDER,0);
-   add_integer_constant("EXTENSION",GIF_EXTENSION,0);
-
-   add_integer_constant("LOOSE_GCE",GIF_LOOSE_GCE,0);
-   add_integer_constant("NETSCAPE_LOOP",GIF_NETSCAPE_LOOP,0);
-
-   add_integer_constant("ERROR_PREMATURE_EOD",GIF_ERROR_PREMATURE_EOD,0);
-   add_integer_constant("ERROR_UNKNOWN_DATA",GIF_ERROR_UNKNOWN_DATA,0);
-   add_integer_constant("ERROR_TOO_MUCH_DATA",GIF_ERROR_TOO_MUCH_DATA,0);
-
-   /** done **/
+      add_function("__decode",image_gif___decode,
+ 		   "function(string:array)",0);
+      add_function("_decode",image_gif__decode,
+ 		   "function(string|array:array)",0);
+      add_function("decode",image_gif_decode,
+ 		   "function(string|array:object)",0);
+      add_function("decode_layers",image_gif_decode_layers,
+ 		   "function(string|array:array(object))",0);
+      add_function("decode_layer",image_gif_decode_layer,
+ 		   "function(string|array:object)",0);
+      add_function("decode_map",image_gif_decode_map,
+ 		   "function(string|array:mapping)",0);
+   
+      add_function("_encode",image_gif__encode,
+ 		   "function(array:string)",0);
+      add_function("_encode_render",image_gif__encode_render,
+ 		   "function(array:string)",0);
+      add_function("_encode_extension",image_gif__encode_extension,
+ 		   "function(array:string)",0);
+   
+      add_function("lzw_encode",image_gif_lzw_encode,
+ 		   "function(string,void|int,void|int:string)",0);
+      add_function("lzw_decode",image_gif_lzw_decode,
+ 		   "function(string,void|int,void|int:string)",0);
+   
+      /** constants **/
+   
+      add_integer_constant("RENDER",GIF_RENDER,0);
+      add_integer_constant("EXTENSION",GIF_EXTENSION,0);
+   
+      add_integer_constant("LOOSE_GCE",GIF_LOOSE_GCE,0);
+      add_integer_constant("NETSCAPE_LOOP",GIF_NETSCAPE_LOOP,0);
+   
+      add_integer_constant("ERROR_PREMATURE_EOD",GIF_ERROR_PREMATURE_EOD,0);
+      add_integer_constant("ERROR_UNKNOWN_DATA",GIF_ERROR_UNKNOWN_DATA,0);
+      add_integer_constant("ERROR_TOO_MUCH_DATA",GIF_ERROR_TOO_MUCH_DATA,0);
+   
+      /** done **/
+   }
+}
+
+#else /* !WITH_GIF */
+void pike_module_init(void)
+{
 }
+#endif /* WITH_GIF */
 
-void exit_image_gif(void)
+void pike_module_exit(void)
 {
 }
diff --git a/src/modules/_Image_GIF/testsuite.in b/src/modules/_Image_GIF/testsuite.in
new file mode 100644
index 0000000000..83b9737464
--- /dev/null
+++ b/src/modules/_Image_GIF/testsuite.in
@@ -0,0 +1,3 @@
+cond([[ master()->resolv("_Image_GIF")->encode ]],
+[[
+]])
-- 
GitLab