New file.

* plug-ins/makefile.msc: New file.

	* plug-ins/*/*.c (Well, not really all files, but many):
 	Portability fixes. Include config.h, and guard inclusion of POSIX
 	and Unix headers like <unistd.h>, <dirent.h> and
 	<sys/time.h>. Include <string.h> if functions from it are
 	used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(),
 	thus no need to include <netinet/in.h>. Include <io.h> on Win32
 	when using open/read/write (which actually are defined as
 	_open/_read/_write by glib.h). Define S_* macros if necessary on
 	Win32. Define rint() and M_PI if necessary (these definitions
 	should be factored out somewhere, no sense repeating them in lots
 	of files). Open files in binary mode when needed.

	* plug-ins/FractalExplorer/FractalExplorer.c: Use
 	g_malloc()/g_free(). Use g_strdup_printf().

  	* plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>.

	* plug-ins/destripe/destripe.c: Guard use of SIGBUS.

	* plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for
 	NULL returns from g_malloc() and g_new() as they abort on failure.
	Use g_strdup_printf().

	* plug-ins/gz/gz.c: Win32 version of running the subprocess.

	* plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for
 	non-Unix (OS/2 and Win32), for instance HAVE_MMAP.

	* plug-ins/script-fu/interp_slib.c: Win32 version of myruntime().

	* plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh).

	* plug-ins/script-fu/script-fu-console.c: Bypass on Win32.

	* plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use
 	g_strdup_printf() instead of separate malloc() and sprintf(). Use
 	g_strescape() for strings being passed to Scheme. Some Win32-only
 	stuff.
This commit is contained in:
Tor Lillqvist 1999-05-29 01:28:24 +00:00
parent e2a29e4719
commit 0457d6914a
80 changed files with 1459 additions and 244 deletions

View File

@ -4,16 +4,19 @@
1999-05-28 Tor Lillqvist <tml@iki.fi>
Merge in Win32 changes to plug-ins. Small Win32-related changes
to app and libgimp.
* configure.in: Check for mmap.
* app/makefile.msc: Depend on gimpi.lib.
* app/app_procs.c (app_init): Fix gccism: Allocate filenames (an
array with non-constant size) dynamically.
array with non-constant size) dynamically.
* app/{datafiles,fileops,general,install,module_db,temp_buf}.c:
Include glib.h before standard headers, because of certain obscure
details related to compiling with gcc on Win32.
Include glib.h before standard headers, because of certain obscure
details related to compiling with gcc on Win32.
(If you really want to know: glib.h defines he names of POSIXish
(but non-ANSI) functions as prefixed with underscore, because
@ -40,8 +43,8 @@
* libgimp/{gimp,gimpui}.def: Add two entry points.
* libgimp/gimp.h: Can't use __declspec(dllexport) for PLUG_IN_INFO
when compiling with gcc on Win32. Also handle __argc, __argv and
_stdcall differently with gcc on Win32
when compiling with gcc on Win32. Also handle __argc, __argv and
_stdcall differently with gcc on Win32
* libgimp/gimpenv.c: Include <string.h>.
@ -55,6 +58,52 @@
* libgimp/makefile.msc: Miscellaneous updates. The gimpi library
is now built as a static library.
* modules/colorsel_triangle.c: No need to include gdkx.h. Define
M_PI if needed.
* modules/makefile.msc: Use GLib 1.3, update GTk+ paths.
* plug-ins/makefile.msc: New file.
* plug-ins/*/*.c (Well, not really all files, but many):
Portability fixes. Include config.h, and guard inclusion of POSIX
and Unix headers like <unistd.h>, <dirent.h> and
<sys/time.h>. Include <string.h> if functions from it are
used. Use g_ntohl() and g_htonl() insteead of ntohl() and htonl(),
thus no need to include <netinet/in.h>. Include <io.h> on Win32
when using open/read/write (which actually are defined as
_open/_read/_write by glib.h). Define S_* macros if necessary on
Win32. Define rint() and M_PI if necessary (these definitions
should be factored out somewhere, no sense repeating them in lots
of files). Open files in binary mode when needed.
* plug-ins/FractalExplorer/FractalExplorer.c: Use
g_malloc()/g_free(). Use g_strdup_printf().
* plug-ins/dbbrowser/dbbrowser.c: No need to include <X11/Xlib.h>.
* plug-ins/destripe/destripe.c: Guard use of SIGBUS.
* plug-ins/{flame/flame,hrz/hrz,pnm/pnm}.c: No need to check for
NULL returns from g_malloc() and g_new() as they abort on failure.
Use g_strdup_printf().
* plug-ins/gz/gz.c: Win32 version of running the subprocess.
* plug-ins/hrz/hrz.c: Win32 version. Use more generic tests for
non-Unix (OS/2 and Win32), for instance HAVE_MMAP.
* plug-ins/script-fu/interp_slib.c: Win32 version of myruntime().
* plug-ins/script-fu/interp_sliba.c: Handle \\ (escaped backslahsh).
* plug-ins/script-fu/script-fu-console.c: Bypass on Win32.
* plug-ins/script-fu/script-fu-scripts.c: Portability fixes. Use
g_strdup_printf() instead of separate malloc() and sprintf(). Use
g_strescape() for strings being passed to Scheme. Some Win32-only
stuff.
Thu May 27 22:04:49 1999 Jay Cox (jaycox@earthlink.net)
* app/channel.c: applied fix for the channel_bounds bug from

View File

@ -16,6 +16,9 @@ plug-ins, and finally in modules. Check the makefile.msc files in said
directories.
The current build setup for Windows is a mess, with complex
hand-maintained makefiles. I know.
hand-maintained makefiles. I know. Adding parallel makefiles for gcc
isn't going to make it any better. On the other hand, I don't think
using the Unix style configuration mechanism (under cygwin) is quite
feasible, either.
--Tor Lillqvist <tml@iki.fi>

View File

@ -23,10 +23,14 @@
* + Save (perhaps optionally?) the palette in a KCF
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -43,16 +43,36 @@
Include necessary files
*********************************************************************/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#ifdef NATIVE_WIN32
#include <io.h>
#ifndef W_OK
#define W_OK 2
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) ((m) & _S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
@ -298,6 +318,7 @@ run(char *name,
values[0].data.d_status = status;
gimp_drawable_detach(drawable);
}
/**********************************************************************
@ -336,8 +357,8 @@ explorer(GDrawable * drawable)
bytes = drawable->bpp;
/* allocate row buffers */
src_row = (guchar *) malloc((x2 - x1) * bytes);
dest_row = (guchar *) malloc((x2 - x1) * bytes);
src_row = (guchar *) g_malloc((x2 - x1) * bytes);
dest_row = (guchar *) g_malloc((x2 - x1) * bytes);
/* initialize the pixel regions */
gimp_pixel_rgn_init(&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
@ -369,8 +390,8 @@ explorer(GDrawable * drawable)
gimp_drawable_merge_shadow(drawable->id, TRUE);
gimp_drawable_update(drawable->id, x1, y1, (x2 - x1), (y2 - y1));
free(src_row);
free(dest_row);
g_free(src_row);
g_free(dest_row);
}
/**********************************************************************
@ -596,9 +617,7 @@ fractalexplorer_delete_fractalexplorer_callback(GtkWidget *widget,
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
str = g_malloc((strlen(sel_obj->draw_name) + 32 * sizeof(char)));
sprintf(str, msg[lng][MSG_DELSURE2], sel_obj->draw_name);
str = g_strdup_printf(msg[lng][MSG_DELSURE2], sel_obj->draw_name);
label = gtk_label_new(str);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
@ -1217,9 +1236,7 @@ fractalexplorer_rename_menu_callback(GtkWidget *widget, gpointer data)
static void
fractalexplorer_copy_menu_callback(GtkWidget *widget, gpointer data)
{
gchar *new_name = g_malloc(strlen(fractalexplorer_obj_for_menu->draw_name) + 6);
sprintf(new_name,msg[lng][MSG_COPYNAME],fractalexplorer_obj_for_menu->draw_name);
gchar *new_name = g_strup_printf(msg[lng][MSG_COPYNAME],fractalexplorer_obj_for_menu->draw_name);
new_fractalexplorer_obj(new_name);
g_free(new_name);
@ -1416,13 +1433,11 @@ plug_in_parse_fractalexplorer_path()
if (*token == '~')
{
path = g_malloc (strlen (home) + strlen (token) + 2);
sprintf (path, "%s%s", home, token + 1);
path = g_strdup_printf ("%s%s", home, token + 1);
}
else
{
path = g_malloc (strlen (token) + 2);
strcpy (path, token);
path = g_strdup (token);
} /* else */
/* Check if directory exists */
@ -1722,9 +1737,7 @@ fractalexplorer_list_load_all(GList *plist)
{
while ((dir_ent = readdir (dir)))
{
filename = g_malloc (strlen(path) + strlen (dir_ent->d_name) + 1);
sprintf (filename, "%s%s", path, dir_ent->d_name);
filename = g_strdup_printf ("%s%s", path, dir_ent->d_name);
/* Check the file and see that it is not a sub-directory */
err = stat (filename, &filestat);
@ -1791,9 +1804,7 @@ gradient_list_load_all(GList *plist)
{
while ((dir_ent = readdir (dir)))
{
filename = g_malloc (strlen(path) + strlen (dir_ent->d_name) + 1);
sprintf (filename, "%s%s", path, dir_ent->d_name);
filename = g_strdup_printf ("%s%s", path, dir_ent->d_name);
/* Check the file and see that it is not a sub-directory */
err = stat (filename, &filestat);

View File

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"

View File

@ -53,6 +53,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"
#include "gtk/gtk.h"

View File

@ -7,11 +7,15 @@
/* Alexander.Schulz@stud.uni-karlsruhe.de */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include "bmp.h"

View File

@ -84,13 +84,15 @@
* - Speed-ups
*/
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -23,10 +23,14 @@
* + Save (perhaps optionally?) the palette in a KCF
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"

View File

@ -53,6 +53,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"
#include "gtk/gtk.h"

View File

@ -84,13 +84,15 @@
* - Speed-ups
*/
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -56,20 +56,34 @@
* -Dan Risacher, 0430 CDT, 26 May 1997
*/
#include "config.h"
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <sys/stat.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#ifdef __EMX__
#include <fcntl.h>
#include <process.h>
#endif
#include "libgimp/gimp.h"
/* Author 1: Josh MacDonald (url.c) */
@ -275,13 +289,21 @@ save_image (char *filename,
gint32 drawable_ID,
gint32 run_mode)
{
FILE* f;
GParam* params;
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
FILE* f;
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -317,7 +339,10 @@ save_image (char *filename,
/* return -1; */
/* } */
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a gzip process */
if ((pid = fork()) < 0)
{
@ -356,6 +381,46 @@ save_image (char *filename,
return 0;
}
}
#else /* NATIVE_WIN32 */
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (filename, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cf %s", tmpname);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed\n");
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
unlink (tmpname);
@ -369,8 +434,16 @@ load_image (char *filename, gint32 run_mode)
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -385,7 +458,10 @@ load_image (char *filename, gint32 run_mode)
tmpname = params[1].data.d_string;
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a g(un)zip and wait for it */
if ((pid = fork()) < 0)
{
@ -424,6 +500,46 @@ load_image (char *filename, gint32 run_mode)
return -1;
}
}
#else
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (tmpname, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cfd %s", filename);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed: %d\n", GetLastError ());
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
/* now that we un-gziped it, load the temp file */

View File

@ -48,16 +48,19 @@
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimp/gimp.h"
#include "gtk/gtk.h"
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
typedef enum {
EXTEND,

View File

@ -565,7 +565,9 @@ destripe_dialog(void)
gtk_rc_parse(gimp_gtkrc());
gdk_set_use_xshm(gimp_use_xshm());
#ifdef SIGBUS
signal(SIGBUS, SIG_DFL);
#endif
signal(SIGSEGV, SIG_DFL);
gtk_preview_set_gamma(gimp_gamma());
gtk_preview_set_install_cmap(gimp_install_cmap());

View File

@ -21,11 +21,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include "gtk/gtk.h"

View File

@ -37,10 +37,14 @@
/* Version 1.12. */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -11,20 +11,32 @@
* etc.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "app/brush_header.h"
#include <netinet/in.h>
/* Declare local data types
@ -206,7 +218,8 @@ static gint32 load_image (char *filename) {
gimp_progress_init(temp);
g_free (temp);
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1) {
return -1;
}
@ -217,13 +230,13 @@ static gint32 load_image (char *filename) {
}
/* rearrange the bytes in each unsigned int */
ph.header_size = ntohl(ph.header_size);
ph.version = ntohl(ph.version);
ph.width = ntohl(ph.width);
ph.height = ntohl(ph.height);
ph.bytes = ntohl(ph.bytes);
ph.magic_number = ntohl(ph.magic_number);
ph.spacing = ntohl(ph.spacing);
ph.header_size = g_ntohl(ph.header_size);
ph.version = g_ntohl(ph.version);
ph.width = g_ntohl(ph.width);
ph.height = g_ntohl(ph.height);
ph.bytes = g_ntohl(ph.bytes);
ph.magic_number = g_ntohl(ph.magic_number);
ph.spacing = g_ntohl(ph.spacing);
/* How much extra to add ot the header seek - 1 needs a bit more */
version_extra = 0;
@ -305,19 +318,20 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
drawable->height, FALSE, FALSE);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0644);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
if (fd == -1) {
printf("Unable to open %s\n", filename);
return 0;
}
ph.header_size = htonl(sizeof(ph) + strlen(info.description) + 1);
ph.version = htonl(2);
ph.width = htonl(drawable->width);
ph.height = htonl(drawable->height);
ph.bytes = htonl(drawable->bpp);
ph.magic_number = htonl(GBRUSH_MAGIC);
ph.spacing = htonl(info.spacing);
ph.header_size = g_htonl(sizeof(ph) + strlen(info.description) + 1);
ph.version = g_htonl(2);
ph.width = g_htonl(drawable->width);
ph.height = g_htonl(drawable->height);
ph.bytes = g_htonl(drawable->bpp);
ph.magic_number = g_htonl(GBRUSH_MAGIC);
ph.spacing = g_htonl(info.spacing);
if (write(fd, &ph, sizeof(ph)) != sizeof(ph)) {
close(fd);

View File

@ -34,6 +34,9 @@
#include "config.h"
#ifndef HAVE_RINT
#define rint(x) floor ((x) + 0.5)
#endif
/* Test for GTK1.2-style gdkrgb code, else use old 'preview' code. */
#ifdef __GDK_RGB_H__

View File

@ -19,11 +19,15 @@
/* saves and loads gimp icon files (For toolbox, etc)...
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -31,7 +35,6 @@
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <netinet/in.h>
typedef struct

View File

@ -43,6 +43,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

View File

@ -56,20 +56,34 @@
* -Dan Risacher, 0430 CDT, 26 May 1997
*/
#include "config.h"
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <sys/stat.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#ifdef __EMX__
#include <fcntl.h>
#include <process.h>
#endif
#include "libgimp/gimp.h"
/* Author 1: Josh MacDonald (url.c) */
@ -275,13 +289,21 @@ save_image (char *filename,
gint32 drawable_ID,
gint32 run_mode)
{
FILE* f;
GParam* params;
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
FILE* f;
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -317,7 +339,10 @@ save_image (char *filename,
/* return -1; */
/* } */
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a gzip process */
if ((pid = fork()) < 0)
{
@ -356,6 +381,46 @@ save_image (char *filename,
return 0;
}
}
#else /* NATIVE_WIN32 */
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (filename, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cf %s", tmpname);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed\n");
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
unlink (tmpname);
@ -369,8 +434,16 @@ load_image (char *filename, gint32 run_mode)
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -385,7 +458,10 @@ load_image (char *filename, gint32 run_mode)
tmpname = params[1].data.d_string;
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a g(un)zip and wait for it */
if ((pid = fork()) < 0)
{
@ -424,6 +500,46 @@ load_image (char *filename, gint32 run_mode)
return -1;
}
}
#else
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (tmpname, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cfd %s", filename);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed: %d\n", GetLastError ());
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
/* now that we un-gziped it, load the temp file */

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "libgimp/gimp.h"

View File

@ -31,21 +31,34 @@
* That makes the size 256*240*3 = 184320 bytes.
*/
#include "config.h"
#include <glib.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#ifndef __EMX__
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
@ -280,7 +293,8 @@ load_image (char *filename)
g_free (temp);
/* open the file */
filedes = open(filename, O_RDONLY);
filedes = open(filename, O_RDONLY | _O_BINARY);
if (filedes == -1)
{
/* errno is set to indicate the error, but the user won't know :-( */
@ -294,7 +308,7 @@ load_image (char *filename)
fprintf(stderr, "hrz filter: file is not HRZ type\n");
return -1;
}
#ifndef __EMX__
#ifdef HAVE_MMAP
mapped = mmap(NULL, 256*240*3, PROT_READ, MAP_PRIVATE, filedes, 0);
if(mapped == (void *)(-1))
{
@ -303,11 +317,6 @@ load_image (char *filename)
}
#else
mapped = g_malloc(256*240*3);
if(mapped == NULL)
{
fprintf(stderr, "hrz filter: could not allocate memory\n");
return -1;
}
if (read(filedes, mapped, 256*240*3) != 256*240*3)
{
fprintf(stderr, "hrz filter: file read error\n");
@ -332,12 +341,10 @@ load_image (char *filename)
do_hrz_load(mapped, &pixel_rgn);
/* close the file */
#ifndef NeXT /* @#%@! NeXTStep */
#ifndef __EMX__
#ifdef HAVE_MMAP
munmap(mapped, 256*240*3);
#else
g_free(mapped);
#endif
#endif
/* Tell the GIMP to display the image.

View File

@ -39,6 +39,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include "gtk/gtk.h"

View File

@ -44,10 +44,14 @@
* Smash all bugs :-)
*/
#include "config.h"
#include <stdlib.h>
#include <math.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -43,13 +43,23 @@
* gtk_label_set() -> gtk_label_set_text()
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <gtk/gtk.h>
#include "libgimp/gimp.h"
#include <libgimp/gimp.h>
#ifndef HAVE_RINT
#define rint(x) floor((x)+0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifdef RCSID
static char rcsid[] = "$Id$";

View File

@ -4,21 +4,33 @@
* Some bits stolen from the .99.7 source tree.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "app/pattern_header.h"
#include <netinet/in.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "app/pattern_header.h"
/* Declare local data types
*/
@ -184,7 +196,8 @@ static gint32 load_image (char *filename) {
gimp_progress_init(temp);
g_free (temp);
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1) {
return -1;
}
@ -195,12 +208,12 @@ static gint32 load_image (char *filename) {
}
/* rearrange the bytes in each unsigned int */
ph.header_size = ntohl(ph.header_size);
ph.version = ntohl(ph.version);
ph.width = ntohl(ph.width);
ph.height = ntohl(ph.height);
ph.bytes = ntohl(ph.bytes);
ph.magic_number = ntohl(ph.magic_number);
ph.header_size = g_ntohl(ph.header_size);
ph.version = g_ntohl(ph.version);
ph.width = g_ntohl(ph.width);
ph.height = g_ntohl(ph.height);
ph.bytes = g_ntohl(ph.bytes);
ph.magic_number = g_ntohl(ph.magic_number);
if (ph.magic_number != GPATTERN_MAGIC || ph.version != 1 ||
ph.header_size <= sizeof(ph)) {
@ -265,17 +278,18 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
drawable->height, FALSE, FALSE);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0644);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
if (fd == -1) {
return 0;
}
ph.header_size = htonl(sizeof(ph) + strlen(description) + 1);
ph.version = htonl(1);
ph.width = htonl(drawable->width);
ph.height = htonl(drawable->height);
ph.bytes = htonl(drawable->bpp);
ph.magic_number = htonl(GPATTERN_MAGIC);
ph.header_size = g_htonl(sizeof(ph) + strlen(description) + 1);
ph.version = g_htonl(1);
ph.width = g_htonl(drawable->width);
ph.height = g_htonl(drawable->height);
ph.bytes = g_htonl(drawable->bpp);
ph.magic_number = g_htonl(GPATTERN_MAGIC);
if (write(fd, &ph, sizeof(ph)) != sizeof(ph)) {
close(fd);

View File

@ -43,6 +43,7 @@
static char ident[] = "@(#) GIMP Alias|Wavefront pix image file-plugin v1.0 24-jun-97";
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -25,19 +25,31 @@
* does not contain any code from the netpbm or pbmplus distributions.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
/* Declare local data types
*/
@ -340,13 +352,13 @@ load_image (char *filename)
PNMScanner *scan;
int ctr;
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Loading %s:", filename);
temp = g_strdup_printf ("Loading %s:", filename);
gimp_progress_init (temp);
g_free (temp);
/* open the file */
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1)
{
/*gimp_message("pnm filter: can't open file\n");*/
@ -355,11 +367,6 @@ load_image (char *filename)
/* allocate the necessary structures */
pnminfo = (PNMInfo *) g_malloc(sizeof(PNMInfo));
if (!pnminfo)
{
close (fd);
return -1;
}
scan = NULL;
/* set error handling */
@ -579,9 +586,7 @@ static pnm_load_rawpbm (PNMScanner *scan,
fd = pnmscanner_fd(scan);
rowlen = (int)ceil((double)(info->xres)/8.0);
data = g_malloc (gimp_tile_height () * info->xres);
CHECK_FOR_ERROR((NULL == (buf = g_malloc(rowlen*sizeof(unsigned char)))),
info->jmpbuf, "pnm filter: malloc failed\n");
buf = g_malloc(rowlen*sizeof(unsigned char));
for (y = 0; y < info->yres; )
{
@ -713,16 +718,16 @@ save_image (char *filename,
return FALSE;
}
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Saving %s:", filename);
temp = g_strdup_printf ("Saving %s:", filename);
gimp_progress_init (temp);
g_free (temp);
/* open the file */
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | _O_BINARY, 0644);
if (fd == -1)
{
g_message ("pnm: can't open \"%s\"\n", filename);
g_message ("pnm: can't open \"%s\"", filename);
return FALSE;
}
@ -946,7 +951,6 @@ pnmscanner_create (int fd)
PNMScanner *s;
s = (PNMScanner *)g_malloc(sizeof(PNMScanner));
if (!s) return(NULL);
s->fd = fd;
s->inbuf = 0;
s->eof = !read(s->fd, &(s->cur), 1);

View File

@ -55,14 +55,18 @@
* - Daniel Dunbar
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846

View File

@ -43,7 +43,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include "dbbrowser.h"

View File

@ -130,14 +130,22 @@
#define IFDBG if (PSD_DEBUG)
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <math.h>
#include <glib.h>
#include "libgimp/gimp.h"
#include <glib.h>
#include <libgimp/gimp.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
/* Local types etc
*/

View File

@ -69,6 +69,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"
#include "gtk/gtk.h"

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "libgimp/gimp.h"
/* Declare local functions. */

View File

@ -46,11 +46,15 @@
* plug-ins. */
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -48,16 +48,19 @@
*
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimp/gimp.h"
#include "gtk/gtk.h"
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
typedef enum {
EXTEND,

View File

@ -43,7 +43,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include "dbbrowser.h"

View File

@ -31,6 +31,7 @@
/* end of configuration */
#include <stdlib.h>
#include <string.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "dbbrowser.h"

View File

@ -31,6 +31,7 @@
/* end of configuration */
#include <stdlib.h>
#include <string.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "dbbrowser.h"

View File

@ -43,7 +43,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include "dbbrowser.h"

View File

@ -565,7 +565,9 @@ destripe_dialog(void)
gtk_rc_parse(gimp_gtkrc());
gdk_set_use_xshm(gimp_use_xshm());
#ifdef SIGBUS
signal(SIGBUS, SIG_DFL);
#endif
signal(SIGSEGV, SIG_DFL);
gtk_preview_set_gamma(gimp_gamma());
gtk_preview_set_install_cmap(gimp_install_cmap());

View File

@ -21,11 +21,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include "gtk/gtk.h"

View File

@ -37,10 +37,14 @@
/* Version 1.12. */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -23,14 +23,27 @@
#define VERSION "0.6"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include <libgimp/gimp.h>
#include "g3.h"
/* Declare local functions.
@ -181,7 +194,7 @@ load_image (char *filename)
init_byte_tab( 0, byte_tab );
fd = open(filename, O_RDONLY );
fd = open(filename, O_RDONLY | _O_BINARY );
hibit = 0;
data = 0;

View File

@ -1,11 +1,14 @@
/* #ident "@(#)g3.c 3.1 95/08/30 Copyright (c) Gert Doering" */
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include "g3.h"

View File

@ -84,10 +84,14 @@ static char ident[] = "@(#) libfits.c 0.11 20-Dec-97 (%I%)";
/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/******************************************************************************/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "fitsrw.h"

View File

@ -20,9 +20,13 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <string.h>
#include <time.h>
@ -31,8 +35,6 @@
#include "libgimp/gimpmenu.h"
#include "libgimp/gimpwire.h"
#include "config.h"
#include "megawidget.h"
#include "libifs.h"
@ -270,10 +272,6 @@ static void doit(GDrawable * drawable)
}
tmp = (guchar *) g_malloc(width * height * 4);
if (tmp == NULL) {
fprintf(stderr, "cannot malloc %d bytes.\n", width * height * bytes);
return;
}
/* render */
config.cp.width = width;
@ -294,10 +292,7 @@ static void doit(GDrawable * drawable)
int i, j;
GPixelRgn src_pr, dst_pr;
guchar *sl = (guchar *) g_malloc(3 * width);
if (sl == NULL) {
fprintf(stderr, "cannot malloc %d bytes.\n", width * 3);
return;
}
gimp_pixel_rgn_init(&src_pr, drawable,
0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init(&dst_pr, drawable,

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"

View File

@ -11,20 +11,32 @@
* etc.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "app/brush_header.h"
#include <netinet/in.h>
/* Declare local data types
@ -206,7 +218,8 @@ static gint32 load_image (char *filename) {
gimp_progress_init(temp);
g_free (temp);
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1) {
return -1;
}
@ -217,13 +230,13 @@ static gint32 load_image (char *filename) {
}
/* rearrange the bytes in each unsigned int */
ph.header_size = ntohl(ph.header_size);
ph.version = ntohl(ph.version);
ph.width = ntohl(ph.width);
ph.height = ntohl(ph.height);
ph.bytes = ntohl(ph.bytes);
ph.magic_number = ntohl(ph.magic_number);
ph.spacing = ntohl(ph.spacing);
ph.header_size = g_ntohl(ph.header_size);
ph.version = g_ntohl(ph.version);
ph.width = g_ntohl(ph.width);
ph.height = g_ntohl(ph.height);
ph.bytes = g_ntohl(ph.bytes);
ph.magic_number = g_ntohl(ph.magic_number);
ph.spacing = g_ntohl(ph.spacing);
/* How much extra to add ot the header seek - 1 needs a bit more */
version_extra = 0;
@ -305,19 +318,20 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
drawable->height, FALSE, FALSE);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0644);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
if (fd == -1) {
printf("Unable to open %s\n", filename);
return 0;
}
ph.header_size = htonl(sizeof(ph) + strlen(info.description) + 1);
ph.version = htonl(2);
ph.width = htonl(drawable->width);
ph.height = htonl(drawable->height);
ph.bytes = htonl(drawable->bpp);
ph.magic_number = htonl(GBRUSH_MAGIC);
ph.spacing = htonl(info.spacing);
ph.header_size = g_htonl(sizeof(ph) + strlen(info.description) + 1);
ph.version = g_htonl(2);
ph.width = g_htonl(drawable->width);
ph.height = g_htonl(drawable->height);
ph.bytes = g_htonl(drawable->bpp);
ph.magic_number = g_htonl(GBRUSH_MAGIC);
ph.spacing = g_htonl(info.spacing);
if (write(fd, &ph, sizeof(ph)) != sizeof(ph)) {
close(fd);

View File

@ -34,6 +34,9 @@
#include "config.h"
#ifndef HAVE_RINT
#define rint(x) floor ((x) + 0.5)
#endif
/* Test for GTK1.2-style gdkrgb code, else use old 'preview' code. */
#ifdef __GDK_RGB_H__

View File

@ -46,16 +46,40 @@
* http://www.wilberworks.com/bugs.cgi
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <ctype.h>
#include <math.h>
#include <gtk/gtk.h>
#ifdef NATIVE_WIN32
# include <io.h>
# ifndef W_OK
# define W_OK 2
# endif
# ifndef S_ISDIR
# define S_ISDIR(m) ((m) & _S_IFDIR)
# endif
# ifndef S_ISREG
# define S_ISREG(m) ((m) & _S_IFREG)
# endif
#endif
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "pix_data.h"

View File

@ -19,11 +19,15 @@
/* saves and loads gimp icon files (For toolbox, etc)...
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -31,7 +35,6 @@
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <netinet/in.h>
typedef struct

View File

@ -43,6 +43,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

View File

@ -56,20 +56,34 @@
* -Dan Risacher, 0430 CDT, 26 May 1997
*/
#include "config.h"
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#include <sys/stat.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#ifdef __EMX__
#include <fcntl.h>
#include <process.h>
#endif
#include "libgimp/gimp.h"
/* Author 1: Josh MacDonald (url.c) */
@ -275,13 +289,21 @@ save_image (char *filename,
gint32 drawable_ID,
gint32 run_mode)
{
FILE* f;
GParam* params;
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
FILE* f;
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -317,7 +339,10 @@ save_image (char *filename,
/* return -1; */
/* } */
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a gzip process */
if ((pid = fork()) < 0)
{
@ -356,6 +381,46 @@ save_image (char *filename,
return 0;
}
}
#else /* NATIVE_WIN32 */
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (filename, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cf %s", tmpname);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed\n");
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
unlink (tmpname);
@ -369,8 +434,16 @@ load_image (char *filename, gint32 run_mode)
gint retvals;
char* ext;
char* tmpname;
#ifndef NATIVE_WIN32
int pid;
int status;
#else
SECURITY_ATTRIBUTES secattr;
HANDLE f;
STARTUPINFO startupinfo;
PROCESS_INFORMATION processinfo;
gchar *cmdline;
#endif
ext = find_extension(filename);
if (0 == *ext) {
@ -385,7 +458,10 @@ load_image (char *filename, gint32 run_mode)
tmpname = params[1].data.d_string;
#ifndef NATIVE_WIN32
#ifndef __EMX__
/* fork off a g(un)zip and wait for it */
if ((pid = fork()) < 0)
{
@ -424,6 +500,46 @@ load_image (char *filename, gint32 run_mode)
return -1;
}
}
#else
secattr.nLength = sizeof (SECURITY_ATTRIBUTES);
secattr.lpSecurityDescriptor = NULL;
secattr.bInheritHandle = TRUE;
if ((f = CreateFile (tmpname, GENERIC_WRITE, FILE_SHARE_READ,
&secattr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
{
g_message ("gz: CreateFile failed\n");
_exit (127);
}
startupinfo.cb = sizeof (STARTUPINFO);
startupinfo.lpReserved = NULL;
startupinfo.lpDesktop = NULL;
startupinfo.lpTitle = NULL;
startupinfo.dwFlags =
STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startupinfo.wShowWindow = SW_SHOWMINNOACTIVE;
startupinfo.cbReserved2 = 0;
startupinfo.lpReserved2 = NULL;
startupinfo.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startupinfo.hStdOutput = f;
startupinfo.hStdError = GetStdHandle (STD_ERROR_HANDLE);
cmdline = g_strdup_printf ("gzip -cfd %s", filename);
if (!CreateProcess (NULL, cmdline, NULL, NULL,
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
&startupinfo, &processinfo))
{
g_message ("gz: CreateProcess failed: %d\n", GetLastError ());
_exit (127);
}
CloseHandle (f);
CloseHandle (processinfo.hThread);
WaitForSingleObject (processinfo.hProcess, INFINITE);
#endif /* NATIVE_WIN32 */
/* now that we un-gziped it, load the temp file */

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "libgimp/gimp.h"

View File

@ -31,21 +31,34 @@
* That makes the size 256*240*3 = 184320 bytes.
*/
#include "config.h"
#include <glib.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#ifndef __EMX__
#ifdef HAVE_MMAP
#include <sys/mman.h>
#endif
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
@ -280,7 +293,8 @@ load_image (char *filename)
g_free (temp);
/* open the file */
filedes = open(filename, O_RDONLY);
filedes = open(filename, O_RDONLY | _O_BINARY);
if (filedes == -1)
{
/* errno is set to indicate the error, but the user won't know :-( */
@ -294,7 +308,7 @@ load_image (char *filename)
fprintf(stderr, "hrz filter: file is not HRZ type\n");
return -1;
}
#ifndef __EMX__
#ifdef HAVE_MMAP
mapped = mmap(NULL, 256*240*3, PROT_READ, MAP_PRIVATE, filedes, 0);
if(mapped == (void *)(-1))
{
@ -303,11 +317,6 @@ load_image (char *filename)
}
#else
mapped = g_malloc(256*240*3);
if(mapped == NULL)
{
fprintf(stderr, "hrz filter: could not allocate memory\n");
return -1;
}
if (read(filedes, mapped, 256*240*3) != 256*240*3)
{
fprintf(stderr, "hrz filter: file read error\n");
@ -332,12 +341,10 @@ load_image (char *filename)
do_hrz_load(mapped, &pixel_rgn);
/* close the file */
#ifndef NeXT /* @#%@! NeXTStep */
#ifndef __EMX__
#ifdef HAVE_MMAP
munmap(mapped, 256*240*3);
#else
g_free(mapped);
#endif
#endif
/* Tell the GIMP to display the image.

View File

@ -39,6 +39,7 @@
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include "gtk/gtk.h"

View File

@ -22,6 +22,7 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gck/gck.h>

371
plug-ins/makefile.msc Normal file
View File

@ -0,0 +1,371 @@
# Makefile to build the GIMP plug-ins with Microsoft nmake
# I don't want to use too many makefiles, so this is quite complex.
# This same makefile is also included by sub-makes called as subroutines.
# Various parts of this file are used when makeing from the plug-ins directory,
# and when building individual plug-ins and the three plug-in libraries.
INSTALL = copy
GIMP = C:\gimp
BIN = $(GIMP)\plug-ins
!IFNDEF LIBRARY
!IFNDEF PLUGIN
# This part is used when making from the plug-ins directory
FROMPLUGINSDIR=YES # Used to bypass other parts below
# List plug-ins. We must use several lists to work around nmake's limits
SIMPLE1 = AlienMap CEL CML_explorer FractalExplorer align_layers animationplay animoptimize apply_lens autocrop autostretch_hsv blinds blur bumpmap borderaverage c_astretch checkerboard colorify compose convmatrix cubism
SIMPLE2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
SIMPLE3 = gauss_iir gauss_rle gbr gif gee gfig gicon glasstile gqbist gradmap grid gtm guillotine header hot hrz gz illusion jigsaw laplace lic
SIMPLE4 = mapcolor max_rgb mblur mosaic newsprint nlfilt noisify normalize nova oilify pagecurl palette papertile pat pcx pix pixelize plasma plugindetails pnm polar psd randomize ripple rotate rotators
SIMPLE5 = scatter_hsv semiflatten sharpen shift sinus smooth_palette snoise sobel sparkle spread threshold_alpha tile tileit tiler waves whirlpinch wind video vinvert vpropagate wmf xbm zealouscrop
COMPLEX1 = Lighting MapObject bmp dbbrowser faxg3 fits flame fp gfli ifscompose iwarp jpeg maze png tiff
# These are unofficial, ie not in the CVS To build these, you should
# get tml's source snapshot and copy them from
# ..\unofficial-plug-ins. Also uncomment the reference to COMPLEX2
# below.
COMPLEX2 = guash user_filter twain
# The main target
all : ..\config.h libs-all simple-plugins-all complex-plugins-all
..\config.h : ..\config.h.win32
copy ..\config.h.win32 ..\config.h
install : libs-install simple-plugins-install complex-plugins-install scripts-install
clean : libs-clean simple-plugins-clean complex-plugins-clean
libs-all :
@nmake -nologo -f makefile.msc sub-libs TARGET=all
libs-install :
@nmake -nologo -f makefile.msc sub-libs TARGET=install
libs-clean :
@nmake -nologo -f makefile.msc sub-libs TARGET=clean
sub-libs:
cd megawidget
nmake -nologo -f ..\makefile.msc TOP=..\.. LIBRARY=megawidget $(TARGET)
cd ..
cd gpc
nmake -nologo -f ..\makefile.msc TOP=..\.. LIBRARY=gpc $(TARGET)
cd ..
cd libgck\gck
nmake -nologo -f ..\..\makefile.msc TOP=..\..\.. LIBRARY=gck OBJECTS="gckcolor.obj gcklistbox.obj gckmath.obj gckui.obj gckvector.obj" $(TARGET)
cd ..\..
simple-plugins-all :
@nmake -nologo -f makefile.msc sub-simple-plugins TARGET=all
simple-plugins-install :
@nmake -nologo -f makefile.msc sub-simple-plugins TARGET=install
simple-plugins-clean :
@nmake -nologo -f makefile.msc sub-simple-plugins TARGET=clean
sub-simple-plugins :
for %d in ($(SIMPLE1)) do nmake -nologo -f makefile.msc sub-one-simple DIR=%d TARGET=$(TARGET)
for %d in ($(SIMPLE2)) do nmake -nologo -f makefile.msc sub-one-simple DIR=%d TARGET=$(TARGET)
for %d in ($(SIMPLE3)) do nmake -nologo -f makefile.msc sub-one-simple DIR=%d TARGET=$(TARGET)
for %d in ($(SIMPLE4)) do nmake -nologo -f makefile.msc sub-one-simple DIR=%d TARGET=$(TARGET)
for %d in ($(SIMPLE5)) do nmake -nologo -f makefile.msc sub-one-simple DIR=%d TARGET=$(TARGET)
sub-one-simple :
@cd $(DIR)
@nmake -nologo -f ..\makefile.msc TOP=..\.. PLUGIN=$(DIR) $(TARGET)
complex-plugins-all :
@nmake -nologo -f makefile.msc sub-complex-plugins TARGET=all
complex-plugins-install :
@nmake -nologo -f makefile.msc sub-complex-plugins TARGET=install
complex-plugins-clean :
@nmake -nologo -f makefile.msc sub-complex-plugins TARGET=clean
sub-complex-plugins :
for %d in ($(COMPLEX1)) do nmake -nologo -f makefile.msc sub-one-complex DIR=%d TARGET=$(TARGET)
# We must handle script-fu separately because of the dash, sigh
@cd script-fu
@nmake -nologo -f ..\makefile.msc TOP=..\.. PLUGIN=script-fu COMPLEX_script_fu=1 $(TARGET)
@cd ..
# for %d in ($(COMPLEX2)) do nmake -nologo -f makefile.msc sub-one-complex DIR=%d TARGET=$(TARGET)
sub-one-complex :
@cd $(DIR)
@nmake -nologo -f ..\makefile.msc TOP=..\.. PLUGIN=$(DIR) COMPLEX_$(DIR)=1 $(TARGET)
scripts-install :
$(INSTALL) script-fu\scripts\*.scm $(GIMP)\scripts
$(INSTALL) script-fu\scripts\*.jpg $(GIMP)\scripts
$(INSTALL) FractalExplorer\fractalexplorer-examples\* $(GIMP)\fractalexplorer
!ENDIF
!ENDIF
!IFNDEF FROMPLUGINSDIR
# This part is used when building individual plug-ins or one of
# the libraries.
!IFDEF COMPLEX_Lighting
OBJECTS = \
lighting_apply.obj \
lighting_image.obj \
lighting_main.obj \
lighting_preview.obj \
lighting_shade.obj \
lighting_ui.obj
!ENDIF
!IFDEF COMPLEX_MapObject
OBJECTS = \
arcball.obj \
mapobject_apply.obj \
mapobject_image.obj \
mapobject_main.obj \
mapobject_preview.obj \
mapobject_shade.obj \
mapobject_ui.obj
!ENDIF
!IFDEF COMPLEX_bmp
OBJECTS = \
bmp.obj \
bmpread.obj \
bmpwrite.obj
!ENDIF
!IFDEF COMPLEX_dbbrowser
OBJECTS = \
dbbrowser.obj \
dbbrowser_utils.obj
!ENDIF
!IFDEF COMPLEX_faxg3
OBJECTS = \
faxg3.obj \
g3.obj \
run_tbl.obj
!ENDIF
!IFDEF COMPLEX_fits
OBJECTS = \
fits.obj \
fitsrw.obj
!ENDIF
!IFDEF COMPLEX_flame
OBJECTS = \
cmap.obj \
flame.obj \
libifs.obj \
rect.obj
!ENDIF
!IFDEF COMPLEX_fp
OBJECTS = \
fp.obj \
fp_gdk.obj \
fp_gtk.obj \
fp_hsv.obj \
fp_misc.obj
!ENDIF
!IFDEF COMPLEX_gdyntext
# Doesn't compile yet, though, so not included in list above
OBJECTS = \
charmap.obj \
charmap_window.obj \
font_selection.obj \
gdyntext.obj \
gdyntext_ui.obj \
message_window.obj
!ENDIF
!IFDEF COMPLEX_gfli
OBJECTS = \
fli.obj \
gfli.obj
!ENDIF
!IFDEF COMPLEX_ifscompose
OBJECTS = \
ifscompose.obj \
ifscompose_utils.obj
!ENDIF
!IFDEF COMPLEX_iwarp
!ENDIF
!IFDEF COMPLEX_jpeg
# Location of jpeg-6b sources
JPEG = $(TOP)\..\jpeg-6b
EXTRACFLAGS = -I$(JPEG)
EXTRALIBS = $(JPEG)\libjpeg.lib
!ENDIF
!IFDEF COMPLEX_maze
OBJECTS = \
algorithms.obj \
handy.obj \
maze.obj \
maze_face.obj
!ENDIF
!IFDEF COMPLEX_png
# Location of libpng sources
PNG = $(TOP)\..\libpng-1.0.3
# And zlib
ZLIB = $(TOP)\..\zlib-1.1.3
EXTRACFLAGS = -I$(PNG) -I$(ZLIB)
EXTRALIBS = $(PNG)\libpng.lib $(ZLIB)\zlib.lib
!ENDIF
!IFDEF COMPLEX_script_fu
OBJECTS = \
interp_md5.obj \
interp_regex.obj \
interp_slib.obj \
interp_sliba.obj \
interp_trace.obj \
script-fu.obj \
script-fu-console.obj \
script-fu-scripts.obj \
regex.obj
EXTRALIBS = ..\dbbrowser\dbbrowser_utils.obj
EXTRACFLAGS = -DREGEX_MALLOC
HAVE_RESOURCE = YES
!ENDIF
!IFDEF COMPLEX_tiff
# Location of tiff-3.4 sources
TIFF = $(TOP)\..\tiff-v3.4\libtiff
# Location of jpeg-6b sources
JPEG = $(TOP)\..\jpeg-6b
# And zlib
ZLIB = $(TOP)\..\zlib-1.1.3
EXTRACFLAGS = -I$(TIFF)
EXTRALIBS = $(TIFF)\libtiff.lib $(JPEG)\libjpeg.lib $(ZLIB)\zlib.lib user32.lib
!ENDIF
!IFDEF COMPLEX_guash
HAVE_RESOURCE = YES
!ENDIF
!IFDEF COMPLEX_user_filter
OBJECTS = \
libyywrap.obj \
uf_eval.obj \
uf_file.obj \
uf_gui.obj \
uf_lexer.obj \
uf_main.obj \
uf_parser.tab.obj
!ENDIF
!IFDEF COMPLEX_twain
OBJECTS = \
tw_dump.obj \
tw_func.obj \
tw_sess.obj \
tw_util.obj \
twain.obj
!ENDIF
LDFLAGS = /link /subsystem:windows /machine:ix86 /debug
GIMP_VER = 1.1
GTK_VER = 1.3
GLIB_VER = 1.3
GTK = $(TOP)\..\gtk+
GLIB = $(TOP)\..\glib
PLUGINDIR = $(TOP)\plug-ins
!IFNDEF OPTIMIZE
#OPTIMIZE = -Ox
OPTIMIZE = -Zi
!ENDIF
CC = cl -nologo -G5 -GF $(OPTIMIZE) -W3 -MD -Zm200
CFLAGS = -DHAVE_CONFIG_H $(EXTRACFLAGS) -I. -I$(TOP) -I$(PLUGINDIR) -I$(PLUGINDIR)\libgck -I$(GLIB) -I$(GTK)\gdk\win32 -I$(GTK)
!IFDEF PLUGIN
# This part is used when building individual plug-ins
all : $(PLUGIN).exe
install : all
$(INSTALL) $(PLUGIN).exe $(BIN)
!IFNDEF OBJECTS
OBJECTS = $(PLUGIN).obj
!ENDIF
!IFDEF HAVE_RESOURCE
# Do we have our own resource file (just an icon, usually)
RESOURCE = $(PLUGIN).res
!ELSE
# Use the Wilber icon otherwise. If gimp.exe sometime gets more resources,
# this will have to be changed.
RESOURCE = ..\..\app\gimp.res
!ENDIF
$(PLUGIN).exe : $(OBJECTS) $(RESOURCE)
$(CC) $(CFLAGS) -MD -Fe$(PLUGIN).exe $(OBJECTS) $(RESOURCE) ..\megawidget\megawidget.lib ..\gpc\gpc.lib ..\libgck\gck\gck.lib ..\..\libgimp\gimp-$(GIMP_VER).lib ..\..\libgimp\gimpui-$(GIMP_VER).lib $(GTK)\gtk\gtk-$(GTK_VER).lib $(GTK)\gdk\win32\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(EXTRALIBS) $(LDFLAGS)
$(PLUGIN).res : $(PLUGIN).rc
rc -r -fo $(PLUGIN).res $(PLUGIN).rc
!ENDIF
!IFDEF LIBRARY
# This part is used when building a library
all : $(LIBRARY).lib
install : all
!IFNDEF OBJECTS
OBJECTS = $(LIBRARY).obj
!ENDIF
$(LIBRARY).lib : $(OBJECTS)
lib /out:$(LIBRARY).lib $(OBJECTS)
!ENDIF
.c.obj :
$(CC) $(CFLAGS) -c $<
clean :
erase *.obj
erase *.lib
erase *.exp
erase *.exe
!ENDIF

View File

@ -23,6 +23,8 @@
*
*/
#include <string.h>
#include "libgimp/gimp.h"
/* get_colors Returns the current foreground and background colors in

View File

@ -37,14 +37,20 @@
*
*/
#ifdef MAZE_DEBUG
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef MAZE_DEBUG
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#include <time.h> /* For random seeding */
#include "libgimp/gimp.h"
#include <libgimp/gimp.h>
#include "maze.h"
extern gint maze_dialog (void);

View File

@ -44,10 +44,14 @@
* Smash all bugs :-)
*/
#include "config.h"
#include <stdlib.h>
#include <math.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <libgimp/gimp.h>

View File

@ -43,13 +43,23 @@
* gtk_label_set() -> gtk_label_set_text()
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <gtk/gtk.h>
#include "libgimp/gimp.h"
#include <libgimp/gimp.h>
#ifndef HAVE_RINT
#define rint(x) floor((x)+0.5)
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifdef RCSID
static char rcsid[] = "$Id$";

View File

@ -4,21 +4,33 @@
* Some bits stolen from the .99.7 source tree.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "app/pattern_header.h"
#include <netinet/in.h>
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include "app/pattern_header.h"
/* Declare local data types
*/
@ -184,7 +196,8 @@ static gint32 load_image (char *filename) {
gimp_progress_init(temp);
g_free (temp);
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1) {
return -1;
}
@ -195,12 +208,12 @@ static gint32 load_image (char *filename) {
}
/* rearrange the bytes in each unsigned int */
ph.header_size = ntohl(ph.header_size);
ph.version = ntohl(ph.version);
ph.width = ntohl(ph.width);
ph.height = ntohl(ph.height);
ph.bytes = ntohl(ph.bytes);
ph.magic_number = ntohl(ph.magic_number);
ph.header_size = g_ntohl(ph.header_size);
ph.version = g_ntohl(ph.version);
ph.width = g_ntohl(ph.width);
ph.height = g_ntohl(ph.height);
ph.bytes = g_ntohl(ph.bytes);
ph.magic_number = g_ntohl(ph.magic_number);
if (ph.magic_number != GPATTERN_MAGIC || ph.version != 1 ||
ph.header_size <= sizeof(ph)) {
@ -265,17 +278,18 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
drawable->height, FALSE, FALSE);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0644);
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
if (fd == -1) {
return 0;
}
ph.header_size = htonl(sizeof(ph) + strlen(description) + 1);
ph.version = htonl(1);
ph.width = htonl(drawable->width);
ph.height = htonl(drawable->height);
ph.bytes = htonl(drawable->bpp);
ph.magic_number = htonl(GPATTERN_MAGIC);
ph.header_size = g_htonl(sizeof(ph) + strlen(description) + 1);
ph.version = g_htonl(1);
ph.width = g_htonl(drawable->width);
ph.height = g_htonl(drawable->height);
ph.bytes = g_htonl(drawable->bpp);
ph.magic_number = g_htonl(GPATTERN_MAGIC);
if (write(fd, &ph, sizeof(ph)) != sizeof(ph)) {
close(fd);

View File

@ -43,6 +43,7 @@
static char ident[] = "@(#) GIMP Alias|Wavefront pix image file-plugin v1.0 24-jun-97";
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@ -25,19 +25,31 @@
* does not contain any code from the netpbm or pbmplus distributions.
*/
#include "config.h"
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifdef NATIVE_WIN32
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
/* Declare local data types
*/
@ -340,13 +352,13 @@ load_image (char *filename)
PNMScanner *scan;
int ctr;
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Loading %s:", filename);
temp = g_strdup_printf ("Loading %s:", filename);
gimp_progress_init (temp);
g_free (temp);
/* open the file */
fd = open(filename, O_RDONLY);
fd = open(filename, O_RDONLY | _O_BINARY);
if (fd == -1)
{
/*gimp_message("pnm filter: can't open file\n");*/
@ -355,11 +367,6 @@ load_image (char *filename)
/* allocate the necessary structures */
pnminfo = (PNMInfo *) g_malloc(sizeof(PNMInfo));
if (!pnminfo)
{
close (fd);
return -1;
}
scan = NULL;
/* set error handling */
@ -579,9 +586,7 @@ static pnm_load_rawpbm (PNMScanner *scan,
fd = pnmscanner_fd(scan);
rowlen = (int)ceil((double)(info->xres)/8.0);
data = g_malloc (gimp_tile_height () * info->xres);
CHECK_FOR_ERROR((NULL == (buf = g_malloc(rowlen*sizeof(unsigned char)))),
info->jmpbuf, "pnm filter: malloc failed\n");
buf = g_malloc(rowlen*sizeof(unsigned char));
for (y = 0; y < info->yres; )
{
@ -713,16 +718,16 @@ save_image (char *filename,
return FALSE;
}
temp = g_malloc (strlen (filename) + 11);
sprintf (temp, "Saving %s:", filename);
temp = g_strdup_printf ("Saving %s:", filename);
gimp_progress_init (temp);
g_free (temp);
/* open the file */
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | _O_BINARY, 0644);
if (fd == -1)
{
g_message ("pnm: can't open \"%s\"\n", filename);
g_message ("pnm: can't open \"%s\"", filename);
return FALSE;
}
@ -946,7 +951,6 @@ pnmscanner_create (int fd)
PNMScanner *s;
s = (PNMScanner *)g_malloc(sizeof(PNMScanner));
if (!s) return(NULL);
s->fd = fd;
s->inbuf = 0;
s->eof = !read(s->fd, &(s->cur), 1);

View File

@ -55,14 +55,18 @@
* - Daniel Dunbar
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846

View File

@ -130,14 +130,22 @@
#define IFDBG if (PSD_DEBUG)
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <math.h>
#include <glib.h>
#include "libgimp/gimp.h"
#include <glib.h>
#include <libgimp/gimp.h>
#ifndef HAVE_RINT
#define rint(x) floor (x + 0.5)
#endif
/* Local types etc
*/

View File

@ -69,6 +69,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "libgimp/gimp.h"
#include "gtk/gtk.h"

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "libgimp/gimp.h"
/* Declare local functions. */

View File

@ -68,6 +68,8 @@
Release 3.2X MAR-96. dynamic linking, subr closures, other improvements.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@ -78,9 +80,17 @@
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#if HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
#include <glib.h>
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#endif
#include "siod.h"
#include "siodp.h"
@ -418,12 +428,18 @@ repl_c_string (char *str,
double
myruntime (void)
{
#if HAVE_SYS_TIMES_H
double total;
struct tms b;
times (&b);
total = b.tms_utime;
total += b.tms_stime;
return (total / 60.0);
#elif NATIVE_WIN32
FILETIME creation, exit, kernel, user;
GetProcessTimes (GetCurrentProcess (), &creation, &exit, &kernel, &user);
return (kernel.dwLowDateTime * 1e7 + user.dwLowDateTime * 1e7);
#endif
}
#if defined(__osf__)

View File

@ -667,6 +667,9 @@ lreadstring (struct gen_readio * f)
my_err ("eof after \\", NIL);
switch (c)
{
case '\\':
c = '\\';
break;
case 'n':
c = '\n';
break;

View File

@ -16,21 +16,37 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "gdk/gdkkeysyms.h"
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "siod.h"
#include "script-fu-console.h"
#include <plug-ins/dbbrowser/dbbrowser.h>
#ifdef NATIVE_WIN32
#include <fcntl.h>
#include <io.h>
#endif
#ifndef NATIVE_WIN32
#define TEXT_WIDTH 400
#define TEXT_HEIGHT 400
#define ENTRY_WIDTH 400
@ -572,6 +588,8 @@ script_fu_close_siod_console ()
close (siod_output_pipe[1]);
}
#endif /* !NATIVE_WIN32 */
void
script_fu_eval_run (char *name,
int nparams,

View File

@ -16,20 +16,45 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <ctype.h> /* For toupper() */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/gimpfileselection.h"
#include "siod.h"
#include "script-fu-scripts.h"
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#include <io.h>
#ifndef W_OK
#define W_OK 2
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) ((m) & _S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
#endif /* NATIVE_WIN32 */
#define TEXT_WIDTH 100
#define TEXT_HEIGHT 25
#define COLOR_SAMPLE_WIDTH 100
@ -288,7 +313,7 @@ script_fu_find_scripts ()
/* Set local path to contain temp_path, where (supposedly)
* there may be working files.
*/
home = getenv ("HOME");
home = g_get_home_dir ();
local_path = g_strdup (path_str);
/* Search through all directories in the local path */
@ -315,8 +340,8 @@ script_fu_find_scripts ()
if (!my_err && S_ISDIR (filestat.st_mode))
{
if (path[strlen (path) - 1] != '/')
strcat (path, "/");
if (path[strlen (path) - 1] != G_DIR_SEPARATOR)
strcat (path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir (path);
@ -327,25 +352,28 @@ script_fu_find_scripts ()
{
while ((dir_ent = readdir (dir)))
{
filename = g_malloc (strlen(path) + strlen (dir_ent->d_name) + 1);
filename = g_strdup_printf ("%s%s", path, dir_ent->d_name);
sprintf (filename, "%s%s", path, dir_ent->d_name);
if (strcmp (filename + strlen (filename) - 4, ".scm") == 0)
if (g_strcasecmp (filename + strlen (filename) - 4, ".scm") == 0)
{
/* Check the file and see that it is not a sub-directory */
my_err = stat (filename, &filestat);
if (!my_err && S_ISREG (filestat.st_mode))
{
char *qf = g_strescape (filename);
#ifdef __EMX__
_fnslashify(filename);
_fnslashify(qf);
#endif
command = g_new (char, strlen ("(load \"\")") + strlen (filename) + 1);
sprintf (command, "(load \"%s\")", filename);
command = g_strdup_printf ("(load \"%s\")", qf);
g_free (qf);
repl_c_string (command, 0, 0, 1);
#ifdef NATIVE_WIN32
/* No, I don't know why, but this is
* necessary on NT 4.0.
*/
Sleep(0);
#endif
g_free (command);
}
}
@ -592,6 +620,20 @@ script_fu_add_script (LISP a)
if (!TYPEP (car (a), tc_string))
return my_err ("script-fu-register: filename defaults must be string values", NIL);
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
#ifdef NATIVE_WIN32
/* Replace POSIX slashes with Win32 backslashes. This
* is just so script-fus can be written with only
* POSIX directory separators.
*/
val = script->arg_defaults[i].sfa_file.filename;
while (*val)
{
if (*val == '/')
*val = '\\';
val++;
}
#endif
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
script->arg_values[i].sfa_file.fileselection = NULL;
@ -733,6 +775,7 @@ script_fu_script_proc (char *name,
GRunModeType run_mode;
SFScript *script;
int min_args;
char *escaped;
run_mode = params[0].data.d_int32;
@ -799,10 +842,10 @@ script_fu_script_proc (char *name,
length += strlen (params[i + 1].data.d_string) + 1;
break;
case SF_STRING:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_FILENAME:
length += strlen (params[i + 1].data.d_string) + 3;
escaped = g_strescape (params[i + 1].data.d_string);
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_ADJUSTMENT:
length += strlen (params[i + 1].data.d_string) + 1;
@ -856,7 +899,9 @@ script_fu_script_proc (char *name,
break;
case SF_STRING:
case SF_FILENAME:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
escaped = g_strescape (params[i + 1].data.d_string);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_ADJUSTMENT:
@ -1526,6 +1571,7 @@ script_fu_ok_callback (GtkWidget *widget,
int length;
int i;
GdkFont *font;
char *escaped;
if ((script = sf_interface.script) == NULL)
return;
@ -1564,13 +1610,17 @@ script_fu_ok_callback (GtkWidget *widget,
length += strlen (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]))) + 1;
break;
case SF_STRING:
length += strlen (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]))) + 3;
escaped = g_strescape (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i])));
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_ADJUSTMENT:
length += 24; /* Maximum size of float value should not exceed this many characters */
break;
case SF_FILENAME:
length += strlen (script->arg_values[i].sfa_file.filename) + 3;
escaped = g_strescape (script->arg_values[i].sfa_file.filename);
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_FONT:
length += strlen (script->arg_values[i].sfa_font.fontname) + 3;
@ -1623,8 +1673,10 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_STRING:
text = gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]));
g_free (script->arg_values[i].sfa_value);
script->arg_values[i].sfa_value = g_strdup (text);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", text);
script->arg_values[i].sfa_value = text;
escaped = g_strescape (text);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_ADJUSTMENT:
@ -1644,7 +1696,9 @@ script_fu_ok_callback (GtkWidget *widget,
}
break;
case SF_FILENAME:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_file.filename);
escaped = g_strescape (script->arg_values[i].sfa_file.filename);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_FONT:

View File

@ -16,20 +16,45 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <sys/stat.h>
#include <ctype.h> /* For toupper() */
#include "gtk/gtk.h"
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
#include "libgimp/gimpfileselection.h"
#include "siod.h"
#include "script-fu-scripts.h"
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#include <io.h>
#ifndef W_OK
#define W_OK 2
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) ((m) & _S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
#endif /* NATIVE_WIN32 */
#define TEXT_WIDTH 100
#define TEXT_HEIGHT 25
#define COLOR_SAMPLE_WIDTH 100
@ -288,7 +313,7 @@ script_fu_find_scripts ()
/* Set local path to contain temp_path, where (supposedly)
* there may be working files.
*/
home = getenv ("HOME");
home = g_get_home_dir ();
local_path = g_strdup (path_str);
/* Search through all directories in the local path */
@ -315,8 +340,8 @@ script_fu_find_scripts ()
if (!my_err && S_ISDIR (filestat.st_mode))
{
if (path[strlen (path) - 1] != '/')
strcat (path, "/");
if (path[strlen (path) - 1] != G_DIR_SEPARATOR)
strcat (path, G_DIR_SEPARATOR_S);
/* Open directory */
dir = opendir (path);
@ -327,25 +352,28 @@ script_fu_find_scripts ()
{
while ((dir_ent = readdir (dir)))
{
filename = g_malloc (strlen(path) + strlen (dir_ent->d_name) + 1);
filename = g_strdup_printf ("%s%s", path, dir_ent->d_name);
sprintf (filename, "%s%s", path, dir_ent->d_name);
if (strcmp (filename + strlen (filename) - 4, ".scm") == 0)
if (g_strcasecmp (filename + strlen (filename) - 4, ".scm") == 0)
{
/* Check the file and see that it is not a sub-directory */
my_err = stat (filename, &filestat);
if (!my_err && S_ISREG (filestat.st_mode))
{
char *qf = g_strescape (filename);
#ifdef __EMX__
_fnslashify(filename);
_fnslashify(qf);
#endif
command = g_new (char, strlen ("(load \"\")") + strlen (filename) + 1);
sprintf (command, "(load \"%s\")", filename);
command = g_strdup_printf ("(load \"%s\")", qf);
g_free (qf);
repl_c_string (command, 0, 0, 1);
#ifdef NATIVE_WIN32
/* No, I don't know why, but this is
* necessary on NT 4.0.
*/
Sleep(0);
#endif
g_free (command);
}
}
@ -592,6 +620,20 @@ script_fu_add_script (LISP a)
if (!TYPEP (car (a), tc_string))
return my_err ("script-fu-register: filename defaults must be string values", NIL);
script->arg_defaults[i].sfa_file.filename = g_strdup (get_c_string (car (a)));
#ifdef NATIVE_WIN32
/* Replace POSIX slashes with Win32 backslashes. This
* is just so script-fus can be written with only
* POSIX directory separators.
*/
val = script->arg_defaults[i].sfa_file.filename;
while (*val)
{
if (*val == '/')
*val = '\\';
val++;
}
#endif
script->arg_values[i].sfa_file.filename = g_strdup (script->arg_defaults[i].sfa_file.filename);
script->arg_values[i].sfa_file.fileselection = NULL;
@ -733,6 +775,7 @@ script_fu_script_proc (char *name,
GRunModeType run_mode;
SFScript *script;
int min_args;
char *escaped;
run_mode = params[0].data.d_int32;
@ -799,10 +842,10 @@ script_fu_script_proc (char *name,
length += strlen (params[i + 1].data.d_string) + 1;
break;
case SF_STRING:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_FILENAME:
length += strlen (params[i + 1].data.d_string) + 3;
escaped = g_strescape (params[i + 1].data.d_string);
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_ADJUSTMENT:
length += strlen (params[i + 1].data.d_string) + 1;
@ -856,7 +899,9 @@ script_fu_script_proc (char *name,
break;
case SF_STRING:
case SF_FILENAME:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
escaped = g_strescape (params[i + 1].data.d_string);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_ADJUSTMENT:
@ -1526,6 +1571,7 @@ script_fu_ok_callback (GtkWidget *widget,
int length;
int i;
GdkFont *font;
char *escaped;
if ((script = sf_interface.script) == NULL)
return;
@ -1564,13 +1610,17 @@ script_fu_ok_callback (GtkWidget *widget,
length += strlen (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]))) + 1;
break;
case SF_STRING:
length += strlen (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]))) + 3;
escaped = g_strescape (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i])));
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_ADJUSTMENT:
length += 24; /* Maximum size of float value should not exceed this many characters */
break;
case SF_FILENAME:
length += strlen (script->arg_values[i].sfa_file.filename) + 3;
escaped = g_strescape (script->arg_values[i].sfa_file.filename);
length += strlen (escaped) + 3;
g_free (escaped);
break;
case SF_FONT:
length += strlen (script->arg_values[i].sfa_font.fontname) + 3;
@ -1623,8 +1673,10 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_STRING:
text = gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]));
g_free (script->arg_values[i].sfa_value);
script->arg_values[i].sfa_value = g_strdup (text);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", text);
script->arg_values[i].sfa_value = text;
escaped = g_strescape (text);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_ADJUSTMENT:
@ -1644,7 +1696,9 @@ script_fu_ok_callback (GtkWidget *widget,
}
break;
case SF_FILENAME:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", script->arg_values[i].sfa_file.filename);
escaped = g_strescape (script->arg_values[i].sfa_file.filename);
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
text = buffer;
break;
case SF_FONT:

View File

@ -15,12 +15,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "libgimp/gimp.h"
#include "gtk/gtk.h"
#include "siod.h"
#include "script-fu-console.h"
#include "script-fu-scripts.h"
@ -140,6 +146,7 @@ query ()
PROC_EXTENSION,
0, 0, NULL, NULL);
#ifndef NATIVE_WIN32
gimp_install_procedure ("extension_script_fu_console",
"Provides a console mode for script-fu development",
"Provides an interface which allows interactive scheme development.",
@ -163,6 +170,7 @@ query ()
PROC_EXTENSION,
nserver_args, 0,
server_args, NULL);
#endif
gimp_install_procedure ("extension_script_fu_eval",
"Evaluate scheme code",
@ -217,6 +225,9 @@ run (char *name,
/* Acknowledge that the extension is properly initialized */
gimp_extension_ack ();
/* We need wakeups (on Win32) when getting callbacks from the GIMP */
gimp_request_wakeups ();
while (1)
gimp_extension_process (0);
@ -226,6 +237,7 @@ run (char *name,
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
}
#ifndef NATIVE_WIN32
/*
* The script-fu console for interactive SIOD development
*/
@ -240,6 +252,7 @@ run (char *name,
{
script_fu_server_run (name, nparams, param, nreturn_vals, return_vals);
}
#endif
/*
* A non-interactive "console" (for batch mode)
*/
@ -1002,11 +1015,11 @@ marshall_proc_db_call (LISP a)
/* reverse the return values */
return_val = nreverse (return_val);
#ifndef NATIVE_WIN32
/* if we're in server mode, listen for additional commands for 10 ms */
if (server_mode)
script_fu_server_listen (10);
#endif
return return_val;
}

View File

@ -68,6 +68,8 @@
Release 3.2X MAR-96. dynamic linking, subr closures, other improvements.
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@ -78,9 +80,17 @@
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#if HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
#include <glib.h>
#ifdef NATIVE_WIN32
#define STRICT
#include <windows.h>
#endif
#include "siod.h"
#include "siodp.h"
@ -418,12 +428,18 @@ repl_c_string (char *str,
double
myruntime (void)
{
#if HAVE_SYS_TIMES_H
double total;
struct tms b;
times (&b);
total = b.tms_utime;
total += b.tms_stime;
return (total / 60.0);
#elif NATIVE_WIN32
FILETIME creation, exit, kernel, user;
GetProcessTimes (GetCurrentProcess (), &creation, &exit, &kernel, &user);
return (kernel.dwLowDateTime * 1e7 + user.dwLowDateTime * 1e7);
#endif
}
#if defined(__osf__)

View File

@ -667,6 +667,9 @@ lreadstring (struct gen_readio * f)
my_err ("eof after \\", NIL);
switch (c)
{
case '\\':
c = '\\';
break;
case 'n':
c = '\n';
break;

View File

@ -46,11 +46,15 @@
* plug-ins. */
#include "config.h"
#include <math.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gtk/gtk.h"
#include "libgimp/gimp.h"