Tinyscheme on win32 (with msvc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
  scheme_set_input_port_file

  * 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?

Thanks,
	Hans

-------- 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 my-gtk/gimp/plug-ins/script-fu/ftx/ftx.c
--- 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>
+#endif
 #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 my-gtk/gimp/plug-ins/script-fu/scheme-wrapper.c
--- 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 my-gtk/gimp/plug-ins/script-fu/tinyscheme/scheme.c
--- 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 @@
 #define _SCHEME_SOURCE
 #ifndef WIN32
 # include <unistd.h>
+#else
+# include <io.h>
+# define access(f,a) _access(f,a)
 #endif
 #if USE_DL
 # include "dynload.h"
@@ -72,7 +75,8 @@
 # include <malloc.h>
 #endif /* macintosh */
 
-#ifndef USE_STRCASECMP
+/* 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
 #else
 static int stricmp(const char *s1, const char *s2)
@@ -114,7 +118,7 @@
 # define FIRST_CELLSEGS 3
 #endif
 
-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 my-gtk/gimp/plug-ins/script-fu/tinyscheme/scheme.h
--- 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, func_dealloc);
 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 *past_the_end);
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux