Tinyscheme on win32 (with msvc)
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Tinyscheme on win32 (with msvc) | Hans Breuer | 27 Oct 18:03 |
Tinyscheme on win32 (with msvc) | Kevin Cozens | 28 Oct 01:59 |
Tinyscheme on win32 (with msvc) | Kevin Cozens | 02 Nov 07:01 |
Tinyscheme on win32 (with msvc) | Hans Breuer | 06 Nov 18:40 |
Tinyscheme on win32 (with msvc)
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 by #ifdef WIN32.
* plug-ins/script-fu/tinyscheme/scheme.h : export scheme_set_input_port_file
* plug-ins/script-fu/tinyscheme/scheme.c : include 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
+#ifndef WIN32
#include
+#endif
#include
#include
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
+#else
+# include
+# define access(f,a) _access(f,a)
#endif
#if USE_DL
# include "dynload.h"
@@ -72,7 +75,8 @@
# include
#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);
Tinyscheme on win32 (with msvc)
Hans Breuer wrote:
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.
[snip]
Ok to commit?
Thanks for the patches, Hans. It looks like some of the changes would be ready to commit. I will take a closer look at them.
A global change of stricmp to g_utf8_collate is not something I want to do. I also don't think it is neccessary. I want to keep the number of changes between the TinyScheme version I use and the original version to a minimum to make it easier to track changes to the original version of TinyScheme.
Tinyscheme on win32 (with msvc)
Hans Breuer wrote:
To make the new script-fu compile and work on win32 with msvc some small source adaptions were necessary.
I've been looking over the patches. I have updated my copy of the source with some of the proposed changes.
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.
I'm still thinking about using SCHEME_EXPORT on ts_output_routine(). I agree about using it on a couple of the other functions. I also found one other missing function missing SCHEME_EXPORT in its declaration.
* plug-ins/script-fu/ftx/ftx.c : wrap #include by #ifdef WIN32.
[snip]
* plug-ins/script-fu/tinyscheme/scheme.c : include and define access() to _access(). Avoid redefining stricmp() for the msvc case. It already is exported from C runtime library.
The proposed MSVC specific changes should be attached to a bugzilla report. Those changes need to be checked by people using other compilers in Windows before the changes get commited to CVS.
The #ifndef USE_STRCASECMP there seems strange cause even for the mscv
Looking at this issue I realized that the USE_STRCASECMP became obsolete with the addition of the support for UTF-8 coded characters. I will be commiting a fix for this at the same time as the SCHEME_EXPORT changes.
Tinyscheme on win32 (with msvc)
On 02.11.2006 07:01, Kevin Cozens wrote:
Hans Breuer wrote:
To make the new script-fu compile and work on win32 with msvc some small source adaptions were necessary.
I've been looking over the patches. I have updated my copy of the source with some of the proposed changes.
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.
I'm still thinking about using SCHEME_EXPORT on ts_output_routine(). I agree about using it on a couple of the other functions. I also found one other missing function missing SCHEME_EXPORT in its declaration.
There are some unused functions which could be exported, but they are not yet necessary for the new script-fu. The function pointer is.
* plug-ins/script-fu/ftx/ftx.c : wrap #include by #ifdef WIN32.
[snip]
* plug-ins/script-fu/tinyscheme/scheme.c : include and define access() to _access(). Avoid redefining stricmp() for the msvc case. It already is exported from C runtime library.
The proposed MSVC specific changes should be attached to a bugzilla report. Those changes need to be checked by people using other compilers in Windows before the changes get commited to CVS.
GIMP on win32 gets build with mingw and msvc for a while. I'm not aware of any other compilers used. The two mentioned both use the microsoft runtime and changes like this were done without any period of rest in bugzilla. See for example libgimpbase/gimpwin32-io.h
The #ifndef USE_STRCASECMP there seems strange cause even for the mscv
Looking at this issue I realized that the USE_STRCASECMP became obsolete with the addition of the support for UTF-8 coded characters. I will be commiting a fix for this at the same time as the SCHEME_EXPORT changes.
Thanks,
Hans
-------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert