diff -aur --strip-trailing-cr filmgimp-0.7/app/about_dialog.c filmgimp-0.7-new/app/about_dialog.c --- filmgimp-0.7/app/about_dialog.c 2002-11-05 23:44:48.000000000 -0800 +++ filmgimp-0.7-new/app/about_dialog.c 2003-01-10 11:25:23.000000000 -0800 @@ -21,13 +21,19 @@ #include -#include "libgimp/gimpfeatures.h" +#include "plug-ins/gimpfeatures.h" #include "about_dialog.h" #include "interface.h" #include "config.h" #include "minimize.h" +#include "datadir.h" + +#ifdef WIN32 +#include "unistd.h" +#include "extra.h" +#endif #define ANIMATION_STEPS 16 #define ANIMATION_SIZE 2 diff -aur --strip-trailing-cr filmgimp-0.7/app/airbrush.c filmgimp-0.7-new/app/airbrush.c --- filmgimp-0.7/app/airbrush.c 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/airbrush.c 2002-11-11 00:32:29.000000000 -0800 @@ -203,7 +203,7 @@ tool = paint_core_new (AIRBRUSH); private = (PaintCore *) tool->private; - private->paint_func = airbrush_paint_func; + private->paint_func = (PaintFunc16) airbrush_paint_func; private->painthit_setup = airbrush_painthit_setup; return tool; @@ -411,7 +411,7 @@ if (success) { /* set the paint core's paint func */ - non_gui_paint_core.paint_func = airbrush_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) airbrush_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/app_procs.c filmgimp-0.7-new/app/app_procs.c --- filmgimp-0.7/app/app_procs.c 2002-11-05 22:24:24.000000000 -0800 +++ filmgimp-0.7-new/app/app_procs.c 2003-02-08 13:41:34.000000000 -0800 @@ -19,15 +19,18 @@ #include #include #include + +#ifdef WIN32 + +#else #include +#endif + #include #include - #include - -#include "libgimp/gimpfeatures.h" - -#include "libgimp/gimpfeatures.h" +#include "plug-ins/gimpfeatures.h" +#include "datadir.h" #include "appenv.h" #include "app_procs.h" @@ -53,7 +56,7 @@ #include "paint_funcs_area.h" #include "palette.h" #include "patterns.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "procedural_db.h" #include "tile_swap.h" #include "tips_dialog.h" @@ -68,6 +71,11 @@ #include "displaylut.h" #include "config.h" +#include "../plug-ins/gimpwire.h" + +#ifdef WIN32 +#define g_message printf +#endif #define LOGO_WIDTH_MIN 350 #define LOGO_HEIGHT_MIN 110 @@ -593,7 +601,7 @@ if (swap_path == NULL) swap_path = "/tmp"; path = g_new (gchar, strlen (swap_path) + 32); - sprintf (path, "%s/gimpswap.%ld", swap_path, (long)getpid ()); + sprintf (path, "%s/swapfile.%ld", swap_path, (long)getpid ()); tile_swap_add (path, NULL, NULL); g_free (path); diff -aur --strip-trailing-cr filmgimp-0.7/app/app_procs.h filmgimp-0.7-new/app/app_procs.h --- filmgimp-0.7/app/app_procs.h 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/app_procs.h 2002-11-10 21:06:49.000000000 -0800 @@ -18,6 +18,10 @@ #ifndef __APP_PROCS_H__ #define __APP_PROCS_H__ +#ifdef WIN32 +typedef int key_t; +#endif + /* Function declarations */ void gimp_init (int, char **); gint32 gimp_shmem_init (int p, key_t k, int s, long o, int xs, int ys); diff -aur --strip-trailing-cr filmgimp-0.7/app/appenv.h filmgimp-0.7-new/app/appenv.h --- filmgimp-0.7/app/appenv.h 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/appenv.h 2002-11-10 20:14:51.000000000 -0800 @@ -18,7 +18,12 @@ #ifndef __APPENV_H__ #define __APPENV_H__ -#include "gdk/gdkx.h" +#ifdef WIN32 +# include +#else +# include +#endif + #include "gtk/gtk.h" #define DISPLAY ((Display *) GDK_DISPLAY()) diff -aur --strip-trailing-cr filmgimp-0.7/app/base_frame_manager.c filmgimp-0.7-new/app/base_frame_manager.c --- filmgimp-0.7/app/base_frame_manager.c 2002-11-07 13:16:00.000000000 -0800 +++ filmgimp-0.7-new/app/base_frame_manager.c 2003-01-23 15:32:31.000000000 -0800 @@ -439,8 +439,9 @@ /* The procedure definition */ ProcArg bfm_set_dir_args[] = -{ +{ PDB_END }; +/* rower: added PDB_END to make compile in vc++ */ ProcArg bfm_set_dir_out_args[] = { diff -aur --strip-trailing-cr filmgimp-0.7/app/batch.c filmgimp-0.7-new/app/batch.c --- filmgimp-0.7/app/batch.c 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/batch.c 2003-02-08 13:41:35.000000000 -0800 @@ -10,6 +10,9 @@ #include "batch.h" #include "procedural_db.h" +#ifdef WIN32 +#define g_message printf +#endif static void batch_run_cmd (char *cmd); static void batch_read (gpointer data, diff -aur --strip-trailing-cr filmgimp-0.7/app/bezier_select.c filmgimp-0.7-new/app/bezier_select.c --- filmgimp-0.7/app/bezier_select.c 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/bezier_select.c 2003-02-08 13:49:09.000000000 -0800 @@ -34,6 +34,11 @@ #include "pixelrow.h" #include "pixel_region.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + #define BEZIER_START 1 #define BEZIER_ADD 2 #define BEZIER_EDIT 4 diff -aur --strip-trailing-cr filmgimp-0.7/app/blend.c filmgimp-0.7-new/app/blend.c --- filmgimp-0.7/app/blend.c 2002-11-07 20:42:13.000000000 -0800 +++ filmgimp-0.7-new/app/blend.c 2003-02-08 13:41:35.000000000 -0800 @@ -43,6 +43,9 @@ #include "float16.h" +#ifdef WIN32 +#define g_message printf +#endif #define IM_FILM_LOOKUP_START 14862 #define IM_FILM_LOOKUP_END 16726 diff -aur --strip-trailing-cr filmgimp-0.7/app/boundary.c filmgimp-0.7-new/app/boundary.c --- filmgimp-0.7/app/boundary.c 2002-11-07 13:18:06.000000000 -0800 +++ filmgimp-0.7-new/app/boundary.c 2003-02-08 13:41:35.000000000 -0800 @@ -25,6 +25,10 @@ #include "canvas.h" #include "pixelarea.h" +#ifdef WIN32 +#define g_message printf +#endif + /* half intensity for mask */ #define HALF_WAY 127 #define HALF_WAY_16BIT 32767 diff -aur --strip-trailing-cr filmgimp-0.7/app/brightness_contrast.c filmgimp-0.7-new/app/brightness_contrast.c --- filmgimp-0.7/app/brightness_contrast.c 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/brightness_contrast.c 2003-02-08 13:41:35.000000000 -0800 @@ -33,6 +33,10 @@ #include "pixelrow.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 45 #define TEXT_HEIGHT 25 #define SLIDER_WIDTH 200 diff -aur --strip-trailing-cr filmgimp-0.7/app/brush_select.c filmgimp-0.7-new/app/brush_select.c --- filmgimp-0.7/app/brush_select.c 2002-09-28 14:31:17.000000000 -0700 +++ filmgimp-0.7-new/app/brush_select.c 2003-02-08 13:41:35.000000000 -0800 @@ -37,6 +37,10 @@ #include "minimize.h" #include "gimprc.h" +#ifdef WIN32 +#define g_message printf +#endif + #define STD_CELL_WIDTH 24 #define STD_CELL_HEIGHT 24 diff -aur --strip-trailing-cr filmgimp-0.7/app/bucket_fill.c filmgimp-0.7-new/app/bucket_fill.c --- filmgimp-0.7/app/bucket_fill.c 2002-11-07 13:20:20.000000000 -0800 +++ filmgimp-0.7-new/app/bucket_fill.c 2003-02-08 13:49:09.000000000 -0800 @@ -34,6 +34,10 @@ #include "tools.h" #include "undo.h" +#ifdef WIN32 +#include +#define g_message printf +#endif /* the Bucket Fill structures */ typedef enum diff -aur --strip-trailing-cr filmgimp-0.7/app/canvas.c filmgimp-0.7-new/app/canvas.c --- filmgimp-0.7/app/canvas.c 2002-09-28 14:31:10.000000000 -0700 +++ filmgimp-0.7-new/app/canvas.c 2002-11-24 14:37:20.000000000 -0800 @@ -22,8 +22,17 @@ #include "flatbuf.h" #include "shmbuf.h" #include "tilebuf.h" + +#ifdef WIN32 +#undef RGB +#endif + #include "trace.h" +#ifdef WIN32 +#undef RGB +#endif + struct _Canvas { diff -aur --strip-trailing-cr filmgimp-0.7/app/channel.c filmgimp-0.7-new/app/channel.c --- filmgimp-0.7/app/channel.c 2002-09-28 14:31:18.000000000 -0700 +++ filmgimp-0.7-new/app/channel.c 2002-11-12 20:32:24.000000000 -0800 @@ -917,7 +917,7 @@ void * pr; if (!mask) - return NULL; + return 0; if (mask->bounds_known) { diff -aur --strip-trailing-cr filmgimp-0.7/app/channels_dialog.c filmgimp-0.7-new/app/channels_dialog.c --- filmgimp-0.7/app/channels_dialog.c 2002-09-28 14:31:18.000000000 -0700 +++ filmgimp-0.7-new/app/channels_dialog.c 2003-02-08 21:48:36.000000000 -0800 @@ -55,6 +55,10 @@ #include "channel_pvt.h" #include "pixelarea.h" +#ifdef WIN32 +#define g_error printf +#endif + #define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK #define BUTTON_EVENT_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | \ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -646,7 +650,7 @@ break; case Auxillary: case Matte: - g_error ("error in %s at %d: this shouldn't happen.", + g_error ("error Matte in %s at %d: this shouldn't happen.", __FILE__, __LINE__); break; } @@ -701,7 +705,7 @@ break; case Auxillary: case Matte: - g_error ("error in %s at %d: this shouldn't happen.", + g_error ("error Matte[2] in %s at %d: this shouldn't happen.", __FILE__, __LINE__); break; } diff -aur --strip-trailing-cr filmgimp-0.7/app/clone.c filmgimp-0.7-new/app/clone.c --- filmgimp-0.7/app/clone.c 2002-09-28 14:31:18.000000000 -0700 +++ filmgimp-0.7-new/app/clone.c 2003-02-08 13:41:35.000000000 -0800 @@ -39,6 +39,11 @@ #include "devices.h" #include "base_frame_manager.h" +#ifdef WIN32 +#include "extra.h" +#define g_message printf +#endif + #define TARGET_HEIGHT 15 #define TARGET_WIDTH 15 @@ -672,8 +677,8 @@ tool = paint_core_new (CLONE); private = (PaintCore *) tool->private; - private->paint_func = clone_paint_func; - private->cursor_func = clone_cursor_func; + private->paint_func = (PaintFunc16) clone_paint_func; + private->cursor_func = (PaintFunc16) clone_cursor_func; private->painthit_setup = clone_painthit_setup; private->core->draw_func = clone_draw; diff -aur --strip-trailing-cr filmgimp-0.7/app/color_balance.c filmgimp-0.7-new/app/color_balance.c --- filmgimp-0.7/app/color_balance.c 2002-09-28 14:31:18.000000000 -0700 +++ filmgimp-0.7-new/app/color_balance.c 2003-02-08 13:41:35.000000000 -0800 @@ -35,6 +35,10 @@ #include "pixelrow.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 55 #define SQR(x) ((x) * (x)) diff -aur --strip-trailing-cr filmgimp-0.7/app/colormaps.c filmgimp-0.7-new/app/colormaps.c --- filmgimp-0.7/app/colormaps.c 2002-09-28 14:31:19.000000000 -0700 +++ filmgimp-0.7-new/app/colormaps.c 2003-01-31 15:19:34.000000000 -0800 @@ -30,7 +30,7 @@ #include "palette.h" #include "patterns.h" #include "pixelrow.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "tile_swap.h" diff -aur --strip-trailing-cr filmgimp-0.7/app/commands.c filmgimp-0.7-new/app/commands.c --- filmgimp-0.7/app/commands.c 2002-09-28 14:31:19.000000000 -0700 +++ filmgimp-0.7-new/app/commands.c 2003-02-08 13:41:35.000000000 -0800 @@ -64,7 +64,7 @@ #include "palette.h" #include "frame_manager.h" #include "patterns.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "posterize.h" #include "resize.h" #include "scale.h" @@ -82,6 +82,9 @@ #include "cursorutil.h" #include "base_frame_manager.h" +#ifdef WIN32 +#define g_message printf +#endif /* external functions */ extern void layers_dialog_layer_merge_query (GImage *, int); diff -aur --strip-trailing-cr filmgimp-0.7/app/convert.c filmgimp-0.7-new/app/convert.c --- filmgimp-0.7/app/convert.c 2002-09-28 14:31:20.000000000 -0700 +++ filmgimp-0.7-new/app/convert.c 2003-02-08 21:48:36.000000000 -0800 @@ -76,6 +76,12 @@ #include "layer_pvt.h" +#ifdef WIN32 +#include +#define g_message printf +#define g_error printf +#endif + static Argument * convert_rgb_invoker (Argument *); static Argument * convert_grayscale_invoker (Argument *); static Argument * convert_indexed_invoker (Argument *); diff -aur --strip-trailing-cr filmgimp-0.7/app/convolve.c filmgimp-0.7-new/app/convolve.c --- filmgimp-0.7/app/convolve.c 2002-09-28 14:31:20.000000000 -0700 +++ filmgimp-0.7-new/app/convolve.c 2002-11-12 21:27:39.000000000 -0800 @@ -223,7 +223,7 @@ tool = paint_core_new (CONVOLVE); private = (PaintCore *) tool->private; - private->paint_func = convolve_paint_func; + private->paint_func = (PaintFunc16) convolve_paint_func; private->painthit_setup = convolve_painthit_setup; return tool; @@ -584,7 +584,7 @@ calculate_matrix (type, pressure); /* set the paint core's paint func */ - non_gui_paint_core.paint_func = convolve_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) convolve_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/cursorutil.c filmgimp-0.7-new/app/cursorutil.c --- filmgimp-0.7/app/cursorutil.c 2002-09-28 14:31:20.000000000 -0700 +++ filmgimp-0.7-new/app/cursorutil.c 2003-01-29 10:57:55.000000000 -0800 @@ -130,6 +130,8 @@ gdk_cursor_destroy (cursor); } +/* #define CURSOR_DEBUG */ + void change_win_cursor (win, cursortype) GdkWindow *win; @@ -154,6 +156,9 @@ return; } cursor = gdk_cursor_new (cursortype); +#ifdef CURSOR_DEBUG + printf("gdk_window_set_cursor (%x, %x) \n",win,cursor); +#endif gdk_window_set_cursor (win, cursor); gdk_cursor_destroy (cursor); } diff -aur --strip-trailing-cr filmgimp-0.7/app/curves.c filmgimp-0.7-new/app/curves.c --- filmgimp-0.7/app/curves.c 2002-09-28 14:31:21.000000000 -0700 +++ filmgimp-0.7-new/app/curves.c 2003-02-08 13:41:35.000000000 -0800 @@ -36,6 +36,10 @@ #include "pixelrow.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define ROUND(x) ((int) ((x) + 0.5)) #define GRAPH 0x1 Only in filmgimp-0.7-new/app: datadir.c Only in filmgimp-0.7-new/app: datadir.h diff -aur --strip-trailing-cr filmgimp-0.7/app/datafiles.c filmgimp-0.7-new/app/datafiles.c --- filmgimp-0.7/app/datafiles.c 2002-09-28 14:31:21.000000000 -0700 +++ filmgimp-0.7-new/app/datafiles.c 2003-02-08 13:41:35.000000000 -0800 @@ -26,14 +26,23 @@ #include #include #include + +#ifdef WIN32 + +#else #include +#endif #include #include "datafiles.h" #include "errors.h" #include "general.h" #include "gimprc.h" +#include "datadir.h" +#ifdef WIN32 +#define g_message printf +#endif /***** Functions *****/ @@ -47,7 +56,7 @@ datafile_loader_t loader_func, int flags) { - char *home; + const char *home; char *local_path; char *path; char *filename; @@ -56,14 +65,14 @@ int err; DIR *dir; struct dirent *dir_ent; - +/* BUG: rsr suspects path_str always blank for gradients */ if (path_str == NULL) return; /* Set local path to contain temp_path, where (supposedly) * there may be working files. */ - home = getenv("HOME"); + home = GetDirHome(); local_path = g_strdup (path_str); /* Search through all directories in the local path */ @@ -84,8 +93,9 @@ path = g_malloc(strlen(token) + 2); strcpy(path, token); } /* else */ - - /* Check if directory exists and if it has any items in it */ +#ifdef _DEBUG + printf("Checking directory: %s\n",path); +#endif err = stat(path, &filestat); if (!err && S_ISDIR(filestat.st_mode)) @@ -109,8 +119,11 @@ /* Check the file and see that it is not a sub-directory */ err = stat(filename, &filestat); - if (!err && S_ISREG(filestat.st_mode) && - (!(flags & MODE_EXECUTABLE) || (filestat.st_mode & S_IXUSR))) + if (!err && S_ISREG(filestat.st_mode) +#ifndef WIN32 + && (!(flags & MODE_EXECUTABLE) || (filestat.st_mode & S_IXUSR)) +#endif + ) { filestat_valid = 1; (*loader_func) (filename); diff -aur --strip-trailing-cr filmgimp-0.7/app/desaturate.c filmgimp-0.7-new/app/desaturate.c --- filmgimp-0.7/app/desaturate.c 2002-09-28 14:31:21.000000000 -0700 +++ filmgimp-0.7-new/app/desaturate.c 2003-02-08 13:49:09.000000000 -0800 @@ -28,6 +28,11 @@ #include "pixelarea.h" #include "pixelrow.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + static void desaturate (GimpDrawable *); static Argument * desaturate_invoker (Argument *); diff -aur --strip-trailing-cr filmgimp-0.7/app/devices.c filmgimp-0.7-new/app/devices.c --- filmgimp-0.7/app/devices.c 2002-09-28 14:31:10.000000000 -0700 +++ filmgimp-0.7-new/app/devices.c 2002-11-12 21:51:44.000000000 -0800 @@ -35,7 +35,7 @@ gpointer data); -gint current_device = NULL; +gint current_device = (int) NULL; /* vcpp doesn't like = NULL;*/ /* the gtk input dialog */ @@ -84,7 +84,7 @@ guint32 deviceid, gpointer data) { - current_device = NULL; + current_device = (int) NULL; } diff -aur --strip-trailing-cr filmgimp-0.7/app/displaylut.c filmgimp-0.7-new/app/displaylut.c --- filmgimp-0.7/app/displaylut.c 2002-09-28 14:31:14.000000000 -0700 +++ filmgimp-0.7-new/app/displaylut.c 2002-11-12 21:53:21.000000000 -0800 @@ -1,9 +1,16 @@ +/* displaylut.c */ + +#ifdef WIN32 +#include "unistd.h" +#endif + #include "displaylut.h" #include "float16.h" #include "tag.h" #include #include + static gint IM_FilmMode = FALSE; static gint IM_OldWhitePoint = FALSE; extern Precision default_precision; diff -aur --strip-trailing-cr filmgimp-0.7/app/dodgeburn.c filmgimp-0.7-new/app/dodgeburn.c --- filmgimp-0.7/app/dodgeburn.c 2002-09-28 14:31:12.000000000 -0700 +++ filmgimp-0.7-new/app/dodgeburn.c 2002-11-17 00:40:04.000000000 -0800 @@ -328,7 +328,7 @@ tool = paint_core_new (DODGEBURN); private = (PaintCore *) tool->private; - private->paint_func = dodgeburn_paint_func; + private->paint_func = (PaintFunc16) dodgeburn_paint_func; private->painthit_setup = dodgeburn_painthit_setup; return tool; @@ -602,7 +602,7 @@ stroke_array[0], stroke_array[1])) { /* Set the paint core's paint func */ - non_gui_paint_core.paint_func = dodgeburn_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) dodgeburn_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/equalize.c filmgimp-0.7-new/app/equalize.c --- filmgimp-0.7/app/equalize.c 2002-09-28 14:31:22.000000000 -0700 +++ filmgimp-0.7-new/app/equalize.c 2003-02-08 13:49:10.000000000 -0800 @@ -27,6 +27,11 @@ #include "paint_funcs_area.h" #include "pixelarea.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + static void equalize (GImage *, GimpDrawable *, int); static void eq_histogram (double [3][256], unsigned char [3][256], int, double); static Argument * equalize_invoker (Argument *); diff -aur --strip-trailing-cr filmgimp-0.7/app/eraser.c filmgimp-0.7-new/app/eraser.c --- filmgimp-0.7/app/eraser.c 2002-09-28 14:31:22.000000000 -0700 +++ filmgimp-0.7-new/app/eraser.c 2002-11-14 08:59:14.000000000 -0800 @@ -147,7 +147,7 @@ tool = paint_core_new (ERASER); private = (PaintCore *) tool->private; - private->paint_func = eraser_paint_func; + private->paint_func = (PaintFunc16) eraser_paint_func; private->painthit_setup = eraser_painthit_setup; return tool; @@ -371,7 +371,7 @@ { non_gui_hard=0; non_gui_incremental = 0; /* set the paint core's paint func */ - non_gui_paint_core.paint_func = eraser_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) eraser_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; @@ -458,7 +458,7 @@ if (success) { /* set the paint core's paint func */ - non_gui_paint_core.paint_func = eraser_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) eraser_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/errors.c filmgimp-0.7-new/app/errors.c --- filmgimp-0.7/app/errors.c 2002-09-28 14:31:22.000000000 -0700 +++ filmgimp-0.7-new/app/errors.c 2002-11-12 21:57:24.000000000 -0800 @@ -18,9 +18,15 @@ #include #include #include + +#ifdef WIN32 + +#else #include #include #include +#endif + #include #include diff -aur --strip-trailing-cr filmgimp-0.7/app/expose_image.c filmgimp-0.7-new/app/expose_image.c --- filmgimp-0.7/app/expose_image.c 2002-09-28 14:31:24.000000000 -0700 +++ filmgimp-0.7-new/app/expose_image.c 2003-02-08 13:41:36.000000000 -0800 @@ -33,6 +33,10 @@ #include "pixelarea.h" #include "pixelrow.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 45 #define TEXT_HEIGHT 25 #define SLIDER_WIDTH 200 diff -aur --strip-trailing-cr filmgimp-0.7/app/fileops.c filmgimp-0.7-new/app/fileops.c --- filmgimp-0.7/app/fileops.c 2002-09-28 14:31:22.000000000 -0700 +++ filmgimp-0.7-new/app/fileops.c 2003-02-08 13:41:36.000000000 -0800 @@ -20,8 +20,14 @@ #include #include #include + +#ifdef WIN32 + +#else #include #include +#endif + #include #include #include @@ -33,7 +39,7 @@ #include "fileops.h" #include "interface.h" #include "menus.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "procedural_db.h" #include "gimprc.h" #include "channel_pvt.h" @@ -42,6 +48,10 @@ #include "minimize.h" #include "frame_manager.h" +#ifdef WIN32 +#define g_message printf +#endif + typedef struct _OverwriteBox OverwriteBox; static GtkWidget *warning_dialog = NULL; static GDisplay *cur_gdisplay; @@ -1290,20 +1300,22 @@ static int file_check_extension (char * filename, char * extension) -{ +{/* rower: I don't know what this is supposed to do, + but it seems to always return false by mistake. + So, commented out. char * last_dot; char * ext; last_dot = strrchr (filename, '.'); if (last_dot) { - ext = last_dot + 1; + ext = last_dot + 1;*/ /* modified by IMAGEWORKS (doug creel 01/30/02) */ - re_comp(ext); +/* re_comp(ext); if(re_exec(extension)) return FALSE; } else - return FALSE; +*/ return FALSE; } char * @@ -2010,10 +2022,13 @@ mbox = (GtkWidget *) client_data; /*gdisplay = (GDisplay *) gtk_object_get_user_data (GTK_OBJECT (mbox)); */ +/* rower commented out! + crude bug fix removing wild pointer call: if (gimage->onionskin) { frame_manager_rm_onionskin (cur_gdisplay); } +*/ gimage = cur_gdisplay->gimage; if (!file_load (cur_gdisplay->gimage->filename, diff -aur --strip-trailing-cr filmgimp-0.7/app/flatbuf.c filmgimp-0.7-new/app/flatbuf.c --- filmgimp-0.7/app/flatbuf.c 2002-09-28 14:31:14.000000000 -0700 +++ filmgimp-0.7-new/app/flatbuf.c 2002-11-13 00:14:08.000000000 -0800 @@ -18,9 +18,17 @@ #include +#ifdef WIN32 +#undef RGB +#endif + #include "flatbuf.h" -#include "trace.h" +#ifdef WIN32 +#undef RGB +#endif + +#include "trace.h" struct _FlatBuf { diff -aur --strip-trailing-cr filmgimp-0.7/app/floating_sel.c filmgimp-0.7-new/app/floating_sel.c --- filmgimp-0.7/app/floating_sel.c 2002-09-28 14:31:22.000000000 -0700 +++ filmgimp-0.7-new/app/floating_sel.c 2003-02-08 13:41:36.000000000 -0800 @@ -35,6 +35,10 @@ #include "layer_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif + void floating_sel_attach (Layer *layer, GimpDrawable *drawable) diff -aur --strip-trailing-cr filmgimp-0.7/app/frac.c filmgimp-0.7-new/app/frac.c --- filmgimp-0.7/app/frac.c 2002-09-28 14:31:23.000000000 -0700 +++ filmgimp-0.7-new/app/frac.c 2003-02-08 21:48:36.000000000 -0800 @@ -11,6 +11,10 @@ #include "xcf.h" #include "frac.h" +#ifdef WIN32 +#define g_error printf +#endif + #define FRAC_DONT_WORK #ifdef FRAC_DONT_WORK diff -aur --strip-trailing-cr filmgimp-0.7/app/frame_manager.c filmgimp-0.7-new/app/frame_manager.c --- filmgimp-0.7/app/frame_manager.c 2002-09-28 14:31:33.000000000 -0700 +++ filmgimp-0.7-new/app/frame_manager.c 2002-11-17 03:15:30.000000000 -0800 @@ -949,7 +949,7 @@ frame_manager_t *fm = gdisplay->frame_manager; if (!frame_manager_check (gdisplay)) - return; + return 0; if (fm->onionskin) @@ -980,7 +980,7 @@ { item->selected = 1; frame_manager_store_load (item, gdisplay); - return; + return 0; } if (item->selected) { @@ -1016,7 +1016,7 @@ if (!frame_manager_check (gdisplay)) - return; + return 0; if (fm->onionskin) { @@ -1299,7 +1299,7 @@ if (!frame_manager_check (gdisplay)) - return; + return 0; menu = gtk_menu_new (); if (!num_items) @@ -1352,7 +1352,7 @@ GDisplay *gdisplay = (GDisplay*) client_data; if (!frame_manager_check (gdisplay)) - return; + return 0; frame_manager_rm_onionskin (gdisplay); frame_manager_update_menu (gdisplay); @@ -2033,7 +2033,7 @@ if (!frame_manager_check (gdisplay)) { - return; + return 0; } frame_manager_rm_onionskin (gdisplay); @@ -3073,7 +3073,7 @@ store_t *item; if (!gdisplay->frame_manager || !gdisplay->frame_manager->onionskin) - return NULL; + return (int)NULL; list = gdisplay->frame_manager->stores; while (list) @@ -3087,7 +3087,7 @@ } printf ("ERROR : something is wrong with onionskin 2\n"); - return NULL; + return (int)NULL; } @@ -3122,7 +3122,7 @@ store_t *item; if (!gdisplay->frame_manager) - return NULL; + return (int)NULL; list = gdisplay->frame_manager->stores; while (list) @@ -3134,7 +3134,7 @@ } list = g_slist_next (list); } - return NULL; + return (int)NULL; } @@ -3147,7 +3147,7 @@ frame_manager_t *fm = gdisplay->frame_manager; if (!fm) - return NULL; + return (int)NULL; list = fm->stores; while (list) @@ -3160,7 +3160,7 @@ list = g_slist_next (list); i ++; } - return NULL; + return (int)NULL; } diff -aur --strip-trailing-cr filmgimp-0.7/app/free_select.c filmgimp-0.7-new/app/free_select.c --- filmgimp-0.7/app/free_select.c 2002-09-28 14:31:23.000000000 -0700 +++ filmgimp-0.7-new/app/free_select.c 2003-02-08 13:49:10.000000000 -0800 @@ -31,6 +31,11 @@ #include "pixelarea.h" #include "pixelrow.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + typedef struct _free_select FreeSelect; struct _free_select diff -aur --strip-trailing-cr filmgimp-0.7/app/gamma_expose.c filmgimp-0.7-new/app/gamma_expose.c --- filmgimp-0.7/app/gamma_expose.c 2002-10-11 21:37:01.000000000 -0700 +++ filmgimp-0.7-new/app/gamma_expose.c 2003-02-08 13:41:36.000000000 -0800 @@ -32,6 +32,10 @@ #include "pixelarea.h" #include "pixelrow.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 45 #define TEXT_HEIGHT 25 #define SLIDER_WIDTH 200 diff -aur --strip-trailing-cr filmgimp-0.7/app/gdisplay.c filmgimp-0.7-new/app/gdisplay.c --- filmgimp-0.7/app/gdisplay.c 2002-09-28 14:31:24.000000000 -0700 +++ filmgimp-0.7-new/app/gdisplay.c 2003-01-31 15:20:19.000000000 -0800 @@ -37,7 +37,7 @@ #include "layer.h" #include "layers_dialog.h" #include "menus.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "scale.h" #include "scroll.h" #include "tools.h" diff -aur --strip-trailing-cr filmgimp-0.7/app/general.c filmgimp-0.7-new/app/general.c --- filmgimp-0.7/app/general.c 2002-09-28 14:31:24.000000000 -0700 +++ filmgimp-0.7-new/app/general.c 2002-11-12 21:57:24.000000000 -0800 @@ -24,6 +24,10 @@ #include #include "general.h" +#ifdef WIN32 +#include "unistd.h" +#endif + /* prune filename removes all of the leading path information to a filename */ diff -aur --strip-trailing-cr filmgimp-0.7/app/gimage.c filmgimp-0.7-new/app/gimage.c --- filmgimp-0.7/app/gimage.c 2002-09-28 14:31:25.000000000 -0700 +++ filmgimp-0.7-new/app/gimage.c 2003-02-08 13:41:36.000000000 -0800 @@ -37,16 +37,20 @@ #include "palette.h" #include "pixelarea.h" #include "pixelrow.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "tools.h" #include "undo.h" #include "zoom.h" #include "gdisplay.h" - +#include "base_frame_manager.h" #include "layer_pvt.h" #include "drawable_pvt.h" /* ick ick. */ #include "channel_pvt.h" /* ick ick. */ +#ifdef WIN32 +#define g_message printf +#endif + /* Local function declarations */ static void gimage_free_projection (GImage *); static GImage * gimage_create (void); diff -aur --strip-trailing-cr filmgimp-0.7/app/gimage_mask.c filmgimp-0.7-new/app/gimage_mask.c --- filmgimp-0.7/app/gimage_mask.c 2002-09-28 14:31:26.000000000 -0700 +++ filmgimp-0.7-new/app/gimage_mask.c 2003-02-08 13:41:36.000000000 -0800 @@ -40,6 +40,9 @@ #include "layer_pvt.h" #include "drawable_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif /* feathering variables */ double gimage_mask_feather_radius = 5; @@ -565,7 +568,7 @@ return FALSE; /* set the paint core's paint func */ - non_gui_paint_core.paint_func = gimage_mask_stroke_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) gimage_mask_stroke_paint_func; non_gui_paint_core.painthit_setup = gimage_mask_painthit_setup; gimage_mask_stroking = TRUE; diff -aur --strip-trailing-cr filmgimp-0.7/app/gimpbrush.c filmgimp-0.7-new/app/gimpbrush.c --- filmgimp-0.7/app/gimpbrush.c 2002-09-28 14:31:13.000000000 -0700 +++ filmgimp-0.7-new/app/gimpbrush.c 2003-02-08 13:41:36.000000000 -0800 @@ -26,6 +26,10 @@ #include "gimprc.h" #include "brush_header.h" +#ifdef WIN32 +#define g_message printf +#endif + enum{ DIRTY, RENAME, diff -aur --strip-trailing-cr filmgimp-0.7/app/gimpbrushgenerated.c filmgimp-0.7-new/app/gimpbrushgenerated.c --- filmgimp-0.7/app/gimpbrushgenerated.c 2002-09-28 14:31:13.000000000 -0700 +++ filmgimp-0.7-new/app/gimpbrushgenerated.c 2002-11-13 00:11:30.000000000 -0800 @@ -26,6 +26,10 @@ #include #include +#ifdef WIN32 +#include "extra.h" +#endif + #ifndef HAVE_RINT #define rint(x) floor (x + 0.5) #endif diff -aur --strip-trailing-cr filmgimp-0.7/app/gimpbrushlist.c filmgimp-0.7-new/app/gimpbrushlist.c --- filmgimp-0.7/app/gimpbrushlist.c 2002-09-28 14:31:13.000000000 -0700 +++ filmgimp-0.7-new/app/gimpbrushlist.c 2003-01-10 11:25:24.000000000 -0800 @@ -51,6 +51,7 @@ #include "gimpbrush.h" #include "gimplistP.h" #include "gimpbrushlistP.h" +#include "datadir.h" /* global variables */ GimpBrush *active_brush = NULL; @@ -208,7 +209,8 @@ if (brush_vbr_path) { /* Get the first path specified in the brush vbr path variable */ - home = getenv("HOME"); + + home = GetDirHome(); local_path = g_strdup (brush_vbr_path); first_token = local_path; token = xstrsep(&first_token, ":"); diff -aur --strip-trailing-cr filmgimp-0.7/app/gimprc.c filmgimp-0.7-new/app/gimprc.c --- filmgimp-0.7/app/gimprc.c 2002-09-28 14:31:26.000000000 -0700 +++ filmgimp-0.7-new/app/gimprc.c 2003-02-08 13:41:36.000000000 -0800 @@ -22,6 +22,7 @@ #include #include #include +#include #include "app_procs.h" #include "appenv.h" @@ -30,8 +31,13 @@ #include "general.h" #include "gimprc.h" #include "menus.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "gimage.h" +#include "datadir.h" + +#ifdef WIN32 +#define g_message printf +#endif #define ERROR 0 #define DONE 1 @@ -52,14 +58,14 @@ TT_XPLUGIN, TT_XPLUGINDEF, TT_XMENUPATH -} TokenType; +} Token_Type; typedef struct _ParseFunc ParseFunc; struct _ParseFunc { char *name; - TokenType type; + Token_Type type; gpointer val1p; gpointer val2p; }; @@ -297,15 +303,15 @@ gimp_directory () { static char gimp_dir[MAX_GIMPDIR_LEN + 1] = ""; - char *env_gimp_dir; - char *env_home_dir; + const char *env_gimp_dir; + const char *env_home_dir; size_t len_env_home_dir = 0; if ('\000' != gimp_dir[0]) return gimp_dir; - env_gimp_dir = getenv ("GIMP_DIRECTORY"); - env_home_dir = getenv ("HOME"); + env_gimp_dir = GetDirGimp(); + env_home_dir = GetDirHome(); if (NULL != env_home_dir) len_env_home_dir = strlen (env_home_dir); @@ -361,7 +367,7 @@ gimp_dir = gimp_directory (); add_gimp_directory_token (gimp_dir); - +/* BUG: rsr - Is this right in Linux? In Win32 tries share/.filmgimp/gimprc.*/ sprintf (libfilename, "%s/gimprc", DATADIR); app_init_update_status("Resource configuration", libfilename, -1); parse_gimprc_file (libfilename); @@ -380,15 +386,17 @@ static char *home_dir = NULL; int status; char rfilename[512]; - +#ifdef WIN32 + /* BUG: rsr pretty sure this gives ~hone/~home/.filmgimp/gimprc always*/ +#else if (filename[0] != '/') { if (!home_dir) - home_dir = g_strdup (getenv ("HOME")); + home_dir = g_strdup (GetDirHome()); sprintf (rfilename, "%s/%s", home_dir, filename); filename = rfilename; } - +#endif parse_info.fp = fopen (filename, "rt"); if (!parse_info.fp) return; @@ -661,7 +669,7 @@ if (*pathp) g_free (*pathp); *pathp = g_strdup (token_str); - +/* Example: *pathp = "${gimp_dir)/plug-ins/:$(gimp_plugin_dir)/plug-ins" */ token = peek_next_token (); if (!token || (token != TOKEN_RIGHT_PAREN)) { @@ -672,7 +680,10 @@ token = get_next_token (); *pathp = transform_path (*pathp, TRUE); - +/* Example: "rower/.filmgimp/plug-ins/:/usr/local/bin/plug-ins" */ +#ifdef _DEBUG + printf("gimprc parse path: \"%s\"\n",*pathp); +#endif return OK; } @@ -1417,15 +1428,14 @@ { guint length; char *new_path; - char *home; + const char *home; char *token; char *tmp; char *tmp2; int substituted; int is_env; UnknownToken *ut; - - home = getenv ("HOME"); + home = GetDirHome(); length = 0; substituted = FALSE; is_env = FALSE; @@ -1479,6 +1489,9 @@ ut->token = g_strdup (token); ut->value = g_strdup (tmp2); unknown_tokens = g_list_append (unknown_tokens, ut); +#ifdef _DEBUG + printf("gimprc: %s = \"%s\"\n",ut->token,ut->value); +#endif } } else @@ -1608,7 +1621,9 @@ ut->value = transform_path (ut->value, TRUE); unknown_tokens = g_list_append (unknown_tokens, ut); - +#ifdef _DEBUG + printf("gimprc: %s = \"%s\"\n",ut->token,ut->value); +#endif return OK; } @@ -1811,6 +1826,9 @@ /* Similarly, transforming the path should be silly. */ unknown_tokens = g_list_append (unknown_tokens, ut); +#ifdef _DEBUG + printf("gimprc: %s = \"%s\"\n",ut->token,ut->value); +#endif } /* Try to: @@ -1835,19 +1853,17 @@ /* Rename the file to *.old, open it for reading and create the new file. */ - if ((*fp_old = fopen (filename, "rt")) == NULL) - { - if (errno == EACCES) - return "Can't open gimprc; permission problems"; - if (errno == ENOENT) - return "Can't open gimprc; file does not exist"; - return "Can't open gimprc, reason unknown"; - } oldfilename = g_malloc (strlen (filename) + 5); sprintf (oldfilename, "%s.old", filename); +#ifdef WIN32 + remove(oldfilename); +#endif if (rename (filename, oldfilename) < 0) { +#ifdef _DEBUG + printf("rename %s %s errno #%i\n",filename,oldfilename,errno); +#endif g_free (oldfilename); if (errno == EACCES) return "Can't rename gimprc to gimprc.old; permission problems"; @@ -1856,6 +1872,15 @@ return "Can't rename gimprc to gimprc.old, reason unknown"; } + if ((*fp_old = fopen (oldfilename, "rt")) == NULL) + { + if (errno == EACCES) + return "Can't open gimprc; permission problems"; + if (errno == ENOENT) + return "Can't open gimprc; file does not exist"; + return "Can't open gimprc, reason unknown"; + } + if ((*fp_new = fopen (filename, "wt")) == NULL) { (void) rename (oldfilename, filename); diff -aur --strip-trailing-cr filmgimp-0.7/app/gradient.c filmgimp-0.7-new/app/gradient.c --- filmgimp-0.7/app/gradient.c 2002-11-05 23:45:32.000000000 -0800 +++ filmgimp-0.7-new/app/gradient.c 2003-02-08 13:41:36.000000000 -0800 @@ -166,7 +166,11 @@ #include "pixelrow.h" #include "layout.h" #include "minimize.h" +#include "datadir.h" +#ifdef WIN32 +#define g_message printf +#endif /***** Magic numbers *****/ @@ -5937,8 +5941,7 @@ return NULL; /* Perhaps this is not a good idea */ /* Get the first path specified in the list */ - - home = getenv("HOME"); + home = GetDirHome(); local_path = g_strdup(path_str); first_token = local_path; token = xstrsep(&first_token, ":"); diff -aur --strip-trailing-cr filmgimp-0.7/app/histogram_tool.c filmgimp-0.7-new/app/histogram_tool.c --- filmgimp-0.7/app/histogram_tool.c 2002-09-28 14:31:27.000000000 -0700 +++ filmgimp-0.7-new/app/histogram_tool.c 2003-02-08 13:41:36.000000000 -0800 @@ -31,6 +31,10 @@ #include "interface.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 45 #define HISTOGRAM_WIDTH 256 #define HISTOGRAM_HEIGHT 150 diff -aur --strip-trailing-cr filmgimp-0.7/app/hue_saturation.c filmgimp-0.7-new/app/hue_saturation.c --- filmgimp-0.7/app/hue_saturation.c 2002-09-28 14:31:27.000000000 -0700 +++ filmgimp-0.7-new/app/hue_saturation.c 2003-02-08 13:41:36.000000000 -0800 @@ -34,6 +34,10 @@ #include "pixelrow.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define FIXME /* two temp routines */ static void calc_rgb_to_hls(gdouble *r, gdouble *g, gdouble *b); diff -aur --strip-trailing-cr filmgimp-0.7/app/image_render.c filmgimp-0.7-new/app/image_render.c --- filmgimp-0.7/app/image_render.c 2002-10-11 21:35:50.000000000 -0700 +++ filmgimp-0.7-new/app/image_render.c 2003-02-08 21:48:36.000000000 -0800 @@ -37,6 +37,11 @@ #include "trace.h" #include "displaylut.h" +#ifdef WIN32 +#define g_message printf +#define g_error printf +#endif + static double gamma_func (double, double); static double expose_func (double, double); diff -aur --strip-trailing-cr filmgimp-0.7/app/install.c filmgimp-0.7-new/app/install.c --- filmgimp-0.7/app/install.c 2002-11-05 22:25:22.000000000 -0800 +++ filmgimp-0.7-new/app/install.c 2003-02-08 13:41:36.000000000 -0800 @@ -25,7 +25,14 @@ #include "install.h" #include "interface.h" #include "gimprc.h" - +#include "datadir.h" +#ifdef WIN32 +#include "../win32/UserInstall.h" +#endif + +#ifdef WIN32 +#define g_message printf +#endif static void install_run (InstallCallback); static void install_help (InstallCallback); @@ -414,6 +421,18 @@ gtk_text_insert (GTK_TEXT (text), font_strong, NULL, NULL, "User Installation Log\n\n", -1); +#ifdef WIN32 + { const char* msg = UserInstall(gimp_directory()); + if(msg) + { gtk_text_insert (GTK_TEXT (text), font, NULL, NULL,msg, -1); + msg="\nInstallation failed!\n"; + } + else + { msg="\nInstallation successful!\n"; + } + gtk_text_insert (GTK_TEXT (text), font, NULL, NULL,msg, -1); + } +#else /* Generate output */ sprintf (buffer, "%s/user_install", DATADIR); if ((err = stat (buffer, &stat_buf)) != 0) @@ -432,7 +451,7 @@ } if (executable == TRUE) - { + { /* user_install is a script that copies files */ sprintf (buffer, "%s/user_install %s %s", DATADIR, DATADIR, gimp_directory ()); if ((pfp = popen (buffer, "r")) != NULL) @@ -450,7 +469,7 @@ if (executable == FALSE) gtk_text_insert (GTK_TEXT (text), font, NULL, NULL, "\nInstallation failed. Contact system administrator.\n", -1); - +#endif gtk_widget_show (vsb); gtk_widget_show (text); gtk_widget_show (table); diff -aur --strip-trailing-cr filmgimp-0.7/app/interface.c filmgimp-0.7-new/app/interface.c --- filmgimp-0.7/app/interface.c 2002-11-05 22:26:09.000000000 -0800 +++ filmgimp-0.7-new/app/interface.c 2002-12-02 23:51:10.000000000 -0800 @@ -582,9 +582,13 @@ /* tooltips */ tool_tips = gtk_tooltips_new (); +#ifdef WIN32 + /* BUG: rsr suspects this is deprecated for Linux, too. */ +#else gtk_tooltips_set_colors (tool_tips, &colors[11], &main_vbox->style->fg[GTK_STATE_NORMAL]); +#endif if (!show_tool_tips) gtk_tooltips_disable (tool_tips); @@ -981,6 +985,10 @@ * Message Boxes... */ +#ifdef WIN32 +#undef MessageBox +#endif + typedef struct _MessageBox MessageBox; struct _MessageBox diff -aur --strip-trailing-cr filmgimp-0.7/app/invert.c filmgimp-0.7-new/app/invert.c --- filmgimp-0.7/app/invert.c 2002-09-28 14:31:28.000000000 -0700 +++ filmgimp-0.7-new/app/invert.c 2003-02-08 13:49:10.000000000 -0800 @@ -28,6 +28,11 @@ #include "pixelarea.h" #include "pixelrow.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + static void invert (GimpDrawable *); static Argument * invert_invoker (Argument *); diff -aur --strip-trailing-cr filmgimp-0.7/app/iscissors.c filmgimp-0.7-new/app/iscissors.c --- filmgimp-0.7/app/iscissors.c 2002-09-28 14:31:29.000000000 -0700 +++ filmgimp-0.7-new/app/iscissors.c 2003-02-08 13:49:10.000000000 -0800 @@ -41,6 +41,11 @@ #include "rect_select.h" #include "tools.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif /* M_PI */ diff -aur --strip-trailing-cr filmgimp-0.7/app/layer.c filmgimp-0.7-new/app/layer.c --- filmgimp-0.7/app/layer.c 2002-09-28 14:31:29.000000000 -0700 +++ filmgimp-0.7-new/app/layer.c 2003-02-08 13:41:36.000000000 -0800 @@ -41,6 +41,10 @@ #include "layer_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif + enum { LAST_SIGNAL }; diff -aur --strip-trailing-cr filmgimp-0.7/app/layers_dialog.c filmgimp-0.7-new/app/layers_dialog.c --- filmgimp-0.7/app/layers_dialog.c 2002-09-28 14:31:30.000000000 -0700 +++ filmgimp-0.7-new/app/layers_dialog.c 2003-02-08 13:41:36.000000000 -0800 @@ -66,6 +66,9 @@ #include "layer_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif #define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK #define BUTTON_EVENT_MASK GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | \ diff -aur --strip-trailing-cr filmgimp-0.7/app/levels.c filmgimp-0.7-new/app/levels.c --- filmgimp-0.7/app/levels.c 2002-09-28 14:31:31.000000000 -0700 +++ filmgimp-0.7-new/app/levels.c 2003-02-08 13:41:36.000000000 -0800 @@ -36,6 +36,10 @@ #include "pixelrow.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define LOW_INPUT 0x1 #define GAMMA 0x2 #define HIGH_INPUT 0x4 diff -aur --strip-trailing-cr filmgimp-0.7/app/main.c filmgimp-0.7-new/app/main.c --- filmgimp-0.7/app/main.c 2002-09-28 14:31:31.000000000 -0700 +++ filmgimp-0.7-new/app/main.c 2003-01-12 21:01:42.000000000 -0800 @@ -22,10 +22,16 @@ #include #include #include + +#ifdef WIN32 + +#else #include +#endif + #include -#include "libgimp/gimpfeatures.h" +#include "plug-ins/gimpfeatures.h" #include "tag.h" #include "gimprc.h" @@ -276,6 +282,9 @@ g_set_message_handler (&message_func); +#ifdef WIN32 + +#else /* Handle some signals */ signal (SIGHUP, on_signal); signal (SIGINT, on_signal); @@ -292,7 +301,7 @@ /* Handle shmem reload */ signal( SIGUSR2, on_sig_refresh); - +#endif /* Keep the command line arguments--for use in gimp_init */ gimp_argc = argc - 1; gimp_argv = argv + 1; diff -aur --strip-trailing-cr filmgimp-0.7/app/measure.c filmgimp-0.7-new/app/measure.c --- filmgimp-0.7/app/measure.c 2002-09-28 14:31:31.000000000 -0700 +++ filmgimp-0.7-new/app/measure.c 2003-01-01 20:51:48.000000000 -0800 @@ -30,9 +30,9 @@ #include "measure.h" #include "undo.h" -#include "libgimp/gimpintl.h" +#include "libgim_p/gimpintl.h" #if 0 -#include "libgimp/gimpmath.h" +#include "libgim_p/gimpmath.h" #endif /* definitions */ diff -aur --strip-trailing-cr filmgimp-0.7/app/minimize.c filmgimp-0.7-new/app/minimize.c --- filmgimp-0.7/app/minimize.c 2002-09-28 14:31:12.000000000 -0700 +++ filmgimp-0.7-new/app/minimize.c 2002-11-17 03:09:17.000000000 -0800 @@ -1,8 +1,13 @@ #include "minimize.h" #include #include + +#ifdef WIN32 +#include +#else #include #include +#endif static gboolean minimize_prop_notify( @@ -38,9 +43,15 @@ if (window && window->window) { // go to all registered widgets and force them to minimize +#ifdef WIN32 + GdkWindow *gdk_window=window->window; + HWND hwnd=(HWND) -1;/* rower: BUG! */ + ShowWindow(hwnd,SW_MINIMIZE); +#else XIconifyWindow(GDK_WINDOW_XDISPLAY(window->window), GDK_WINDOW_XWINDOW(window->window), DefaultScreen (GDK_DISPLAY ())); +#endif } else { printf("Skipping window\n"); diff -aur --strip-trailing-cr filmgimp-0.7/app/paint_core_16.c filmgimp-0.7-new/app/paint_core_16.c --- filmgimp-0.7/app/paint_core_16.c 2002-09-28 14:31:15.000000000 -0700 +++ filmgimp-0.7-new/app/paint_core_16.c 2003-02-08 13:41:36.000000000 -0800 @@ -42,6 +42,9 @@ #include "undo.h" #define SQR(x) ((x) * (x)) +#ifdef WIN32 +#define g_message printf +#endif /* global variables--for use in the various paint tools */ PaintCore16 non_gui_paint_core_16; diff -aur --strip-trailing-cr filmgimp-0.7/app/paintbrush.c filmgimp-0.7-new/app/paintbrush.c --- filmgimp-0.7/app/paintbrush.c 2002-09-28 14:31:33.000000000 -0700 +++ filmgimp-0.7-new/app/paintbrush.c 2002-11-14 09:18:33.000000000 -0800 @@ -170,7 +170,7 @@ tool = paint_core_new (PAINTBRUSH); private = (PaintCore *) tool->private; - private->paint_func = paintbrush_paint_func; + private->paint_func = (PaintFunc16) paintbrush_paint_func; private->painthit_setup = paintbrush_painthit_setup; return tool; @@ -420,7 +420,7 @@ { non_gui_incremental = 0; /* set the paint core's paint func */ - non_gui_paint_core.paint_func = paintbrush_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) paintbrush_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; @@ -510,7 +510,7 @@ { non_gui_incremental = args[5].value.pdb_int; /* set the paint core's paint func */ - non_gui_paint_core.paint_func = paintbrush_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) paintbrush_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/palette.c filmgimp-0.7-new/app/palette.c --- filmgimp-0.7/app/palette.c 2002-09-28 14:31:33.000000000 -0700 +++ filmgimp-0.7-new/app/palette.c 2003-02-08 13:41:36.000000000 -0800 @@ -19,9 +19,15 @@ #include #include #include + +#ifdef WIN32 + +#else #include #include #include +#endif + #include "appenv.h" #include "actionarea.h" #include "buildmenu.h" @@ -41,6 +47,10 @@ #include "layout.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define ENTRY_WIDTH 14 #define ENTRY_HEIGHT 10 #define SPACING 1 diff -aur --strip-trailing-cr filmgimp-0.7/app/patterns.c filmgimp-0.7-new/app/patterns.c --- filmgimp-0.7/app/patterns.c 2002-09-28 14:31:33.000000000 -0700 +++ filmgimp-0.7-new/app/patterns.c 2003-02-08 13:41:37.000000000 -0800 @@ -19,9 +19,15 @@ #include #include #include + +#ifdef WIN32 + +#else #include #include #include +#endif + #include "appenv.h" #include "canvas.h" #include "colormaps.h" @@ -37,6 +43,9 @@ #include "menus.h" #include "tag.h" +#ifdef WIN32 +#define g_message printf +#endif /* global variables */ GPatternP active_pattern = NULL; diff -aur --strip-trailing-cr filmgimp-0.7/app/pencil.c filmgimp-0.7-new/app/pencil.c --- filmgimp-0.7/app/pencil.c 2002-09-28 14:31:33.000000000 -0700 +++ filmgimp-0.7-new/app/pencil.c 2002-11-14 09:18:33.000000000 -0800 @@ -77,7 +77,7 @@ tool = paint_core_new (PENCIL); private = (PaintCore *) tool->private; - private->paint_func = pencil_paint_func; + private->paint_func = (PaintFunc16) pencil_paint_func; private->painthit_setup = pencil_painthit_setup; return tool; @@ -246,7 +246,7 @@ if (success) { /* set the paint core's paint func */ - non_gui_paint_core.paint_func = pencil_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) pencil_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/pixelarea.c filmgimp-0.7-new/app/pixelarea.c --- filmgimp-0.7/app/pixelarea.c 2002-09-28 14:31:10.000000000 -0700 +++ filmgimp-0.7-new/app/pixelarea.c 2002-11-13 00:21:35.000000000 -0800 @@ -17,6 +17,7 @@ */ #include +#include #include "canvas.h" #include "pixelrow.h" diff -aur --strip-trailing-cr filmgimp-0.7/app/plug_in.c filmgimp-0.7-new/app/plug_in.c --- filmgimp-0.7/app/plug_in.c 2002-09-28 14:31:34.000000000 -0700 +++ filmgimp-0.7-new/app/plug_in.c 2003-02-28 10:03:59.000000000 -0800 @@ -21,13 +21,20 @@ #include #include #include +#include +#include + +#ifdef WIN32 +#include "extra.h" +#define index strchr +#undef RGB +#else #include #include #include #include #include -#include -#include +#endif #ifdef HAVE_IPC_H #include @@ -37,26 +44,33 @@ #include #endif -#include "libgimp/gimpprotocol.h" -#include "libgimp/gimpwire.h" +#include "plug-ins/gimpprotocol.h" +#include "plug-ins/gimpwire.h" -#include "app_procs.h" -#include "appenv.h" -#include "canvas.h" -#include "drawable.h" -#include "datafiles.h" -#include "errors.h" -#include "gdisplay.h" -#include "general.h" -#include "gimage.h" -#include "gimprc.h" -#include "interface.h" -#include "menus.h" -#include "pixelarea.h" +#include "../app/app_procs.h" +#include "../app/appenv.h" +#include "../app/canvas.h" +#include "../app/drawable.h" +#include "../app/datafiles.h" +#include "../app/errors.h" +#include "../app/gdisplay.h" +#include "../app/general.h" +#include "../app/gimage.h" +#include "../app/gimprc.h" +#include "../app/interface.h" +#include "../app/menus.h" +#include "../app/pixelarea.h" #include "plug_in.h" -#include "tag.h" -#include "layout.h" -#include "minimize.h" +#include "../app/tag.h" +#include "../app/layout.h" +#include "../app/minimize.h" +#include "plug_in_loader.h" +#include "event.h" + +#ifdef WIN32 +#define g_message printf +#define g_error printf +#endif #define FIXME #define TILE_WIDTH 64 @@ -64,9 +78,11 @@ #define SEPARATE_PROGRESS_BAR - typedef struct _PlugInBlocked PlugInBlocked; +static WireBuffer wb; +WireBuffer* wire_buffer=&wb; + typedef enum { RUN_INTERACTIVE = 0x0, @@ -86,20 +102,22 @@ static void plug_in_copyarea (PixelArea *a, guchar *buf, gint direction); -static int plug_in_write (int fd, - guint8 *buf, - gulong count); -static int plug_in_flush (int fd); static void plug_in_push (PlugIn *plug_in); static void plug_in_pop (void); static void plug_in_recv_message (gpointer data, gint id, GdkInputCondition cond); -static void plug_in_handle_message (WireMessage *msg); + static void plug_in_handle_quit (void); static void plug_in_handle_tile_req (GPTileReq *tile_req); static void plug_in_handle_proc_run (GPProcRun *proc_run); + +#ifdef WIN32 + +#else static void plug_in_handle_proc_return (GPProcReturn *proc_return); +#endif + static void plug_in_handle_proc_install (GPProcInstall *proc_install); static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall); static void plug_in_write_rc (char *filename); @@ -139,29 +157,6 @@ static Argument* message_handler_get_invoker (Argument *args); static Argument* message_handler_set_invoker (Argument *args); - -static GSList *plug_in_defs = NULL; -static GSList *gimprc_proc_defs = NULL; -static GSList *proc_defs = NULL; -static GSList *open_plug_ins = NULL; -static GSList *blocked_plug_ins = NULL; - -static GSList *plug_in_stack = NULL; -static PlugIn *current_plug_in = NULL; -static int current_readfd = 0; -static int current_writefd = 0; -static int current_write_buffer_index = 0; -static char *current_write_buffer = NULL; -static Argument *current_return_vals = NULL; -static int current_return_nvals = 0; - -static ProcRecord *last_plug_in = NULL; - -static int shm_ID = -1; -static guchar *shm_addr = NULL; - -static int write_pluginrc = FALSE; - static ProcArg progress_init_args[] = { { PDB_STRING, @@ -279,9 +274,22 @@ { { message_handler_set_invoker } }, }; +#ifdef WIN32_EXPERIMENTAL -void -plug_in_init () +void plug_in_init() +{ DWORD thread_id; +/* PlugIn* plugin;*; + plugin=plug_in_new("");*/ + HANDLE thread_plugin_loader; + thread_id=0; + thread_plugin_loader=CreateThread(0,0,plug_in_init_thread,0,0,&thread_id); + printf("CreatedThread plugin loader #%i\n",thread_plugin_loader); +} + +DWORD WINAPI plug_in_init_thread(void* unused) +#else +void plug_in_init() +#endif { extern int use_shm; char filename[MAXPATHLEN]; @@ -290,6 +298,8 @@ PlugInProcDef *proc_def; gfloat nplugins, nth; + WireBufferOpen(wire_buffer); + /* initialize the progress init and update procedure db calls. */ procedural_db_register (&progress_init_proc); procedural_db_register (&progress_update_proc); @@ -303,8 +313,14 @@ * write handlers. */ gp_init (); - wire_set_writer (plug_in_write); - wire_set_flusher (plug_in_flush); +#ifdef WIN32 + wire_set_reader(wire_buffer_read); + wire_set_writer(wire_buffer_write); + wire_set_flusher(wire_buffer_flush); +#else + wire_set_writer(wire_write); + wire_set_flusher(plug_in_flush); +#endif #ifdef HAVE_SHM_H /* allocate a piece of shared memory for use in transporting tiles @@ -334,8 +350,9 @@ } } #endif - - /* search for binaries in the plug-in directory path */ +#ifdef _DEBUG + printf("Searching plug-ins in path: %s\n",plug_in_path); +#endif datafiles_read_directories (plug_in_path, plug_in_init_file, MODE_EXECUTABLE); /* read the pluginrc file for cached data */ @@ -355,7 +372,7 @@ /* query any plug-ins that have changed since we last wrote out * the pluginrc file. */ - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; app_init_update_status("Plug-ins", "", 0); nplugins = g_slist_length(tmp); nth = 0; @@ -366,7 +383,7 @@ if (plug_in_def->query) { - write_pluginrc = TRUE; + wire_buffer->write_pluginrc = TRUE; if ((be_verbose == TRUE) || (no_splash == TRUE)) g_print ("query plug-in: \"%s\"\n", plug_in_def->prog); plug_in_query (plug_in_def->prog, plug_in_def); @@ -376,7 +393,7 @@ } /* insert the proc defs */ - tmp = gimprc_proc_defs; + tmp = wire_buffer->gimprc_proc_defs; while (tmp) { proc_def = g_new (PlugInProcDef, 1); @@ -385,7 +402,7 @@ tmp = tmp->next; } - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { plug_in_def = tmp->data; @@ -402,7 +419,7 @@ } /* write the pluginrc file if necessary */ - if (write_pluginrc) + if (wire_buffer->write_pluginrc) { if ((be_verbose == TRUE) || (no_splash == TRUE)) g_print ("writing \"%s\"\n", filename); @@ -416,7 +433,7 @@ plug_in_make_menu (); /* run the available extensions */ - tmp = proc_defs; + tmp = wire_buffer->proc_defs; if ((be_verbose == TRUE) || (no_splash == TRUE)) g_print ("Starting extensions: "); app_init_update_status("Extensions", "", 0); @@ -443,7 +460,7 @@ g_print ("\n"); /* free up stuff */ - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { plug_in_def = tmp->data; @@ -453,7 +470,10 @@ g_free (plug_in_def->prog); g_free (plug_in_def); } - g_slist_free (plug_in_defs); + g_slist_free (wire_buffer->plug_in_defs); +#ifdef WIN32_EXPERIMENTAL + return 1; +#endif } void @@ -475,12 +495,11 @@ #endif #endif - tmp = open_plug_ins; + tmp = wire_buffer->open_plug_ins; while (tmp) { plug_in = tmp->data; tmp = tmp->next; - plug_in_destroy (plug_in); } } @@ -501,7 +520,7 @@ prog = t; } - tmp = gimprc_proc_defs; + tmp = wire_buffer->gimprc_proc_defs; while (tmp) { proc_def = tmp->data; @@ -540,7 +559,7 @@ proc_def->menu_path = menu_path; proc_def->accelerator = accelerator; - gimprc_proc_defs = g_slist_prepend (gimprc_proc_defs, proc_def); + wire_buffer->gimprc_proc_defs = g_slist_prepend (wire_buffer->gimprc_proc_defs, proc_def); } char* @@ -550,14 +569,14 @@ PlugInProcDef *proc_def; GSList *tmp; - if (current_plug_in) + if (wire_buffer->current_plug_in) { - plug_in_def = current_plug_in->user_data; + plug_in_def = wire_buffer->current_plug_in->user_data; tmp = plug_in_def->proc_defs; } else { - tmp = proc_defs; + tmp = wire_buffer->proc_defs; } while (tmp) @@ -597,7 +616,7 @@ void plug_in_add_internal (PlugInProcDef *proc_def) { - proc_defs = g_slist_prepend (proc_defs, proc_def); + wire_buffer->proc_defs = g_slist_prepend (wire_buffer->proc_defs,proc_def); } PlugInProcDef* @@ -610,14 +629,14 @@ PlugInProcDef *proc_def; GSList *tmp; - if (current_plug_in) + if (wire_buffer->current_plug_in) { - plug_in_def = current_plug_in->user_data; + plug_in_def = wire_buffer->current_plug_in->user_data; tmp = plug_in_def->proc_defs; } else { - tmp = proc_defs; + tmp = wire_buffer->proc_defs; } while (tmp) @@ -673,7 +692,7 @@ else t1 = plug_in_def->prog; - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { tplug_in_def = tmp->data; @@ -705,7 +724,7 @@ tmp = tmp->next; } - write_pluginrc = TRUE; + wire_buffer->write_pluginrc = TRUE; g_print ("\"%s\" executable not found\n", plug_in_def->prog); g_free (plug_in_def->prog); g_free (plug_in_def); @@ -718,7 +737,7 @@ PlugInProcDef *proc_def; GSList *tmp, *tmp2; - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { plug_in_def = tmp->data; @@ -735,7 +754,7 @@ } } - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { proc_def = tmp->data; @@ -753,7 +772,7 @@ { PlugIn *plug_in; char *path; - +#ifndef WIN32 if (name[0] != '/') { path = search_in_path (plug_in_path, name); @@ -764,6 +783,7 @@ } } else +#endif { path = name; } @@ -776,7 +796,18 @@ plug_in->synchronous = FALSE; plug_in->recurse = FALSE; plug_in->busy = FALSE; +#ifdef WIN32 + plug_in->handle=INVALID_HANDLE_VALUE; + plug_in->plugin_main=0; + plug_in->wire_buffer=0; +#else plug_in->pid = 0; + plug_in->my_read = 0; + plug_in->my_write = 0; + plug_in->his_read = 0; + plug_in->his_write = 0; + plug_in->input_id = 0; +#endif plug_in->args[0] = g_strdup (path); plug_in->args[1] = g_strdup ("-gimp"); plug_in->args[2] = g_new (char, 16); @@ -784,18 +815,20 @@ plug_in->args[4] = NULL; plug_in->args[5] = NULL; plug_in->args[6] = NULL; - plug_in->my_read = 0; - plug_in->my_write = 0; - plug_in->his_read = 0; - plug_in->his_write = 0; - plug_in->input_id = 0; - plug_in->write_buffer_index = 0; + +/* plug_in->buffer_index = 0; + plug_in->read_buffer = 0; + plug_in->read_buffer_index = 0; + plug_in->read_buffer_offset = 0;*/ plug_in->temp_proc_defs = NULL; plug_in->progress = NULL; plug_in->progress_label = NULL; plug_in->progress_bar = NULL; plug_in->user_data = NULL; - +#ifdef WIN32 + wire_buffer->plugin=plug_in; + wire_buffer->current_plug_in=plug_in; +#endif return plug_in; } @@ -819,7 +852,7 @@ if (plug_in->args[5]) g_free (plug_in->args[5]); - if (plug_in == current_plug_in) + if (plug_in == wire_buffer->current_plug_in) plug_in_pop (); if (!plug_in->destroy) @@ -830,11 +863,14 @@ int plug_in_open (PlugIn *plug_in) { +#ifndef WIN32 int my_read[2]; int my_write[2]; +#endif if (plug_in) { +#ifndef WIN32 /* Open two pipes. (Bidirectional communication). */ if ((pipe (my_read) == -1) || (pipe (my_write) == -1)) @@ -852,7 +888,7 @@ */ sprintf (plug_in->args[2], "%d", plug_in->his_read); sprintf (plug_in->args[3], "%d", plug_in->his_write); - +#endif /* Set the rest of the command line arguments. */ if (plug_in->query) @@ -867,6 +903,23 @@ sprintf (plug_in->args[4], "%d", TILE_WIDTH); sprintf (plug_in->args[5], "%d", TILE_WIDTH); } +#ifdef WIN32 +/* This is how it would be if plug-ins were Windows executables + plug_in->pid = spawnv (_P_NOWAIT, plug_in->args[0], plug_in->args); + if (plug_in->pid == -1)*/ + plug_in->wire_buffer=&wb; + if(!plug_in->query) + { return 1; + } +/* if(!PlugInRun(plug_in)) + Run plug-in in main thread so we don't need to + explicitly wait on it to complete */ + if(!PlugInLoader(plug_in)) + { printf("PlugInRun failed!\n"); + plug_in_destroy(plug_in); + } +/* WaitForPlugin(plug-in);*/ +#else /* Fork another process. We'll remember the process id * so that we can later use it to kill the filter if @@ -891,7 +944,6 @@ plug_in_destroy (plug_in); return 0; } - close(plug_in->his_read); plug_in->his_read = -1; close(plug_in->his_write); plug_in->his_write = -1; @@ -901,10 +953,9 @@ GDK_INPUT_READ, plug_in_recv_message, plug_in); - open_plug_ins = g_slist_prepend (open_plug_ins, plug_in); } - +#endif plug_in->open = TRUE; return 1; } @@ -922,7 +973,13 @@ if (plug_in && plug_in->open) { plug_in->open = FALSE; - +#ifdef WIN32 + FreeLibrary(plug_in->handle); + plug_in->handle=INVALID_HANDLE_VALUE; + plug_in->plugin_main=0; +/* plug_in->thread_main; KillThread? + plug_in->thread_plugin; */ +#else /* Ask the filter to exit gracefully */ if (kill_it && plug_in->pid) @@ -963,6 +1020,7 @@ close (plug_in->his_read); if (plug_in->his_write) close (plug_in->his_write); +#endif wire_clear_error(); @@ -988,13 +1046,16 @@ /* Set the fields to null values. */ +#ifdef WIN32 + +#else plug_in->pid = 0; plug_in->input_id = 0; plug_in->my_read = 0; plug_in->my_write = 0; plug_in->his_read = 0; plug_in->his_write = 0; - +#endif if (plug_in->recurse) gtk_main_quit (); @@ -1020,7 +1081,7 @@ plug_in->temp_proc_defs = NULL; } - open_plug_ins = g_slist_remove (open_plug_ins, plug_in); + wire_buffer->open_plug_ins = g_slist_remove (wire_buffer->open_plug_ins,plug_in); } } @@ -1032,21 +1093,21 @@ /* Return the status code plus the current return values. */ nargs = proc_rec->num_values + 1; - if (current_return_vals && current_return_nvals == nargs) - return_vals = current_return_vals; - else if (current_return_vals) + if (wire_buffer->current_return_vals && wire_buffer->current_return_nvals == nargs) + return_vals = wire_buffer->current_return_vals; + else if (wire_buffer->current_return_vals) { /* Allocate new return values of the correct size. */ return_vals = procedural_db_return_args (proc_rec, FALSE); /* Copy all of the arguments we can. */ - memcpy (return_vals, current_return_vals, - sizeof (Argument) * MIN (current_return_nvals, nargs)); + memcpy (return_vals, wire_buffer->current_return_vals, + sizeof (Argument) * MIN (wire_buffer->current_return_nvals, nargs)); /* Free the old argument pointer. This will cause a memory leak only if there were more values returned than we need (which shouldn't ever happen). */ - g_free (current_return_vals); + g_free (wire_buffer->current_return_vals); } else { @@ -1055,8 +1116,8 @@ } /* We have consumed any saved values, so clear them. */ - current_return_nvals = 0; - current_return_vals = NULL; + wire_buffer->current_return_nvals = 0; + wire_buffer->current_return_vals = NULL; return return_vals; } @@ -1081,19 +1142,24 @@ } plug_in = plug_in_new (proc_rec->exec_method.plug_in.filename); - if (plug_in) - { - if (plug_in_open (plug_in)) - { + { + if (plug_in_open (plug_in)) + { + plug_in->open = TRUE; + plug_in->wire_buffer=&wb; +#ifdef WIN32 + wb.plugin=plug_in; + plug_in->synchronous=TRUE; +#else plug_in->recurse = synchronous; - +#endif plug_in_push (plug_in); config.version = GP_VERSION; config.tile_width = TILE_WIDTH; config.tile_height = TILE_HEIGHT; - config.shm_ID = shm_ID; + config.shm_ID = wire_buffer->shm_ID; config.gamma = gamma_val; config.install_cmap = install_cmap; config.use_xshm = gdk_get_use_xshm (); @@ -1105,17 +1171,19 @@ proc_run.name = proc_rec->name; proc_run.nparams = proc_rec->num_args; proc_run.params = plug_in_args_to_params (args, proc_rec->num_args, FALSE); - - if (!gp_config_write (current_writefd, &config) || - !gp_proc_run_write (current_writefd, &proc_run) || - !wire_flush (current_writefd)) + if (!gp_config_write (wire_buffer->current_writefd, &config) || + !gp_proc_run_write (wire_buffer->current_writefd, &proc_run) || + !wire_flush (wire_buffer->current_writefd)) { return_vals = procedural_db_return_args (proc_rec, FALSE); goto done; } - +#ifdef WIN32 + if(!PlugInRun(plug_in)) + { printf("PlugInRun failed!\n"); + } +#endif plug_in_pop (); - plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE); /* @@ -1150,17 +1218,17 @@ Argument *args; int i; - if (last_plug_in) + if (wire_buffer->last_plug_in) { gdisplay = gdisplay_active (); /* construct the procedures arguments */ - args = g_new (Argument, last_plug_in->num_args); - memset (args, 0, (sizeof (Argument) * last_plug_in->num_args)); + args = g_new (Argument, wire_buffer->last_plug_in->num_args); + memset (args, 0, (sizeof (Argument) * wire_buffer->last_plug_in->num_args)); /* initialize the argument types */ - for (i = 0; i < last_plug_in->num_args; i++) - args[i].arg_type = last_plug_in->args[i].arg_type; + for (i = 0; i < wire_buffer->last_plug_in->num_args; i++) + args[i].arg_type = wire_buffer->last_plug_in->args[i].arg_type; /* initialize the first 3 plug-in arguments */ args[0].value.pdb_int = (with_interface ? RUN_INTERACTIVE : RUN_WITH_LAST_VALS); @@ -1168,7 +1236,7 @@ args[2].value.pdb_int = drawable_ID (gimage_active_drawable (gdisplay->gimage)); /* run the plug-in procedure */ - plug_in_run (last_plug_in, args, FALSE, TRUE); + plug_in_run (wire_buffer->last_plug_in, args, FALSE, TRUE); g_free (args); } @@ -1182,7 +1250,7 @@ int sensitive = FALSE; int base_type = tag_to_drawable_type (t); - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { proc_def = tmp->data; @@ -1252,7 +1320,7 @@ } menus_set_sensitive (proc_def->menu_path, sensitive); - if (last_plug_in && (last_plug_in == &(proc_def->db_info))) + if (wire_buffer->last_plug_in && (wire_buffer->last_plug_in == &(proc_def->db_info))) { menus_set_sensitive ("/Filters/Repeat last", sensitive); menus_set_sensitive ("/Filters/Re-show last", sensitive); @@ -1267,26 +1335,25 @@ GdkInputCondition cond) { WireMessage msg; - plug_in_push ((PlugIn*) data); - memset (&msg, 0, sizeof (WireMessage)); - if (!wire_read_msg (current_readfd, &msg)) - plug_in_close (current_plug_in, TRUE); + if (!wire_read_msg (wire_buffer->current_readfd, &msg)) + plug_in_close (wire_buffer->current_plug_in, TRUE); else { plug_in_handle_message (&msg); wire_destroy (&msg); } - - if (!current_plug_in->open) - plug_in_destroy (current_plug_in); + if (!wire_buffer->current_plug_in->open) + plug_in_destroy (wire_buffer->current_plug_in); else plug_in_pop (); } static void -plug_in_handle_message (WireMessage *msg) +plug_in_handle_proc_return (GPProcReturn *proc_return); + +void plug_in_handle_message (WireMessage *msg) { switch (msg->type) { @@ -1295,34 +1362,42 @@ break; case GP_CONFIG: g_message ("plug_in_handle_message(): received a config message (should not happen)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); break; case GP_TILE_REQ: plug_in_handle_tile_req (msg->data); break; case GP_TILE_ACK: g_message ("plug_in_handle_message(): received a config message (should not happen)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); break; case GP_TILE_DATA: g_message ("plug_in_handle_message(): received a config message (should not happen)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); break; case GP_PROC_RUN: plug_in_handle_proc_run (msg->data); break; +#ifdef WIN32not + case GP_PROC_RETURN: + case GP_TEMP_PROC_RUN: + case GP_TEMP_PROC_RETURN: + printf("WARNING: unexpected plug-in message! (plug_in_handle_proc_return missing)\n"); + break; +#else case GP_PROC_RETURN: plug_in_handle_proc_return (msg->data); - plug_in_close (current_plug_in, FALSE); + plug_in_close (wire_buffer->current_plug_in, FALSE); break; case GP_TEMP_PROC_RUN: g_message ("plug_in_handle_message(): received a temp proc run message (should not happen)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); break; case GP_TEMP_PROC_RETURN: plug_in_handle_proc_return (msg->data); gtk_main_quit (); break; +#endif case GP_PROC_INSTALL: plug_in_handle_proc_install (msg->data); break; @@ -1338,7 +1413,7 @@ static void plug_in_handle_quit () { - plug_in_close (current_plug_in, FALSE); + plug_in_close (wire_buffer->current_plug_in, FALSE); } static void @@ -1363,27 +1438,27 @@ tile_data.bpp = 0; tile_data.width = 0; tile_data.height = 0; - tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; + tile_data.use_shm = (wire_buffer->shm_ID == -1) ? FALSE : TRUE; tile_data.data = NULL; - if (!gp_tile_data_write (current_writefd, &tile_data)) + if (!gp_tile_data_write (wire_buffer->current_writefd, &tile_data)) { g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } - if (!wire_read_msg (current_readfd, &msg)) + if (!wire_read_msg (wire_buffer->current_readfd, &msg)) { g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } if (msg.type != GP_TILE_DATA) { g_message ("expected tile data and received: %d\n", msg.type); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } @@ -1398,7 +1473,7 @@ if (!canvas) { g_message ("plug-in requested invalid drawable (killing)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } @@ -1417,7 +1492,7 @@ if (!canvas_portion_data( canvas, x, y)) { g_message ("plug-in requested invalid tile (killing)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); canvas_portion_unref (canvas, x, y); return; } @@ -1437,17 +1512,17 @@ pixelarea_init (&a, canvas, x, y, ewidth, eheight, TRUE); if (tile_data.use_shm) - plug_in_copyarea (&a, shm_addr, COPY_BUFFER_TO_AREA); /* shm to gimp */ + plug_in_copyarea (&a, wire_buffer->shm_addr, COPY_BUFFER_TO_AREA); /* shm to gimp */ else plug_in_copyarea (&a, tile_info->data, COPY_BUFFER_TO_AREA); /* pipe buffer to gimp */ canvas_portion_unref (canvas, x, y); wire_destroy (&msg); - if (!gp_tile_ack_write (current_writefd)) + if (!gp_tile_ack_write (wire_buffer->current_writefd)) { g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } } @@ -1461,7 +1536,7 @@ if (!canvas) { g_message ("plug-in requested invalid drawable (killing)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } @@ -1481,7 +1556,7 @@ if (!canvas_portion_data( canvas, x, y)) { g_message ("plug-in requested invalid tile (killing)\n"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); canvas_portion_unref (canvas, x, y); return; } @@ -1505,34 +1580,34 @@ tile_data.height = eheight; tile_data.width = ewidth; - tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; + tile_data.use_shm = (wire_buffer->shm_ID == -1) ? FALSE : TRUE; /*printf(" ewidth = %d, eheight = %d \n", ewidth, eheight);*/ pixelarea_init (&a, canvas, x, y, ewidth, eheight, FALSE); if (tile_data.use_shm) - plug_in_copyarea (&a, shm_addr, COPY_AREA_TO_BUFFER); /* gimp to shm*/ + plug_in_copyarea (&a, wire_buffer->shm_addr, COPY_AREA_TO_BUFFER); /* gimp to shm*/ else plug_in_copyarea (&a, tile_data.data, COPY_AREA_TO_BUFFER); /* gimp to pipe buffer */ canvas_portion_unref (canvas, x, y); - if (!gp_tile_data_write (current_writefd, &tile_data)) + if (!gp_tile_data_write (wire_buffer->current_writefd, &tile_data)) { g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } - if (!wire_read_msg (current_readfd, &msg)) + if (!wire_read_msg (wire_buffer->current_readfd, &msg)) { g_message ("plug_in_handle_tile_req: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } if (msg.type != GP_TILE_ACK) { g_message ("expected tile ack and received: %d\n", msg.type); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } @@ -1627,10 +1702,10 @@ proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); } - if (!gp_proc_return_write (current_writefd, &proc_return)) + if (!gp_proc_return_write (wire_buffer->current_writefd, &proc_return)) { g_message ("plug_in_handle_proc_run: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } @@ -1641,9 +1716,9 @@ else { blocked = g_new (PlugInBlocked, 1); - blocked->plug_in = current_plug_in; + blocked->plug_in = wire_buffer->current_plug_in; blocked->proc_name = g_strdup (proc_run->name); - blocked_plug_ins = g_slist_prepend (blocked_plug_ins, blocked); + wire_buffer->blocked_plug_ins = g_slist_prepend (wire_buffer->blocked_plug_ins, blocked); } } @@ -1653,16 +1728,16 @@ PlugInBlocked *blocked; GSList *tmp; - if (current_plug_in->recurse) + if (wire_buffer->current_plug_in->recurse) { - current_return_vals = plug_in_params_to_args (proc_return->params, + wire_buffer->current_return_vals = plug_in_params_to_args (proc_return->params, proc_return->nparams, TRUE); - current_return_nvals = proc_return->nparams; + wire_buffer->current_return_nvals = proc_return->nparams; } else { - tmp = blocked_plug_ins; + tmp = wire_buffer->blocked_plug_ins; while (tmp) { blocked = tmp->data; @@ -1671,15 +1746,14 @@ if (strcmp (blocked->proc_name, proc_return->name) == 0) { plug_in_push (blocked->plug_in); - if (!gp_proc_return_write (current_writefd, proc_return)) + if (!gp_proc_return_write (wire_buffer->current_writefd, proc_return)) { g_message ("plug_in_handle_proc_run: ERROR"); - plug_in_close (current_plug_in, TRUE); + plug_in_close (wire_buffer->current_plug_in, TRUE); return; } plug_in_pop (); - - blocked_plug_ins = g_slist_remove (blocked_plug_ins, blocked); + wire_buffer->blocked_plug_ins = g_slist_remove (wire_buffer->blocked_plug_ins, blocked); g_free (blocked->proc_name); g_free (blocked); break; @@ -1714,7 +1788,7 @@ { g_message ("plug-in \"%s\" attempted to install procedure \"%s\" which " "does not take the standard plug-in args", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1727,7 +1801,7 @@ { g_message ("plug-in \"%s\" attempted to install procedure \"%s\" which " "does not take the standard plug-in args", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1742,7 +1816,7 @@ { g_message ("plug-in \"%s\" attempted to install procedure \"%s\" which " "does not take the standard plug-in args", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1755,7 +1829,7 @@ { g_message ("plug-in \"%s\" attempted to install procedure \"%s\" which " "does not take the standard plug-in args", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1770,7 +1844,7 @@ { g_message ("plug-in \"%s\" attempted to install procedure \"%s\" which " "does not take the standard plug-in args", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1779,7 +1853,7 @@ g_message ("plug-in \"%s\" attempted to install procedure \"%s\" in " "an invalid menu location. Use either \"\", \"\", " "\"\", or \"\".", - current_plug_in->args[0], proc_install->name); + wire_buffer->current_plug_in->args[0], proc_install->name); return; } } @@ -1799,7 +1873,7 @@ g_message ("plug_in \"%s\" attempted to install procedure \"%s\" " "which fails to comply with the array parameter " "passing standard. Argument %d is noncompliant.", - current_plug_in->args[0], proc_install->name, i); + wire_buffer->current_plug_in->args[0], proc_install->name, i); return; } } @@ -1814,7 +1888,7 @@ { case PDB_PLUGIN: case PDB_EXTENSION: - plug_in_def = current_plug_in->user_data; + plug_in_def = wire_buffer->current_plug_in->user_data; prog = plug_in_def->prog; tmp = plug_in_def->proc_defs; @@ -1823,7 +1897,7 @@ case PDB_TEMPORARY: prog = "none"; - tmp = current_plug_in->temp_proc_defs; + tmp = wire_buffer->current_plug_in->temp_proc_defs; break; } @@ -1904,10 +1978,10 @@ case PDB_TEMPORARY: if (add_proc_def) - current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); + wire_buffer->current_plug_in->temp_proc_defs = g_slist_prepend (wire_buffer->current_plug_in->temp_proc_defs, proc_def); - proc_defs = g_slist_append (proc_defs, proc_def); - proc->exec_method.temporary.plug_in = (void *) current_plug_in; + wire_buffer->proc_defs = g_slist_append (wire_buffer->proc_defs, proc_def); + proc->exec_method.temporary.plug_in = (void *) wire_buffer->current_plug_in; procedural_db_register (proc); /* If there is a menu path specified, create a menu entry */ @@ -1929,7 +2003,7 @@ PlugInProcDef *proc_def; GSList *tmp; - tmp = current_plug_in->temp_proc_defs; + tmp = wire_buffer->current_plug_in->temp_proc_defs; while (tmp) { proc_def = tmp->data; @@ -1937,91 +2011,36 @@ if (strcmp (proc_def->db_info.name, proc_uninstall->name) == 0) { - current_plug_in->temp_proc_defs = g_slist_remove (current_plug_in->temp_proc_defs, proc_def); + wire_buffer->current_plug_in->temp_proc_defs = g_slist_remove (wire_buffer->current_plug_in->temp_proc_defs, proc_def); plug_in_proc_def_remove (proc_def); break; } } } -static int -plug_in_write (int fd, - guint8 *buf, - gulong count) -{ - gulong bytes; - - while (count > 0) - { - if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) - { - bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; - memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes); - current_write_buffer_index += bytes; - if (!wire_flush (fd)) - return FALSE; - } - else - { - bytes = count; - memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes); - current_write_buffer_index += bytes; - } - - buf += bytes; - count -= bytes; - } - - return TRUE; -} - -static int -plug_in_flush (int fd) -{ - int count; - int bytes; - - if (current_write_buffer_index > 0) - { - count = 0; - while (count != current_write_buffer_index) - { - do { - bytes = write (fd, ¤t_write_buffer[count], - (current_write_buffer_index - count)); - } while ((bytes == -1) && (errno == EAGAIN)); - - if (bytes == -1) - return FALSE; - - count += bytes; - } - - current_write_buffer_index = 0; - } - - return TRUE; -} - static void plug_in_push (PlugIn *plug_in) { if (plug_in) { - current_plug_in = plug_in; - plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); - - current_readfd = current_plug_in->my_read; - current_writefd = current_plug_in->my_write; - current_write_buffer_index = current_plug_in->write_buffer_index; - current_write_buffer = current_plug_in->write_buffer; + wire_buffer->current_plug_in = plug_in; + wire_buffer->plug_in_stack = g_slist_prepend (wire_buffer->plug_in_stack, wire_buffer->current_plug_in); +#ifdef WIN32 + wire_buffer->current_buffer_index = wire_buffer->buffer_write_index; + wire_buffer->current_buffer = wire_buffer->buffer; +#else + wire_buffer->current_readfd = wire_buffer->current_plug_in->my_read; + wire_buffer->current_writefd = wire_buffer->current_plug_in->my_write; + wire_buffer->current_buffer_index = wire_buffer->current_plug_in->buffer_index; + wire_buffer->current_buffer = wire_buffer->current_plug_in->buffer; +#endif } else { - current_readfd = 0; - current_writefd = 0; - current_write_buffer_index = 0; - current_write_buffer = NULL; + wire_buffer->current_readfd = 0; + wire_buffer->current_writefd = 0; + wire_buffer->current_buffer_index = 0; + wire_buffer->current_buffer = NULL; } } @@ -2030,31 +2049,34 @@ { GSList *tmp; - if (current_plug_in) + if (wire_buffer->current_plug_in) { - current_plug_in->write_buffer_index = current_write_buffer_index; - - tmp = plug_in_stack; - plug_in_stack = plug_in_stack->next; +#ifndef WIN32 + wire_buffer->buffer_write_index = wire_buffer->current_buffer_index; +#endif + tmp = wire_buffer->plug_in_stack; + wire_buffer->plug_in_stack = wire_buffer->plug_in_stack->next; tmp->next = NULL; g_slist_free (tmp); } - if (plug_in_stack) + if (wire_buffer->plug_in_stack) { - current_plug_in = plug_in_stack->data; - current_readfd = current_plug_in->my_read; - current_writefd = current_plug_in->my_write; - current_write_buffer_index = current_plug_in->write_buffer_index; - current_write_buffer = current_plug_in->write_buffer; + wire_buffer->current_plug_in = wire_buffer->plug_in_stack->data; +#ifndef WIN32 + wire_buffer->current_readfd = wire_buffer->current_plug_in->my_read; + wire_buffer->current_writefd = wire_buffer->current_plug_in->my_write; +#endif + wire_buffer->current_buffer_index = wire_buffer->buffer_write_index; + wire_buffer->current_buffer = wire_buffer->buffer; } else { - current_plug_in = NULL; - current_readfd = 0; - current_writefd = 0; - current_write_buffer_index = 0; - current_write_buffer = NULL; + wire_buffer->current_plug_in = NULL; + wire_buffer->current_readfd = 0; + wire_buffer->current_writefd = 0; + wire_buffer->current_buffer_index = 0; + wire_buffer->current_buffer = NULL; } } @@ -2079,6 +2101,9 @@ static void plug_in_write_rc (char *filename) { +#ifdef WIN32 + +#else FILE *fp; PlugInDef *plug_in_def; PlugInProcDef *proc_def; @@ -2089,7 +2114,7 @@ if (!fp) return; - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { plug_in_def = tmp->data; @@ -2173,6 +2198,7 @@ } fclose (fp); +#endif } static void @@ -2188,9 +2214,11 @@ name = name + 1; else name = filename; - +#ifdef _DEBUG + printf("Loading plug-in: %s\n",filename); +#endif plug_in_def = NULL; - tmp = plug_in_defs; + tmp = wire_buffer->plug_in_defs; while (tmp) { @@ -2218,7 +2246,7 @@ plug_in_def->mtime = datafile_mtime (); plug_in_def->query = TRUE; - plug_in_defs = g_slist_append (plug_in_defs, plug_in_def); + wire_buffer->plug_in_defs = g_slist_append (wire_buffer->plug_in_defs, plug_in_def); } static void @@ -2230,26 +2258,26 @@ plug_in = plug_in_new (filename); if (plug_in) - { - plug_in->query = TRUE; + { plug_in->query = TRUE; plug_in->synchronous = TRUE; plug_in->user_data = plug_in_def; - if (plug_in_open (plug_in)) { +#ifdef WIN32 +/* This is a hack because WIN32 has no pipes. Pass the wire_buffer itself. Robin */ + wire_buffer->current_readfd=(int)wire_buffer; +#endif plug_in_push (plug_in); - while (plug_in->open) { - if (!wire_read_msg (current_readfd, &msg)) - plug_in_close (current_plug_in, TRUE); + if (!wire_read_msg (wire_buffer->current_readfd, &msg)) + plug_in_close (wire_buffer->current_plug_in, TRUE); else { plug_in_handle_message (&msg); wire_destroy (&msg); } } - plug_in_pop (); plug_in_destroy (plug_in); } @@ -2264,7 +2292,7 @@ Argument *return_vals; GSList *tmp; - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { @@ -2273,12 +2301,15 @@ if (proc_def->prog && (proc_def->db_info.proc_type != PDB_INTERNAL)) { +#ifdef WIN32 + proc_def->db_info.exec_method.plug_in.plugin_main = 0; +#endif proc_def->db_info.exec_method.plug_in.filename = proc_def->prog; procedural_db_register (&proc_def->db_info); } } - for (tmp = proc_defs; tmp; tmp = tmp->next) + for (tmp = wire_buffer->proc_defs; tmp; tmp = tmp->next) { proc_def = tmp->data; @@ -2317,7 +2348,7 @@ PlugInProcDef *proc_def; GSList *tmp; - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { proc_def = tmp->data; @@ -2346,7 +2377,7 @@ PlugInProcDef *proc_def; GSList *tmp; - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { proc_def = tmp->data; @@ -2446,7 +2477,7 @@ plug_in_run (proc_rec, args, FALSE, TRUE); if (proc_rec->proc_type == PDB_PLUGIN) - last_plug_in = proc_rec; + wire_buffer->last_plug_in = proc_rec; g_free (args); } @@ -2459,7 +2490,7 @@ GSList *list; prev = NULL; - tmp = proc_defs; + tmp = wire_buffer->proc_defs; while (tmp) { @@ -2494,7 +2525,7 @@ if (prev) prev->next = list; else - proc_defs = list; + wire_buffer->proc_defs = list; return; } @@ -2502,7 +2533,7 @@ tmp = tmp->next; } - proc_defs = g_slist_append (proc_defs, proc_def); + wire_buffer->proc_defs = g_slist_append (wire_buffer->proc_defs, proc_def); } static void @@ -2516,7 +2547,7 @@ procedural_db_unregister (proc_def->db_info.name); /* Remove the defintion from the global list */ - proc_defs = g_slist_remove (proc_defs, proc_def); + wire_buffer->proc_defs = g_slist_remove (wire_buffer->proc_defs, proc_def); /* Destroy the definition */ plug_in_proc_def_destroy (proc_def, TRUE); @@ -2603,20 +2634,17 @@ plug_in->busy = TRUE; plug_in_push (plug_in); - proc_run.name = proc_rec->name; proc_run.nparams = proc_rec->num_args; proc_run.params = plug_in_args_to_params (args, proc_rec->num_args, FALSE); - if (!gp_temp_proc_run_write (current_writefd, &proc_run) || - !wire_flush (current_writefd)) + if (!gp_temp_proc_run_write (wire_buffer->current_writefd, &proc_run) || + !wire_flush (wire_buffer->current_writefd)) { return_vals = procedural_db_return_args (proc_rec, FALSE); goto done; } - plug_in_pop (); - plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE); old_recurse = plug_in->recurse; @@ -3258,7 +3286,11 @@ PlugIn *plug_in) { plug_in->progress = NULL; +#ifdef WIN32 + +#else plug_in_destroy (plug_in); +#endif } static void @@ -3347,11 +3379,11 @@ { int success = FALSE; - if (current_plug_in && current_plug_in->open) + if (wire_buffer->current_plug_in && wire_buffer->current_plug_in->open) { success = TRUE; if (no_interface == FALSE) - plug_in_progress_init (current_plug_in, args[0].value.pdb_pointer); + plug_in_progress_init (wire_buffer->current_plug_in, args[0].value.pdb_pointer); } return procedural_db_return_args (&progress_init_proc, success); @@ -3362,11 +3394,11 @@ { int success = FALSE; - if (current_plug_in && current_plug_in->open) + if (wire_buffer->current_plug_in && wire_buffer->current_plug_in->open) { success = TRUE; if (no_interface == FALSE) - plug_in_progress_update (current_plug_in, args[0].value.pdb_float); + plug_in_progress_update (wire_buffer->current_plug_in, args[0].value.pdb_float); } return procedural_db_return_args (&progress_update_proc, success); diff -aur --strip-trailing-cr filmgimp-0.7/app/plug_in.h filmgimp-0.7-new/app/plug_in.h --- filmgimp-0.7/app/plug_in.h 2002-09-28 14:31:34.000000000 -0700 +++ filmgimp-0.7-new/app/plug_in.h 2003-02-14 13:14:09.000000000 -0800 @@ -20,11 +20,18 @@ #include "gtk/gtk.h" -#include "procedural_db.h" -#include "tag.h" +#include "../app/procedural_db.h" +#include "../app/tag.h" -#define WRITE_BUFFER_SIZE 512 +#ifdef WIN32 +#include +#else + +#endif +/* +#define WRITE_BUFFER_SIZE 512 +*/ #define RGB_IMAGE 0x01 #define GRAY_IMAGE 0x02 #define INDEXED_IMAGE 0x04 @@ -48,6 +55,9 @@ typedef struct _PlugIn PlugIn; typedef struct _PlugInDef PlugInDef; typedef struct _PlugInProcDef PlugInProcDef; +struct WireBuffer; + +#define PLUG_IN_ARGS 7 struct _PlugIn { @@ -57,17 +67,28 @@ unsigned int synchronous : 1; /* Is the plug-in running synchronously or not */ unsigned int recurse : 1; /* Have we called 'gtk_main' recursively? */ unsigned int busy : 1; /* Is the plug-in busy with a temp proc? */ +#ifdef WIN32 + HINSTANCE handle; +#else pid_t pid; /* Plug-ins process id */ - char *args[7]; /* Plug-ins command line arguments */ +#endif + char *args[PLUG_IN_ARGS]; /* Plug-ins command line arguments */ +#ifdef WIN32 + PluginMain plugin_main; +#else int my_read, my_write; /* Apps read and write file descriptors */ int his_read, his_write; /* Plug-ins read and write file descriptors */ guint32 input_id; /* Id of input proc */ - - char write_buffer[WRITE_BUFFER_SIZE]; /* Buffer for writing */ - int write_buffer_index; /* Buffer index for writing */ - +#endif +/* char write_buffer[WRITE_BUFFER_SIZE]; */ /* Buffer for writing */ +/* int write_buffer_index; */ /* Buffer index for writing */ +/* + static guint8* wire_buffer; + guint wire_buffer_index; + guint wire_buffer_offset; +*/ GSList *temp_proc_defs; /* Temporary procedures */ GtkWidget *progress; /* Progress dialog */ @@ -75,6 +96,7 @@ GtkWidget *progress_bar; gpointer user_data; /* Handle for hanging data onto */ + WireBuffer* wire_buffer; }; struct _PlugInDef @@ -99,12 +121,20 @@ GSList *extensions_list; GSList *prefixes_list; GSList *magics_list; +#ifdef WIN32 + PluginMain plugin_main; +#endif + }; +typedef struct _WireMessage WireMessage; +void plug_in_handle_message(WireMessage* msg); /* Initialize the plug-ins */ void plug_in_init (void); - +#ifdef WIN32 +DWORD WINAPI plug_in_init_thread(void*); +#endif /* Kill all running plug-ins */ void plug_in_kill (void); diff -aur --strip-trailing-cr filmgimp-0.7/app/posterize.c filmgimp-0.7-new/app/posterize.c --- filmgimp-0.7/app/posterize.c 2002-09-28 14:31:34.000000000 -0700 +++ filmgimp-0.7-new/app/posterize.c 2003-02-08 13:49:10.000000000 -0800 @@ -30,6 +30,11 @@ #include "tag.h" #include "minimize.h" +#ifdef WIN32 +#include +#define g_message printf +#endif + #define TEXT_WIDTH 55 typedef struct _Posterize Posterize; diff -aur --strip-trailing-cr filmgimp-0.7/app/procedural_db.c filmgimp-0.7-new/app/procedural_db.c --- filmgimp-0.7/app/procedural_db.c 2002-09-28 14:31:34.000000000 -0700 +++ filmgimp-0.7-new/app/procedural_db.c 2003-02-28 10:32:58.000000000 -0800 @@ -20,14 +20,24 @@ #include #include #include + +#ifdef WIN32 +#include "extra.h" +#else #include "regex.h" +#endif + #include "appenv.h" #include "app_procs.h" #include "general.h" #include "gdisplay.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "procedural_db.h" +#ifdef WIN32 +#define g_message printf +#endif + /* Query structure */ typedef struct _PDBQuery PDBQuery; @@ -553,7 +563,7 @@ Argument *return_args; GList *list; int i; - + printf("procedural_db_execute: %s\n",name); return_args = NULL; list = g_hash_table_lookup (procedural_ht, (gpointer) name); @@ -609,7 +619,10 @@ return_args->value.pdb_int = PDB_EXECUTION_ERROR; break; } - + if(!return_args) + { puts("ERROR: procedural_db_execute failed!"); + return 0; + } if ((return_args[0].value.pdb_int != PDB_SUCCESS) && (procedure->num_values > 0)) memset (&return_args[1], 0, sizeof (Argument) * procedure->num_values); @@ -1068,6 +1081,9 @@ g_hash_table_foreach (procedural_ht, procedural_db_query_entry, &pdb_query); +#ifdef WIN32 + +#else free (pdb_query.name_regex.buffer); free (pdb_query.blurb_regex.buffer); free (pdb_query.help_regex.buffer); @@ -1075,6 +1091,7 @@ free (pdb_query.copyright_regex.buffer); free (pdb_query.date_regex.buffer); free (pdb_query.proc_type_regex.buffer); +#endif return_args = procedural_db_return_args (&procedural_db_query_proc, TRUE); diff -aur --strip-trailing-cr filmgimp-0.7/app/procedural_db.h filmgimp-0.7-new/app/procedural_db.h --- filmgimp-0.7/app/procedural_db.h 2002-09-28 14:31:34.000000000 -0700 +++ filmgimp-0.7-new/app/procedural_db.h 2003-01-25 20:35:33.000000000 -0800 @@ -18,6 +18,8 @@ #ifndef __PROCEDURAL_DB_H__ #define __PROCEDURAL_DB_H__ +#include "glib.h" + /* Procedural database types */ typedef enum { @@ -98,8 +100,14 @@ ArgMarshal marshal_func; /* Function called to marshal arguments */ }; +typedef struct _WireBuffer WireBuffer; +typedef int (*PluginMain)(void* data); + struct _PlugInExec { +#ifdef WIN32 + PluginMain plugin_main; /* dll entry point */ +#endif gchar * filename; /* Where is the executable on disk? */ }; diff -aur --strip-trailing-cr filmgimp-0.7/app/regex.c filmgimp-0.7-new/app/regex.c --- filmgimp-0.7/app/regex.c 2002-09-28 14:31:36.000000000 -0700 +++ filmgimp-0.7-new/app/regex.c 2002-11-24 17:39:07.000000000 -0800 @@ -26,7 +26,7 @@ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (REGEX_MALLOC) - #pragma alloca + #pragma NO_alloca #endif #undef _GNU_SOURCE @@ -36,6 +36,10 @@ #include #endif +#ifdef WIN32 +#include "config.h" +#endif + #if defined(STDC_HEADERS) && !defined(emacs) #include #else @@ -254,18 +258,20 @@ #else /* not REGEX_MALLOC */ /* Emacs already defines alloca, sometimes. */ -#ifndef alloca +#ifndef NO_alloca /* Make alloca work the best possible way. */ #ifdef __GNUC__ -#define alloca __builtin_alloca +#define NO_alloca __builtin_alloca #else /* not __GNUC__ */ #if HAVE_ALLOCA_H -#include +#include #else /* not __GNUC__ or HAVE_ALLOCA_H */ -#if 0 /* It is a bad idea to declare alloca. We always cast the result. */ +#ifdef WIN32 /* rower: Is this a big bug? Was 'if 0' before. + +It is a bad idea to declare alloca. We always cast the result. */ #ifndef _AIX /* Already did AIX, up at the top. */ -char *alloca (); +char *NO_alloca (); #endif /* not _AIX */ #endif #endif /* not HAVE_ALLOCA_H */ @@ -273,8 +279,12 @@ #endif /* not alloca */ -#define REGEX_ALLOCATE alloca - +#define REGEX_ALLOCATE NO_alloca +/*#ifdef WIN32 +#error +#endif +rower: Windows goes nuts with alloca! +*/ /* Assumes a `char *destination' variable. */ #define REGEX_REALLOCATE(source, osize, nsize) \ (destination = (char *) alloca (nsize), \ @@ -1012,7 +1022,9 @@ faith that they will not malloc. */ /* Normally, this is fine. */ +#ifndef WIN32 #define MATCH_MAY_ALLOCATE +#endif /* When using GNU C, we are not REALLY using the C alloca, no matter what config.h may say. So don't take precautions for it. */ @@ -3303,7 +3315,35 @@ the null string, though. */ if (p + j < pend) { +#ifdef WIN32 + if (!((FAIL_STACK_FULL () + && !((fail_stack).size > (unsigned) + (re_max_failures * MAX_FAILURE_ITEMS) + ? 0 + : ((fail_stack).stack = (fail_stack_elt_t *) + REGEX_REALLOCATE_STACK ((fail_stack).stack, + (fail_stack).size * sizeof (fail_stack_elt_t), + ((fail_stack).size << 1) * + sizeof (fail_stack_elt_t)), + + (fail_stack).stack == NULL + ? 0 + : ((fail_stack).size <<= 1, + 1))) ) + + + ? 0 + : ((fail_stack).stack[(fail_stack).avail++].pointer = p + j, + 1)) ) + + + + + + +#else if (!PUSH_PATTERN_OP (p + j, fail_stack)) +#endif { RESET_FAIL_STACK (); return -2; @@ -3734,6 +3774,9 @@ struct re_registers *regs; int stop; { +#ifdef WIN32 + char* destination; +#endif /* General temporaries. */ int mcnt; unsigned char *p1; diff -aur --strip-trailing-cr filmgimp-0.7/app/scale_tool.c filmgimp-0.7-new/app/scale_tool.c --- filmgimp-0.7/app/scale_tool.c 2002-09-28 14:31:36.000000000 -0700 +++ filmgimp-0.7-new/app/scale_tool.c 2002-11-12 20:41:05.000000000 -0800 @@ -32,6 +32,10 @@ #include "transform_tool.h" #include "undo.h" +#ifdef WIN32 +#include +#endif + #define X1 0 #define Y1 1 #define X2 2 diff -aur --strip-trailing-cr filmgimp-0.7/app/shmbuf.c filmgimp-0.7-new/app/shmbuf.c --- filmgimp-0.7/app/shmbuf.c 2002-09-28 14:31:14.000000000 -0700 +++ filmgimp-0.7-new/app/shmbuf.c 2002-11-24 16:44:54.000000000 -0800 @@ -18,12 +18,19 @@ #include #include + +#include "procedural_db.h" +#include "trace.h" + +#ifdef WIN32 +#include "shm.h" +#undef RGB +#else #include #include +#endif #include "shmbuf.h" -#include "procedural_db.h" -#include "trace.h" /* for now we can only attach to one shm segment */ static int SHMid = 0; diff -aur --strip-trailing-cr filmgimp-0.7/app/smudge.c filmgimp-0.7-new/app/smudge.c --- filmgimp-0.7/app/smudge.c 2002-09-28 14:31:12.000000000 -0700 +++ filmgimp-0.7-new/app/smudge.c 2002-11-14 09:18:33.000000000 -0800 @@ -272,7 +272,7 @@ tool = paint_core_new (SMUDGE); private = (PaintCore *) tool->private; - private->paint_func = smudge_paint_func; + private->paint_func = (PaintFunc16) smudge_paint_func; private->painthit_setup = smudge_painthit_setup; return tool; @@ -445,7 +445,7 @@ stroke_array[0], stroke_array[1])) { /* Set the paint core's paint func */ - non_gui_paint_core.paint_func = smudge_non_gui_paint_func; + non_gui_paint_core.paint_func = (PaintFunc16) smudge_non_gui_paint_func; non_gui_paint_core.startx = non_gui_paint_core.lastx = stroke_array[0]; non_gui_paint_core.starty = non_gui_paint_core.lasty = stroke_array[1]; diff -aur --strip-trailing-cr filmgimp-0.7/app/store_frame_manager.c filmgimp-0.7-new/app/store_frame_manager.c --- filmgimp-0.7/app/store_frame_manager.c 2002-11-07 20:49:51.000000000 -0800 +++ filmgimp-0.7-new/app/store_frame_manager.c 2003-02-08 13:41:37.000000000 -0800 @@ -31,6 +31,10 @@ #include "tools/stop.xpm" #include "tools/stop_is.xpm" +#ifdef WIN32 +#define g_message printf +#endif + typedef gint (*CallbackAction) (GtkWidget *, gpointer); #define STORE_LIST_WIDTH 200 #define STORE_LIST_HEIGHT 150 @@ -307,11 +311,11 @@ tooltip = gtk_tooltips_new (); gtk_tooltips_set_tip (tooltip, event_box, - "RO - read only. This store will not be saved\n - A - advance. This store is affected by the advance controls\n - F - flip. This store is affected by the flip book controls\n - Bg - background. This is the src in a clone and the bg in the onionskin\n - * - modified. This store has been modified", NULL); + "RO - read only. This store will not be saved\n" + "A - advance. This store is affected by the advance controls\n" + "F - flip. This store is affected by the flip book controls\n" + "Bg - background. This is the src in a clone and the bg in the onionskin\n" + "* - modified. This store has been modified", NULL); /* Add the CList widget to the vertical box and show it. */ gtk_container_add(GTK_CONTAINER(event_box), disp->bfm->sfm->store_list); @@ -358,9 +362,9 @@ tooltip = gtk_tooltips_new (); gtk_tooltips_set_tip (tooltip, slider, - "Sets the opacity for onion skinning.\n - LMB to drag slider\n - MMB to jump", NULL); + "Sets the opacity for onion skinning.\n" + "LMB to drag slider\n" + "MMB to jump", NULL); button = gtk_button_new_with_label ("Bg/Fg"); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); diff -aur --strip-trailing-cr filmgimp-0.7/app/tag.h filmgimp-0.7-new/app/tag.h --- filmgimp-0.7/app/tag.h 2002-09-28 14:31:10.000000000 -0700 +++ filmgimp-0.7-new/app/tag.h 2003-01-01 13:20:43.000000000 -0800 @@ -19,7 +19,12 @@ #define __TAG_H__ #include "glib.h" +#include "../plug-ins/precision.h" +#ifdef WIN32 +#include "extra.h" +#undef RGB +#endif typedef guint Tag; @@ -38,18 +43,6 @@ #define MASK_ALPHA 0xff #define SHIFT_ALPHA 8 - -/* supported precisions */ -typedef enum -{ - PRECISION_NONE, - PRECISION_U8, - PRECISION_U16, - PRECISION_FLOAT, - PRECISION_FLOAT16 -} Precision; - - /* the supported formats */ typedef enum { diff -aur --strip-trailing-cr filmgimp-0.7/app/temp_buf.c filmgimp-0.7-new/app/temp_buf.c --- filmgimp-0.7/app/temp_buf.c 2002-09-28 14:31:37.000000000 -0700 +++ filmgimp-0.7-new/app/temp_buf.c 2003-02-08 13:41:37.000000000 -0800 @@ -31,6 +31,9 @@ #include "paint_funcs_area.h" #include "temp_buf.h" +#ifdef WIN32 +#define g_message printf +#endif static unsigned char * temp_buf_allocate (unsigned int); static void temp_buf_to_color (TempBuf *, TempBuf *); diff -aur --strip-trailing-cr filmgimp-0.7/app/text_tool.c filmgimp-0.7-new/app/text_tool.c --- filmgimp-0.7/app/text_tool.c 2002-11-06 21:51:29.000000000 -0800 +++ filmgimp-0.7-new/app/text_tool.c 2003-02-08 13:41:37.000000000 -0800 @@ -48,6 +48,10 @@ #include "drawable_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif + #define FONT_LIST_WIDTH 125 #define FONT_LIST_HEIGHT 200 @@ -65,6 +69,11 @@ #define SUPERSAMPLE 3 +#ifdef WIN32 +/*#include +#define BlackPixel gdk_color_black*/ +#endif + typedef struct _TextTool TextTool; struct _TextTool { @@ -1121,9 +1130,11 @@ int i, j; /* construct a valid font pattern */ - +#ifdef WIN32 + num_fonts=0; +#else fontnames = XListFonts (DISPLAY, "-*-*-*-*-*-*-0-0-75-75-*-0-*-*", 32767, &num_fonts); - +#endif /* the maximum size of the table is the number of font names returned */ font_info = g_malloc (sizeof (FontInfo**) * num_fonts); @@ -1143,7 +1154,11 @@ encodings = text_insert_field (encodings, fontnames[i], ENCODING); } +#ifdef WIN32 + +#else XFreeFontNames (fontnames); +#endif nfoundries = g_slist_length (foundries) + 1; nweights = g_slist_length (weights) + 1; @@ -1720,7 +1735,11 @@ int width = pixelarea_width (textPR); scale2 = scale * scale; +#ifdef WIN32 + black_pixel=0; +#else black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY)); +#endif data = pixelarea_data (textPR); outdata = (unsigned char *) g_malloc (width); @@ -1767,7 +1786,11 @@ int width = pixelarea_width (textPR); scale2 = scale * scale; +#ifdef WIN32 + black_pixel=0; +#else black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY)); +#endif outdata = (guint16 *) g_malloc (width*sizeof(guint16)); for (y = 0, scaley = 0; y < pixelarea_height (textPR); y++, scaley += scale) @@ -1813,7 +1836,11 @@ int width = pixelarea_width (textPR); scale2 = scale * scale; +#ifdef WIN32 + black_pixel=0; +#else black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY)); +#endif outdata = (gfloat *) g_malloc (width*sizeof(gfloat)); for (y = 0, scaley = 0; y < pixelarea_height (textPR); y++, scaley += scale) @@ -1862,7 +1889,11 @@ int width = pixelarea_width (textPR); scale2 = scale * scale; +#ifdef WIN32 + black_pixel=0; +#else black_pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY)); +#endif outdata = (guint16*) g_malloc (width * sizeof(guint16)); for (y = 0, scaley = 0; y < pixelarea_height (textPR); y++, scaley += scale) { @@ -1991,9 +2022,13 @@ gdk_gc_set_font (gc, font); /* get black and white pixels for this gdisplay */ +#ifdef WIN32 + black.pixel=0; + white.pixel=1; +#else black.pixel = BlackPixel (DISPLAY, DefaultScreen (DISPLAY)); white.pixel = WhitePixel (DISPLAY, DefaultScreen (DISPLAY)); - +#endif /* Render the text into the pixmap. * Since the pixmap may not fully bound the text (because we limit its size) * we must tile it around the texts actual bounding box. diff -aur --strip-trailing-cr filmgimp-0.7/app/threshold.c filmgimp-0.7-new/app/threshold.c --- filmgimp-0.7/app/threshold.c 2002-09-28 14:31:37.000000000 -0700 +++ filmgimp-0.7-new/app/threshold.c 2003-02-08 13:41:37.000000000 -0800 @@ -31,6 +31,10 @@ #include "pixelarea.h" #include "minimize.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 75 #define HISTOGRAM_WIDTH 256 #define HISTOGRAM_HEIGHT 150 diff -aur --strip-trailing-cr filmgimp-0.7/app/tile_swap.c filmgimp-0.7-new/app/tile_swap.c --- filmgimp-0.7/app/tile_swap.c 2002-09-28 14:31:38.000000000 -0700 +++ filmgimp-0.7-new/app/tile_swap.c 2003-02-08 13:50:41.000000000 -0800 @@ -5,11 +5,13 @@ #include #include - #define MAX_OPEN_SWAP_FILES 16 #include "tile_swap.h" +#ifdef WIN32 +#define g_message printf +#endif typedef struct _SwapFile SwapFile; typedef struct _DefSwapFile DefSwapFile; diff -aur --strip-trailing-cr filmgimp-0.7/app/tilebuf.c filmgimp-0.7-new/app/tilebuf.c --- filmgimp-0.7/app/tilebuf.c 2002-09-28 14:31:14.000000000 -0700 +++ filmgimp-0.7-new/app/tilebuf.c 2002-11-14 09:23:49.000000000 -0800 @@ -20,6 +20,7 @@ #include #include "tilebuf.h" +#undef RGB #include "trace.h" diff -aur --strip-trailing-cr filmgimp-0.7/app/tips_dialog.c filmgimp-0.7-new/app/tips_dialog.c --- filmgimp-0.7/app/tips_dialog.c 2002-09-28 14:31:38.000000000 -0700 +++ filmgimp-0.7-new/app/tips_dialog.c 2003-01-10 11:25:58.000000000 -0800 @@ -7,7 +7,13 @@ #include "gimprc.h" #include "interface.h" #include "wilber.h" +#undef RGB #include "minimize.h" +#include "datadir.h" + +#ifdef WIN32 +#undef RGB +#endif #define TIPS_FILE_NAME "gimp_tips.txt" @@ -219,9 +225,9 @@ fp = fopen (filename, "rt"); if (!fp) { - store_tip ("Your GIMP tips file appears to be missing!\n" + store_tip ("Your Film Gimp tips file appears to be missing!\n" "There should be a file called " TIPS_FILE_NAME " in the\n" - "GIMP data directory. Please check your installation."); + DATADIR " directory. Please check your installation."); return; } diff -aur --strip-trailing-cr filmgimp-0.7/app/trace.c filmgimp-0.7-new/app/trace.c --- filmgimp-0.7/app/trace.c 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/trace.c 2002-11-16 23:18:11.000000000 -0800 @@ -5,6 +5,12 @@ #include "pixelrow.h" #include "pixelarea.h" #include "tag.h" + +#ifdef WIN32 +#include "extra.h" +#undef RGB +#endif + #include "trace.h" /* temporary logging facilities */ @@ -44,7 +50,7 @@ extern char * g_vsprintf (); va_start (args, format); - buf = g_strdup_vprintf (format, &args); + buf = g_strdup_vprintf (format, args); va_end (args); fputs (indent+level, stdout); @@ -76,7 +82,7 @@ extern char * g_vsprintf (); va_start (args, format); - buf = g_strdup_vprintf (format, &args); + buf = g_strdup_vprintf (format, args); va_end (args); fputs (indent+level, stdout); diff -aur --strip-trailing-cr filmgimp-0.7/app/trace.h filmgimp-0.7-new/app/trace.h --- filmgimp-0.7/app/trace.h 2002-09-28 14:31:16.000000000 -0700 +++ filmgimp-0.7-new/app/trace.h 2002-11-11 00:38:33.000000000 -0800 @@ -1,5 +1,11 @@ +/* trace.h */ +#ifdef WIN32 + +#else #include +#endif + #include typedef struct diff -aur --strip-trailing-cr filmgimp-0.7/app/transform_core.c filmgimp-0.7-new/app/transform_core.c --- filmgimp-0.7/app/transform_core.c 2002-09-28 14:31:38.000000000 -0700 +++ filmgimp-0.7-new/app/transform_core.c 2003-02-08 13:41:37.000000000 -0800 @@ -44,6 +44,10 @@ #include "layer_pvt.h" #include "drawable_pvt.h" +#ifdef WIN32 +#define g_message printf +#endif + #define SQR(x) ((x) * (x)) #ifndef M_PI diff -aur --strip-trailing-cr filmgimp-0.7/app/xcf.c filmgimp-0.7-new/app/xcf.c --- filmgimp-0.7/app/xcf.c 2002-09-28 14:31:39.000000000 -0700 +++ filmgimp-0.7-new/app/xcf.c 2003-02-08 21:48:36.000000000 -0800 @@ -3,9 +3,15 @@ #include #include #include + +#ifdef WIN32 + +#else #include #include #include +#endif + #include #include @@ -21,7 +27,7 @@ #include "paint_funcs_area.h" #include "palette.h" #include "pixelarea.h" -#include "plug_in.h" +#include "../plug-ins/plug_in.h" #include "procedural_db.h" #include "tag.h" #include "tile_manager.h" @@ -34,6 +40,11 @@ #include "channel_pvt.h" #include "tile_manager_pvt.h" +#ifdef WIN32 +#define g_message printf +#define g_error printf +#endif + /* #define SWAP_FROM_FILE */ @@ -228,7 +239,8 @@ { { xcf_load_invoker } }, }, NULL, /* fill me in at runtime */ - NULL /* fill me in at runtime */ + NULL, /* fill me in at runtime */ + NULL }; static ProcArg xcf_save_args[] = @@ -2520,7 +2532,7 @@ { tmp_long = (guint32 *) &data[i]; /*tmp = htonl (*tmp_long);*/ - tmp = tmp_long; + tmp = *tmp_long; xcf_write_int8 (fp, (guint8*) &tmp, 4); } } diff -aur --strip-trailing-cr filmgimp-0.7/app/zoom.c filmgimp-0.7-new/app/zoom.c --- filmgimp-0.7/app/zoom.c 2002-09-28 14:31:12.000000000 -0700 +++ filmgimp-0.7-new/app/zoom.c 2002-11-14 09:01:30.000000000 -0800 @@ -1,6 +1,7 @@ #include #include #include +#include #include "scale.h" #include "zoom.h" #include "stdio.h" Only in filmgimp-0.7-new: gimprc Only in filmgimp-0.7-new: gimprc_user Only in filmgimp-0.7-new/libgimp: datadir.h diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimp.c filmgimp-0.7-new/libgimp/gimp.c --- filmgimp-0.7/libgimp/gimp.c 2002-09-28 14:30:56.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimp.c 2003-02-26 17:08:01.000000000 -0800 @@ -24,9 +24,17 @@ #include #include #include + +#ifdef WIN32 +#include +#include "datadir.h" +#include "extra.h" +#else #include #include #include +#endif + #include #ifdef HAVE_IPC_H @@ -42,29 +50,33 @@ #endif #include "gimp.h" -#include "gimpprotocol.h" -#include "gimpwire.h" - - -#define WRITE_BUFFER_SIZE 1024 +#include "../plug-ins/gimpprotocol.h" +#include "../plug-ins/gimpwire.h" +#include "../plug-ins/plug_in_loader.h" + +#ifdef WIN32 +#define g_message printf +#define g_error printf +#endif void gimp_extension_process (guint timeout); void gimp_extension_ack (void); static RETSIGTYPE gimp_signal (int signum); -static int gimp_write (int fd, guint8 *buf, gulong count); -static int gimp_flush (int fd); static void gimp_loop (void); static void gimp_config (GPConfig *config); static void gimp_proc_run (GPProcRun *proc_run); static void gimp_temp_proc_run (GPProcRun *proc_run); static void gimp_message_func (char *str); +#ifdef WIN32 +#else int _readfd = 0; int _writefd = 0; int _shm_ID = -1; guchar *_shm_addr = NULL; +#endif const guint gimp_major_version = GIMP_MAJOR_VERSION; const guint gimp_minor_version = GIMP_MINOR_VERSION; @@ -76,18 +88,17 @@ static guchar _color_cube[4]; static char *progname = NULL; -static guint8 write_buffer[WRITE_BUFFER_SIZE]; -static guint write_buffer_index = 0; static GHashTable *temp_proc_ht = NULL; extern GPlugInInfo PLUG_IN_INFO; +static int is_quitting; int gimp_main (int argc, char *argv[]) -{ +{ is_quitting=0; if ((argc < 4) || (strcmp (argv[1], "-gimp") != 0)) { g_print ("%s is a gimp plug-in and must be run by the gimp to be used\n", argv[0]); @@ -95,7 +106,9 @@ } progname = argv[0]; +#ifdef WIN32 +#else signal (SIGHUP, gimp_signal); signal (SIGINT, gimp_signal); signal (SIGQUIT, gimp_signal); @@ -107,12 +120,21 @@ _readfd = atoi (argv[2]); _writefd = atoi (argv[3]); - +#endif gp_init (); - wire_set_writer (gimp_write); - wire_set_flusher (gimp_flush); +#ifdef WIN32 + wire_set_reader(wire_buffer_read); + wire_set_writer(wire_buffer_write); + wire_set_flusher(wire_buffer_flush); + + if ((strcmp (argv[4], "-query") == 0)) +#else + wire_set_reader(gimp_read); + wire_set_writer(gimp_write); + wire_set_flusher(gimp_flush); if ((argc == 5) && (strcmp (argv[4], "-query") == 0)) +#endif { if (PLUG_IN_INFO.query_proc) (* PLUG_IN_INFO.query_proc) (); @@ -139,8 +161,13 @@ shmdt ((char*) _shm_addr); #endif +#ifdef WIN32 + gp_quit_write(0); + is_quitting=1; +#else gp_quit_write (_writefd); exit (0); +#endif } void @@ -432,8 +459,11 @@ proc_install.nreturn_vals = nreturn_vals; proc_install.params = (GPParamDef*) params; proc_install.return_vals = (GPParamDef*) return_vals; - +#ifdef WIN32 + if(!gp_proc_install_write(0,&proc_install)) +#else if (!gp_proc_install_write (_writefd, &proc_install)) +#endif gimp_quit (); } @@ -467,8 +497,11 @@ GPProcUninstall proc_uninstall; proc_uninstall.name = name; - +#ifdef WIN32 + if(!gp_proc_uninstall_write(0,&proc_uninstall)) +#else if (!gp_proc_uninstall_write (_writefd, &proc_uninstall)) +#endif gimp_quit (); g_hash_table_remove (temp_proc_ht, (gpointer) name); } @@ -542,6 +575,11 @@ va_list args; guchar *color; int i; +#ifdef WIN32 + int _writefd; + int _readfd; +#endif + printf("gimp_run_procedure: %s\n",name); proc_run.name = name; proc_run.nparams = 0; @@ -692,11 +730,11 @@ if (!gp_proc_run_write (_writefd, &proc_run)) gimp_quit (); - if (!wire_read_msg (_readfd, &msg)) + if (!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); if (msg.type != GP_PROC_RETURN) - g_error ("unexpected message: %d\n", msg.type); + g_error ("unexpected message[1]: %d %s\n", msg.type,gp_name[msg.type]); proc_return = msg.data; *nreturn_vals = proc_return->nparams; @@ -731,18 +769,21 @@ GPProcReturn *proc_return; WireMessage msg; GParam *return_vals; - +#ifdef WIN32 + int _writefd; + int _readfd; +#endif proc_run.name = name; proc_run.nparams = nparams; proc_run.params = (GPParam *) params; if (!gp_proc_run_write (_writefd, &proc_run)) gimp_quit (); - if (!wire_read_msg (_readfd, &msg)) + if(!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); if (msg.type != GP_PROC_RETURN) - g_error ("unexpected message: %d\n", msg.type); + g_error ("unexpected message[2]: %d %s\n", msg.type,gp_name[msg.type]); proc_return = msg.data; *nreturn_vals = proc_return->nparams; @@ -822,7 +863,9 @@ int select_val; struct timeval tv; struct timeval *tvp; - +#ifdef WIN32 + int _readfd; +#endif if (timeout) { tv.tv_sec = timeout / 1000; @@ -833,13 +876,15 @@ tvp = NULL; FD_ZERO (&readfds); - FD_SET (_readfd, &readfds); +#ifdef WIN32 +#else + FD_SET (_readfd, &readfds); +#endif if ((select_val = select (FD_SETSIZE, &readfds, NULL, NULL, tvp)) > 0) { - if (!wire_read_msg (_readfd, &msg)) + if (!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); - switch (msg.type) { case GP_QUIT: @@ -883,8 +928,13 @@ gimp_extension_ack () { /* Send an extension initialization acknowledgement */ +#ifdef WIN32 + if (! gp_extension_ack_write(0)) + gimp_quit (); +#else if (! gp_extension_ack_write (_writefd)) gimp_quit (); +#endif } static RETSIGTYPE @@ -912,72 +962,21 @@ gimp_quit (); } -static int -gimp_write (int fd, guint8 *buf, gulong count) -{ - gulong bytes; - - while (count > 0) - { - if ((write_buffer_index + count) >= WRITE_BUFFER_SIZE) - { - bytes = WRITE_BUFFER_SIZE - write_buffer_index; - memcpy (&write_buffer[write_buffer_index], buf, bytes); - write_buffer_index += bytes; - if (!wire_flush (fd)) - return FALSE; - } - else - { - bytes = count; - memcpy (&write_buffer[write_buffer_index], buf, bytes); - write_buffer_index += bytes; - } - - buf += bytes; - count -= bytes; - } - - return TRUE; -} - -static int -gimp_flush (int fd) -{ - int count; - int bytes; - - if (write_buffer_index > 0) - { - count = 0; - while (count != write_buffer_index) - { - do { - bytes = write (fd, &write_buffer[count], (write_buffer_index - count)); - } while ((bytes == -1) && (errno == EAGAIN)); - - if (bytes == -1) - return FALSE; - - count += bytes; - } - - write_buffer_index = 0; - } - - return TRUE; -} - static void gimp_loop () -{ +{ /* listening to a plug-in */ WireMessage msg; - while (1) + while(!is_quitting) { +#ifdef WIN32 +/* main loop, don't use wire_read_msg_wait! */ + if (!wire_read_msg(0,&msg)) + gimp_quit (); +#else if (!wire_read_msg (_readfd, &msg)) gimp_quit (); - +#endif switch (msg.type) { case GP_QUIT: @@ -1034,7 +1033,11 @@ _gimp_tile_width = config->tile_width; _gimp_tile_height = config->tile_height; +#ifdef WIN32 + +#else _shm_ID = config->shm_ID; +#endif _gamma_val = config->gamma; _install_cmap = config->install_cmap; _use_xshm = config->use_xshm; @@ -1072,9 +1075,13 @@ proc_return.name = proc_run->name; proc_return.nparams = nreturn_vals; proc_return.params = (GPParam*) return_vals; - +#ifdef WIN32 + if(!gp_proc_return_write(0,&proc_return)) + gimp_quit (); +#else if (!gp_proc_return_write (_writefd, &proc_return)) gimp_quit (); +#endif } } @@ -1099,8 +1106,12 @@ proc_return.name = proc_run->name; proc_return.nparams = nreturn_vals; proc_return.params = (GPParam*) return_vals; - +#ifdef WIN32 + if(!gp_temp_proc_return_write(0,&proc_return)) + gimp_quit (); +#else if (!gp_temp_proc_return_write (_writefd, &proc_return)) gimp_quit (); +#endif } } diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimp.h filmgimp-0.7-new/libgimp/gimp.h --- filmgimp-0.7/libgimp/gimp.h 2002-09-28 14:30:57.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimp.h 2003-01-12 01:22:41.000000000 -0800 @@ -21,9 +21,9 @@ #include -#include -#include -#include +#include "../plug-ins/gimpfeatures.h" +#include "../plug-ins/gimpenums.h" +#include "gimpfloat16.h" #ifdef __cplusplus diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimpenums.h filmgimp-0.7-new/libgimp/gimpenums.h --- filmgimp-0.7/libgimp/gimpenums.h 2002-09-28 14:30:57.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimpenums.h 2003-01-01 13:20:43.000000000 -0800 @@ -19,6 +19,7 @@ #ifndef __GIMP_ENUMS_H__ #define __GIMP_ENUMS_H__ +#include "../plug-ins/precision.h" typedef enum { @@ -60,14 +61,6 @@ typedef enum { - PRECISION_U8 = 1, - PRECISION_U16 = 2, - PRECISION_FLOAT = 3, - PRECISION_FLOAT16 = 4 -} GPrecisionType; - -typedef enum -{ NORMAL_MODE = 0, DISSOLVE_MODE = 1, MULTIPLY_MODE = 3, Only in filmgimp-0.7/libgimp: gimpfeatures.h.in diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimpprotocol.c filmgimp-0.7-new/libgimp/gimpprotocol.c --- filmgimp-0.7/libgimp/gimpprotocol.c 2002-09-28 14:30:56.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimpprotocol.c 2003-02-26 17:09:00.000000000 -0800 @@ -265,8 +265,11 @@ msg.type = GP_PROC_INSTALL; msg.data = proc_install; - +#ifdef WIN32 + if(!wire_write_msg_wait(fd,&msg)) +#else if (!wire_write_msg (fd, &msg)) +#endif return FALSE; if (!wire_flush (fd)) return FALSE; diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimptile.c filmgimp-0.7-new/libgimp/gimptile.c --- filmgimp-0.7/libgimp/gimptile.c 2002-09-28 14:30:57.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimptile.c 2003-02-08 21:34:03.000000000 -0800 @@ -18,9 +18,15 @@ */ #include #include "gimp.h" -#include "gimpprotocol.h" -#include "gimpwire.h" - +#include "../plug-ins/gimpprotocol.h" +#include "../plug-ins/gimpwire.h" +#include "../plug-ins/event.h" +#include "../plug-ins/plug_in.h" + +#ifdef WIN32 +#include +#define g_message printf +#endif /* This is the percentage of the maximum cache size that should be cleared * from the cache when an eviction is necessary @@ -136,27 +142,30 @@ static void gimp_tile_get (GTile *tile) -{ +{ GPTileReq tile_req; + GPTileData *tile_data; + WireMessage msg; +#ifdef WIN32 + int _writefd; + int _readfd; + _writefd=_readfd=0; +#else extern int _writefd; extern int _readfd; extern guchar* _shm_addr; - - GPTileReq tile_req; - GPTileData *tile_data; - WireMessage msg; - +#endif tile_req.drawable_ID = tile->drawable->id; tile_req.tile_num = tile->tile_num; tile_req.shadow = tile->shadow; if (!gp_tile_req_write (_writefd, &tile_req)) gimp_quit (); - if (!wire_read_msg (_readfd, &msg)) + if (!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); if (msg.type != GP_TILE_DATA) { - g_message ("unexpected message: %d\n", msg.type); + g_message ("unexpected message[3]: %d %s\n", msg.type,gp_name[msg.type]); gimp_quit (); } @@ -172,12 +181,16 @@ gimp_quit (); } +#ifdef WIN32 + +#else if (tile_data->use_shm) { tile->data = g_new (guchar, tile->ewidth * tile->eheight * tile->bpp); memcpy (tile->data, _shm_addr, tile->ewidth * tile->eheight * tile->bpp); } else +#endif { tile->data = tile_data->data; tile_data->data = NULL; @@ -191,28 +204,30 @@ static void gimp_tile_put (GTile *tile) -{ - extern int _writefd; - extern int _readfd; - extern guchar* _shm_addr; - - GPTileReq tile_req; +{ GPTileReq tile_req; GPTileData tile_data; GPTileData *tile_info; WireMessage msg; - +#ifdef WIN32 + int _writefd; + int _readfd; + _writefd=_readfd=0; +#else + extern int _writefd; + extern int _readfd; + extern guchar* _shm_addr; +#endif tile_req.drawable_ID = -1; tile_req.tile_num = 0; tile_req.shadow = 0; if (!gp_tile_req_write (_writefd, &tile_req)) gimp_quit (); - - if (!wire_read_msg (_readfd, &msg)) + if (!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); if (msg.type != GP_TILE_DATA) { - g_message ("unexpected message: %d\n", msg.type); + g_message ("unexpected message[4]: %d %s\n",msg.type,gp_name[msg.type]); gimp_quit (); } @@ -227,20 +242,23 @@ tile_data.use_shm = tile_info->use_shm; tile_data.data = NULL; +#ifdef WIN32 + +#else if (tile_info->use_shm) memcpy (_shm_addr, tile->data, tile->ewidth * tile->eheight * tile->bpp); else +#endif tile_data.data = tile->data; if (!gp_tile_data_write (_writefd, &tile_data)) gimp_quit (); - - if (!wire_read_msg (_readfd, &msg)) + if (!wire_read_msg_wait(_readfd, &msg)) gimp_quit (); if (msg.type != GP_TILE_ACK) { - g_message ("unexpected message: %d\n", msg.type); + g_message ("unexpected message[5]: %d %s\n",msg.type,gp_name[msg.type]); gimp_quit (); } diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimpwire.c filmgimp-0.7-new/libgimp/gimpwire.c --- filmgimp-0.7/libgimp/gimpwire.c 2002-09-28 14:30:56.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimpwire.c 2003-02-28 10:01:44.000000000 -0800 @@ -20,12 +20,42 @@ #include #include #include +#ifdef WIN32 + +#else #include #include #include +#endif + #include #include "gimpwire.h" - +#include "gimpprotocol.h" +#include "event.h" +#include "plug_in.h" + +#ifdef WIN32 +#define g_error printf +#endif + +/* #define DEBUG_WRITE_STRING */ +/* #define DEBUG_WIRE_BYTES */ +#define DEBUG_WIRE + +const char* gp_name[] = { + "GP_QUIT", + "GP_CONFIG", + "GP_TILE_REQ", + "GP_TILE_ACK", + "GP_TILE_DATA", + "GP_PROC_RUN", + "GP_PROC_RETURN", + "GP_TEMP_PROC_RUN", + "GP_TEMP_PROC_RETURN", + "GP_PROC_INSTALL", + "GP_PROC_UNINSTALL", + "GP_EXTENSION_ACK" +}; typedef struct _WireHandler WireHandler; @@ -50,7 +80,6 @@ static WireFlushFunc wire_flush_func = NULL; static int wire_error_val = FALSE; - void wire_register (guint32 type, WireReadFunc read_func, @@ -74,24 +103,167 @@ g_hash_table_insert (wire_ht, &handler->type, handler); } -void -wire_set_reader (WireIOFunc read_func) +void wire_set_reader(WireIOFunc read_func) +{ wire_read_func = read_func; +} + +void wire_set_writer(WireIOFunc write_func) +{ wire_write_func = write_func; +} + +void wire_set_flusher(WireFlushFunc flush_func) +{ wire_flush_func = flush_func; +} + +int wire_buffer_read(int fd, guint8 *buf, gulong count) +{/* +#ifdef _DEBUG + Plugin* plugin; + plugin=(PlugIn*)fd; +#endif*/ + gulong buffer_bytes; + guint8* buffer; + buffer_bytes=wire_buffer->buffer_count; +#ifdef DEBUG_WIRE_BYTES + printf("DEBUG_WIRE_BYTES wire_buffer_read: %i - %i\n",buffer_bytes,count); +#endif + if(buffer_bytesbuffer + wire_buffer->buffer_read_index; + memcpy(buf,buffer,count); + wire_buffer->buffer_count -= count; + wire_buffer->buffer_read_index += count; + if(!wire_buffer->buffer_count) + { wire_buffer->buffer_read_index = 0; + wire_buffer->buffer_write_index = 0; + } + return TRUE; +} + +int wire_buffer_write(int fd,guint8 *buf,gulong count) +{ gulong buffer_bytes; + guint8* buffer; + if(!wire_buffer) + { printf("wire_buffer_write: error no wire_buffer\n"); + return FALSE; + } + buffer_bytes=wire_buffer->buffer_count; +#ifdef DEBUG_WIRE_BYTES + printf("DEBUG_WIRE_BYTES wire_buffer_write: %i + %i (%i max)\n",buffer_bytes,count,WRITE_BUFFER_SIZE); +#endif + if((buffer_bytes + count) >= WRITE_BUFFER_SIZE) + { printf("wire_buffer_write: error WRITE_BUFFER_SIZE\n"); + return FALSE; + } + buffer = wire_buffer->buffer + wire_buffer->buffer_write_index; + memcpy(buffer,buf,count); + wire_buffer->buffer_write_index += count; + wire_buffer->buffer_count += count; + return TRUE; +} + +int wire_buffer_flush(int fd) +{ return TRUE; +} +/* +static int +plug_in_flush (int fd) +{ + int count; + int bytes; + if(!wire_buffer) + { return FALSE; + } + if (wire_buffer->current_buffer_index > 0) + { + count = 0; + while (count != wire_buffer->current_buffer_index) + { + do { + bytes = write (fd, &wire_buffer->current_buffer[count], + (wire_buffer->current_buffer_index - count)); + } while ((bytes == -1) && (errno == EAGAIN)); + + if (bytes == -1) + return FALSE; + + count += bytes; + } + + wire_buffer->current_buffer_index = 0; + } + + return TRUE; +} +*/ + +#ifndef WIN32 + +static int +gimp_read(int fd, guint8 *buf, gulong count) { - wire_read_func = read_func; + + return FALSE; } -void -wire_set_writer (WireIOFunc write_func) +static int +gimp_write (int fd, guint8 *buf, gulong count) { - wire_write_func = write_func; + gulong bytes; + + while (count > 0) + { + if ((wire_buffer->buffer_write_index + count) >= WRITE_BUFFER_SIZE) + { + bytes = WRITE_BUFFER_SIZE - wire_buffer->buffer_index; + memcpy (&wire_buffer->buffer[wire_buffer->buffer_index], buf, bytes); + wire_buffer->buffer_index += bytes; + if (!wire_flush (fd)) + return FALSE; + } + else + { + bytes = count; + memcpy (&wire_buffer->buffer[wire_buffer->buffer_index], buf, bytes); + wire_buffer->buffer_index += bytes; + } + + buf += bytes; + count -= bytes; + } + + return TRUE; } -void -wire_set_flusher (WireFlushFunc flush_func) +static int +gimp_flush (int fd) { - wire_flush_func = flush_func; + int count; + int bytes; + + if (wire_buffer->buffer_index > 0) + { + count = 0; + while (count != wire_buffer->buffer_index) + { + do { + bytes = write (fd, &wire_buffer->buffer[count], (wire_buffer->buffer_index - count)); + } while ((bytes == -1) && (errno == EAGAIN)); + + if (bytes == -1) + return FALSE; + + count += bytes; + } + + wire_buffer->buffer_index = 0; + } + return TRUE; } +#endif + int wire_read (int fd, guint8 *buf, @@ -144,10 +316,10 @@ gulong count) { if (wire_write_func) - { + {/* calls gimp_write */ if (!(* wire_write_func) (fd, buf, count)) { - g_print ("wire_write: error\n"); + g_print ("wire_write: write error 1\n"); wire_error_val = TRUE; return FALSE; } @@ -164,7 +336,7 @@ if (bytes == -1) { - g_print ("wire_write: error\n"); + g_print ("wire_write: write error 2\n"); wire_error_val = TRUE; return FALSE; } @@ -179,7 +351,7 @@ int wire_flush (int fd) -{ +{/* calls gimp_flush */ if (wire_flush_func) return (* wire_flush_func) (fd); return FALSE; @@ -213,17 +385,52 @@ if (!handler) g_error ("could not find handler for message: %d\n", msg->type); +#ifdef DEBUG_WIRE + printf("wire_read_msg: type %i %s\n",msg->type,gp_name[msg->type]); +#endif + (* handler->read_func) (fd, msg); return !wire_error_val; } +int wire_read_msg_wait(int fd,WireMessage *msg) +{ +#ifdef WIN32 + if(!wire_buffer || !wire_buffer->plugin) + { g_error("Thread wire_buffer->plugin error!"); + } + else + { printf("\n"); + EventSignal(wire_buffer->event_plugin); + EventWaitFor(wire_buffer->event_wire); + } +#endif + return wire_read_msg(fd,msg); +} + int wire_write_msg (int fd, WireMessage *msg) { WireHandler *handler; - +#ifdef DEBUG_WIRE + printf("wire_write_msg: type %i %s",msg->type,gp_name[msg->type]); + switch(msg->type) + {case GP_PROC_INSTALL: + { GPProcInstall *proc=(GPProcInstall*) msg->data; + printf(" %s \n",proc->name); + break; + } + case GP_PROC_RUN: + { GPProcRun *proc=(GPProcRun*) msg->data; + printf(" %s \n",proc->name); + break; + } + default: + puts(""); + } +#endif if (wire_error_val) return !wire_error_val; @@ -239,16 +446,32 @@ return !wire_error_val; } +int wire_write_msg_wait(int fd,WireMessage *msg) +{ int ok = wire_write_msg(fd,msg); +#ifdef WIN32 + if(!wire_buffer /*|| !wire_buffer->plugin*/) + { g_error("Thread wire_buffer->plugin error!"); + } + else + { printf("\n"); + EventSignal(wire_buffer->event_plugin); + EventWaitFor(wire_buffer->event_wire); + } +#endif + return ok; +} + void wire_destroy (WireMessage *msg) { - WireHandler *handler; + WireHandler *handler; - handler = g_hash_table_lookup (wire_ht, &msg->type); - if (!handler) - g_error ("could not find handler for message: %d\n", msg->type); - - (* handler->destroy_func) (msg); + handler = g_hash_table_lookup (wire_ht, &msg->type); + if (!handler) + { g_error ("could not find handler for message: %d\n", msg->type); + return; + } + (* handler->destroy_func) (msg); } int @@ -432,7 +655,11 @@ tmp = strlen (data[i]) + 1; else tmp = 0; - +#ifdef DEBUG_WRITE_STRING + if(tmp) + { printf("DEBUG_WRITE_STRING: %s\n",data[i]); + } +#endif if (!wire_write_int32 (fd, &tmp, 1)) return FALSE; if (tmp > 0) diff -aur --strip-trailing-cr filmgimp-0.7/libgimp/gimpwire.h filmgimp-0.7-new/libgimp/gimpwire.h --- filmgimp-0.7/libgimp/gimpwire.h 2002-09-28 14:30:56.000000000 -0700 +++ filmgimp-0.7-new/libgimp/gimpwire.h 2003-02-27 23:29:02.000000000 -0800 @@ -21,7 +21,10 @@ #include - +#ifdef WIN32 +#include +#include "../plug-ins/event.h" +#endif typedef struct _WireMessage WireMessage; @@ -31,13 +34,64 @@ typedef int (* WireIOFunc) (int fd, guint8 *buf, gulong count); typedef int (* WireFlushFunc) (int fd); +typedef struct _PlugIn PlugIn; +typedef struct _Argument Argument; +typedef struct _ProcRecord ProcRecord; + +typedef int (*PluginMain)(void* data); + +#define WRITE_BUFFER_SIZE 2*1024 +#define WIRE_BUFFER_SIZE WRITE_BUFFER_SIZE + +extern const char* gp_name[]; struct _WireMessage -{ - guint32 type; - gpointer data; +{ guint32 type; + gpointer data; +/* Robin's idea for an alternative: + PlugIn* plug_in; + int fd; + gint count;*/ }; +typedef struct _WireBuffer +{ guint8 buffer[WIRE_BUFFER_SIZE]; + guint buffer_write_index; + guint buffer_read_index; + guint buffer_count; + PlugIn* plugin; + HANDLE thread_wire; + HANDLE thread_plugin; + Event event_wire; + Event event_plugin; +/* old stuff: */ + GSList *plug_in_defs; + GSList *gimprc_proc_defs; + GSList *proc_defs; + GSList *open_plug_ins; + GSList *blocked_plug_ins; + + GSList *plug_in_stack; + PlugIn *current_plug_in; + int current_readfd; + int current_writefd; + int current_buffer_index; + char *current_buffer; + Argument *current_return_vals; + int current_return_nvals; + + ProcRecord *last_plug_in; + + int shm_ID; + guchar *shm_addr; + + int write_pluginrc; +} WireBuffer; + +void WireBufferOpen(WireBuffer* wb); +void WireBufferClose(WireBuffer* wb); + +extern WireBuffer* wire_buffer; void wire_register (guint32 type, WireReadFunc read_func, @@ -57,6 +111,13 @@ void wire_clear_error (void); int wire_read_msg (int fd, WireMessage *msg); + +int wire_read_msg_wait(int fd,WireMessage *msg); +int wire_write_msg_wait(int fd,WireMessage *msg); + +void wire_get_buffer(Plug_inplugin); + + int wire_write_msg (int fd, WireMessage *msg); void wire_destroy (WireMessage *msg); @@ -91,5 +152,24 @@ gchar **data, gint count); +#ifdef WIN32 +int wire_buffer_read(int fd, guint8 *buf, gulong count); +int wire_buffer_write(int fd,guint8 *buf,gulong count); +int wire_buffer_flush(int fd); +/* +These are the same are wire_read and wire_write: +static int plug_in_write (int fd, + guint8 *buf, + gulong count); +static int plug_in_read(int fd,guint8 *buf,gulong count); +static int plug_in_flush (int fd); +*/ + + +#else +int gimp_read (int fd, guint8 *buf, gulong count); +int gimp_write (int fd, guint8 *buf, gulong count); +int gimp_flush (int fd); +#endif #endif /* __GIMP_WIRE_H__ */ diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/bz2/bz2.c filmgimp-0.7-new/plug-ins/bz2/bz2.c --- filmgimp-0.7/plug-ins/bz2/bz2.c 2002-09-28 14:30:57.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/bz2/bz2.c 2002-12-26 22:36:45.000000000 -0800 @@ -33,10 +33,16 @@ #include #include + +#ifdef WIN32 + +#else #include #include #include #include +#endif + #include #include #include "gtk/gtk.h" diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/cineon/cineon.c filmgimp-0.7-new/plug-ins/cineon/cineon.c --- filmgimp-0.7/plug-ins/cineon/cineon.c 2002-09-28 14:30:57.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/cineon/cineon.c 2003-02-08 13:41:37.000000000 -0800 @@ -52,6 +52,9 @@ #include #include +#ifdef WIN32 +#define g_message printf +#endif #define PLUG_IN_VERSION "0.5.4 - Jan 16 2002" diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/cineon/cineonlib.c filmgimp-0.7-new/plug-ins/cineon/cineonlib.c --- filmgimp-0.7/plug-ins/cineon/cineonlib.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/cineon/cineonlib.c 2002-12-26 22:06:25.000000000 -0800 @@ -26,7 +26,11 @@ #include #include #include /* strftime() */ +#ifdef WIN32 +#include +#else #include /* htonl() */ +#endif #include /* memset */ static void diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/cineon/dpxlib.c filmgimp-0.7-new/plug-ins/cineon/dpxlib.c --- filmgimp-0.7/plug-ins/cineon/dpxlib.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/cineon/dpxlib.c 2002-12-26 22:06:25.000000000 -0800 @@ -26,7 +26,11 @@ #include #include #include /* strftime() */ +#ifdef WIN32 +#include +#else #include /* htonl() */ +#endif #include /* memset */ static void diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/cineon/logImageCore.c filmgimp-0.7-new/plug-ins/cineon/logImageCore.c --- filmgimp-0.7/plug-ins/cineon/logImageCore.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/cineon/logImageCore.c 2002-12-28 15:49:05.000000000 -0800 @@ -23,6 +23,14 @@ #include /* strftime() */ #include +/* Makes rint consistent in Windows and Linux: */ +#define rint(x) floor(x+0.5) + +#ifdef WIN32 +#include +#else + +#endif /* obscure LogImage conversion */ /* from 10 bit int to 0.0 - 1.0 */ diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/cineon/logImageLib.c filmgimp-0.7-new/plug-ins/cineon/logImageLib.c --- filmgimp-0.7/plug-ins/cineon/logImageLib.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/cineon/logImageLib.c 2002-12-26 22:06:25.000000000 -0800 @@ -26,7 +26,11 @@ #include #include #include /* strftime() */ +#ifdef WIN32 +#include +#else #include /* htonl() */ +#endif #include /* memset */ #define MIN_GAMMA 0.01 diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/dbbrowser/dbbrowser.c filmgimp-0.7-new/plug-ins/dbbrowser/dbbrowser.c --- filmgimp-0.7/plug-ins/dbbrowser/dbbrowser.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/dbbrowser/dbbrowser.c 2002-12-27 14:04:39.000000000 -0800 @@ -43,8 +43,6 @@ #include #include -#include - #include "dbbrowser.h" static void query (void); diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/dbbrowser/dbbrowser_utils.c filmgimp-0.7-new/plug-ins/dbbrowser/dbbrowser_utils.c --- filmgimp-0.7/plug-ins/dbbrowser/dbbrowser_utils.c 2002-09-28 14:30:58.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/dbbrowser/dbbrowser_utils.c 2002-12-26 22:45:06.000000000 -0800 @@ -23,6 +23,7 @@ */ #include +#include #include "dbbrowser_utils.h" Only in filmgimp-0.7-new/plug-ins: dll.c Only in filmgimp-0.7-new/plug-ins: event.c Only in filmgimp-0.7-new/plug-ins: event.h diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/gbr/gbr.c filmgimp-0.7-new/plug-ins/gbr/gbr.c --- filmgimp-0.7/plug-ins/gbr/gbr.c 2002-09-28 14:31:00.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/gbr/gbr.c 2002-12-27 14:43:24.000000000 -0800 @@ -17,8 +17,12 @@ #include "gtk/gtk.h" #include "libgimp/gimp.h" #include "app/brush_header.h" -#include +#ifdef WIN32 +#include +#else +#include +#endif /* Declare local data types */ diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/gz/gz.c filmgimp-0.7-new/plug-ins/gz/gz.c --- filmgimp-0.7/plug-ins/gz/gz.c 2002-09-28 14:31:00.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/gz/gz.c 2002-12-27 14:44:15.000000000 -0800 @@ -59,8 +59,13 @@ #include #include + +#ifdef WIN32 +#else #include #include +#endif + #include #include #include diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/hdr/fromrad.c filmgimp-0.7-new/plug-ins/hdr/fromrad.c --- filmgimp-0.7/plug-ins/hdr/fromrad.c 2002-09-28 14:31:00.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/hdr/fromrad.c 2002-12-27 15:05:53.000000000 -0800 @@ -10,7 +10,13 @@ #include #include #include + +#ifdef WIN32 + +#else #include +#endif + #include #include #include diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/hdr/hdr.c filmgimp-0.7-new/plug-ins/hdr/hdr.c --- filmgimp-0.7/plug-ins/hdr/hdr.c 2002-09-28 14:31:00.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/hdr/hdr.c 2002-12-27 15:05:53.000000000 -0800 @@ -25,7 +25,13 @@ #include #include + +#ifdef WIN32 + +#else #include +#endif + #include #include #include diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/iff/iff.c filmgimp-0.7-new/plug-ins/iff/iff.c --- filmgimp-0.7/plug-ins/iff/iff.c 2002-10-31 22:24:03.000000000 -0800 +++ filmgimp-0.7-new/plug-ins/iff/iff.c 2002-12-27 15:16:38.000000000 -0800 @@ -67,7 +67,7 @@ #include #include #include - +#include #include /* #define IFF_DEBUG */ Only in filmgimp-0.7-new/plug-ins: plug_in_loader.c Only in filmgimp-0.7-new/plug-ins: plug_in_loader.h diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/png/png.c filmgimp-0.7-new/plug-ins/png/png.c --- filmgimp-0.7/plug-ins/png/png.c 2002-11-02 13:56:13.000000000 -0800 +++ filmgimp-0.7-new/plug-ins/png/png.c 2003-02-08 13:41:37.000000000 -0800 @@ -46,6 +46,8 @@ #include #include #include +/* Makes rint consistent in Windows and Linux: */ +#define rint(x) floor(x+0.5) #include @@ -54,6 +56,9 @@ #include /* PNG library definitions */ +#ifdef WIN32 +#define g_message printf +#endif /* * Constants... @@ -1494,8 +1499,6 @@ gtk_widget_show (widget); } -#define RINT(x) rint(x) - /** * gimp_int_adjustment_update: * @adjustment: A #GtkAdjustment. @@ -1512,7 +1515,7 @@ gint *val; val = (gint *) data; - *val = RINT (adjustment->value); + *val = rint(adjustment->value); } Only in filmgimp-0.7-new/plug-ins: precision.h diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/script-fu/interp_regex.c filmgimp-0.7-new/plug-ins/script-fu/interp_regex.c --- filmgimp-0.7/plug-ins/script-fu/interp_regex.c 2002-09-28 14:31:03.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/script-fu/interp_regex.c 2002-12-28 00:04:18.000000000 -0800 @@ -2,7 +2,13 @@ #include #include #include + +#ifdef WIN32 + +#else #include "regex.h" +#endif + #include "siod.h" /* OSF/1 doc says that POSIX and XPG4 include regcomp in libc. diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/script-fu/interp_slib.c filmgimp-0.7-new/plug-ins/script-fu/interp_slib.c --- filmgimp-0.7/plug-ins/script-fu/interp_slib.c 2002-09-28 14:31:03.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/script-fu/interp_slib.c 2002-12-28 00:04:18.000000000 -0800 @@ -78,7 +78,13 @@ #include #include #include + +#ifdef WIN32 + +#else #include +#endif + #include #include "siod.h" diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/script-fu/script-fu-scripts.c filmgimp-0.7-new/plug-ins/script-fu/script-fu-scripts.c --- filmgimp-0.7/plug-ins/script-fu/script-fu-scripts.c 2002-09-28 14:31:06.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/script-fu/script-fu-scripts.c 2003-02-08 13:41:37.000000000 -0800 @@ -27,6 +27,10 @@ #include "siod.h" #include "script-fu-scripts.h" +#ifdef WIN32 +#define g_message printf +#endif + #define TEXT_WIDTH 100 #define TEXT_HEIGHT 25 #define COLOR_SAMPLE_WIDTH 100 diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/sgi/sgi.c filmgimp-0.7-new/plug-ins/sgi/sgi.c --- filmgimp-0.7/plug-ins/sgi/sgi.c 2002-09-28 14:31:01.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/sgi/sgi.c 2002-12-27 15:25:26.000000000 -0800 @@ -100,6 +100,11 @@ #include #include +#ifdef WIN32 +#include "unistd.h" +#else + +#endif /* * Constants... diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/snoise/snoise.c filmgimp-0.7-new/plug-ins/snoise/snoise.c --- filmgimp-0.7/plug-ins/snoise/snoise.c 2002-09-28 14:31:02.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/snoise/snoise.c 2002-12-27 15:27:27.000000000 -0800 @@ -63,7 +63,7 @@ #include #include #include - +#include #include "gtk/gtk.h" #include "libgimp/gimp.h" diff -aur --strip-trailing-cr filmgimp-0.7/plug-ins/tga/tga.c filmgimp-0.7-new/plug-ins/tga/tga.c --- filmgimp-0.7/plug-ins/tga/tga.c 2002-09-28 14:31:02.000000000 -0700 +++ filmgimp-0.7-new/plug-ins/tga/tga.c 2002-12-27 15:28:32.000000000 -0800 @@ -78,8 +78,12 @@ #include #include "libgimp/gimp.h" +#ifdef WIN32 + +#else #define FALSE 0 #define TRUE 1 +#endif /* Round up a division to the nearest integer. */ #define ROUNDUP_DIVIDE(n,d) (((n) + (d - 1)) / (d)) Only in filmgimp-0.7-new: win32