To make the new script-fu compile and work on win32 with msvc some small source adaptions were necessary. IMO most of them are ready to commit, but especially with the stricmp usage I'd like some advice. Suggested ChangeLog entry for the rest of the patch.

  * plug-ins/script-fu/tinyscheme/scheme.c
    plug-ins/script-fu/scheme-wrapper.c : mark the function pointer
  ts_output_routine as SCHEME_EXPORT. It is defined in the scheme library
  and used (imported) by the script-fu executable.

  * plug-ins/script-fu/ftx/ftx.c : wrap #include <unistd.h> by
  #ifdef WIN32.

  * plug-ins/script-fu/tinyscheme/scheme.h : export

  * plug-ins/script-fu/tinyscheme/scheme.c : include <io.h> and define
  access() to _access(). Avoid redefining stricmp() for the msvc case.
  It already is exported from C runtime library.

The #ifndef USE_STRCASECMP there seems strange cause even for the mscv case (_MSC_VER) it is defined as '# define USE_STRCASECMP 0'. But as outlined it seems to be not necessary in any case. Just drop stricmp() and use g_utf8_collate() everywhere.

Ok to commit?


-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it.                -- Dilbert
diff --exclude-from=c:\util\tool\diff.ign -u --recursive 
--- from-cvs/gimp/plug-ins/script-fu/ftx/ftx.c  Wed Oct 06 23:47:13 2004
+++ my-gtk/gimp/plug-ins/script-fu/ftx/ftx.c    Sun Oct 22 18:33:11 2006
@@ -7,7 +7,9 @@
 #include <sys/stat.h>
+#ifndef WIN32
 #include <unistd.h>
 #include <time.h>
 #include <glib.h>
diff --exclude-from=c:\util\tool\diff.ign -u --recursive 
--- from-cvs/gimp/plug-ins/script-fu/scheme-wrapper.c   Fri Oct 27 16:42:54 2006
+++ my-gtk/gimp/plug-ins/script-fu/scheme-wrapper.c     Fri Oct 27 17:12:19 2006
@@ -49,7 +49,7 @@
 static int   ts_console_mode;
-extern void *ts_output_routine;
+SCHEME_EXPORT void *ts_output_routine;
 #undef cons
diff --exclude-from=c:\util\tool\diff.ign -u --recursive 
--- from-cvs/gimp/plug-ins/script-fu/tinyscheme/scheme.c        Thu Oct 19 
16:25:01 2006
+++ my-gtk/gimp/plug-ins/script-fu/tinyscheme/scheme.c  Fri Oct 27 17:15:19 2006
@@ -25,6 +25,9 @@
 #ifndef WIN32
 # include <unistd.h>
+# include <io.h>
+# define access(f,a) _access(f,a)
 #if USE_DL
 # include "dynload.h"
@@ -72,7 +75,8 @@
 # include <malloc.h>
 #endif /* macintosh */
+/* instead of this stricmp tweaks why not use GLib's g_utf8_collate() 
unconditionally? */
+#if !defined USE_STRCASECMP || defined _MSC_VER
 #define stricmp g_utf8_collate
 static int stricmp(const char *s1, const char *s2)
@@ -114,7 +118,7 @@
 # define FIRST_CELLSEGS 3
-void (*ts_output_routine) (FILE *, char *, int);
+SCHEME_EXPORT void (*ts_output_routine) (FILE *, char *, int);
 static num num_add(num a, num b);
 static num num_mul(num a, num b);
diff --exclude-from=c:\util\tool\diff.ign -u --recursive 
--- from-cvs/gimp/plug-ins/script-fu/tinyscheme/scheme.h        Thu May 18 
23:32:28 2006
+++ my-gtk/gimp/plug-ins/script-fu/tinyscheme/scheme.h  Sun Oct 22 18:40:31 2006
@@ -121,7 +121,7 @@
 SCHEME_EXPORT int scheme_init(scheme *sc);
 SCHEME_EXPORT int scheme_init_custom_alloc(scheme *sc, func_alloc, 
 SCHEME_EXPORT void scheme_deinit(scheme *sc);
-void scheme_set_input_port_file(scheme *sc, FILE *fin);
+SCHEME_EXPORT void scheme_set_input_port_file(scheme *sc, FILE *fin);
 void scheme_set_input_port_string(scheme *sc, char *start, char *past_the_end);
 SCHEME_EXPORT void scheme_set_output_port_file(scheme *sc, FILE *fin);
 void scheme_set_output_port_string(scheme *sc, char *start, char 
Gimp-developer mailing list

Reply via email to