Release 970804

Sun Aug  3 14:03:43 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [documentation/Makefile.in]
	Create links for files included from wine.texinfo.

	* [wine.man]
	Moved to documentation dir.

	* [if1632/builtin.c]
	Made SYSTEM.DLL always loaded by default.

	* [loader/signal.c] [if1632/signal.c]
	Split signal.c in generic/emulator-specific parts.

	* [misc/system.c] [if1632/thunk.c]
	Implemented system timer functions.
	Fixed InquireSystem parameters.

	* [msdos/ioports.c]
	Defined inb/outb functions to avoid including asm/io.h.
	Use the right instruction for word and dword direct access.

	* [multimedia/mmsystem.c]
	Fixed CallTo16 usage.

Sat Aug 2 13:05:23 1997  Andreas Mohr <100.30936@germany.net>

	* [controls/edit.c]
	When text is inserted into a newly created editline, the caret
	is placed after the text. Should be placed before the text. Fixed.

	* [files/file.c]
	Removed O_TRUNC flag from OF_WRITE mode in _lopen32().
	According to doc _lopen() never truncates files.

	* [if1632/user.spec] [misc/comm.c]
	Added stub for EnableCommNotification().

	* [misc/ver.c]
	Fixed problem with VerQueryValue*() running over end of name table
	in rare cases.

	* [msdos/int21.c]
	Enhanced ioctlGetDeviceInfo() to correctly return the current drive.

	* [multimedia/joystick.c] [windows/message.c]
	Added joystick support !!!
	Needs Linux >= 2.1.45 or joystick-0.8.0.tar.gz.

Fri Aug  1 18:02:09 1997  Morten Welinder  <terra@diku.dk>

	* [if1632/user32.spec]
	Define DrawAnimatedRects32.

	* [graphics/painting.c]
	(DrawAnimatedRects32): Create stub.

	* [misc/registry.c]
	Cope with NULL class in RegQueryInfoKey32A.

	* [if1632/user32.spec]
	Add GetMenuItemInfo32[AW].

	* [controls/menu.c]
	(InsertMenu32A): Upgrade flags to 8 hex-digits.
	(MENUEX_ParseResource): First shot at implementation.
	(LoadMenuIndirect32A): Handle extended menus.
	(GetMenuItemInfo32[AW]): First shot at implementation.

	* [include/windows.h]
	Define MFT_*, MFS_*, MIIM_* macros.  Define MENUITEMINFO[AW]
 	structures and pointers.

	* [Makefile.in]
	(etags): Add TAGS as target.

	* [if1632/comctl32.spec]
	Use Windows 95's ordinals.  Add a few missing stubs.

Thu Jul 31 14:01:13 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [objects/color.c]
	Fix for 16 color mode of XFree.

	* [if1632/kernel32.spec][win32/ordinals.c]
	Moved/added some ordinal only exported functions from kernel32.dll
	(mostly thunking preparation stuff).

Wed Jul 30 09:16:38 1997  John Harvey <john@division.co.uk>

	* [graphics/win16drv/init.c] [include/win16drv.h]
        Escape(SETABORTPROC) returns success to keep pbrush.exe happy.
        Escape(NEXTBAND) implemented to make HP PCL printer driver work in
 	word.  Stub for PATBLT added to start work on printing more than
 	text.

Mon Jul 28 13:14:28 1997  Victor Schneider <vischne@ibm.net>

	* [libtest/expand.c]
	New Winelib test program.

Wed Jul 23 09:37:13 1997  Adrian Harvey <adrian@select.com.au>

	* [tools/build.c] [tools/build-spec.txt] [if1632/kernel.spec]
	  [if1632/user.spec]
	Added ability to set filename wine considers the built-in DLLs 
	to be in  to something other than name.DLL with new "file" key
	in .spec files.
	Made kernel filename KRNL386.EXE (some programs use this name 
	explicitly - ChemOffice install now starts up).
	Made user filename USER.EXE (just to be tidy).

Sun Jul 20 23:51:02 1997  David A. Cuthbert <dacut@henry.ece.cmu.edu>

	* [controls/menu.c] [misc/tweak.c] [include/tweak.h]
	Fixed MENU_KeyLeft and MENU_KeyRight to handle multiple-column
	menus.  Misc menu drawing issues for Win95 tweaks fixed.  Misc
	warnings fixed.

	* [loader/module.c]
	Spaces are now permitted in file/path names on the command line.
	If multiple matches can be made, the preferred match is the
	path/file with fewer spaces.

Tue Jul 29 02:21:15 1997  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [misc/compobj.c]
	Added CLSIDFromString and StringFromCLSID.
diff --git a/loader/signal.c b/loader/signal.c
index 43aae82..1257e33 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -1,4 +1,8 @@
-#ifndef WINELIB
+/*
+ * Wine signal handling
+ *
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <signal.h>
@@ -21,198 +25,110 @@
 #include <syscall.h>
 #endif
 
-#include "debugger.h"
-#include "options.h"
-#include "sigcontext.h"
-#include "win.h"
+#include "miscemu.h"
 #include "winsock.h"
 
-#if !defined(BSD4_4) || defined(linux) || defined(__FreeBSD__)
-char * cstack[4096];
-#endif
 
-#ifdef linux
-extern void ___sig_restore();
-extern void ___masksig_restore();
+/* Linux sigaction function */
 
+#if defined(linux) && defined(__i386__)
 /* This is the sigaction structure from the Linux 2.1.20 kernel.  */
-
-struct kernel_sigaction {
-	__sighandler_t sa_handler;
-	unsigned long sa_mask;
-	unsigned long sa_flags;
-	void (*sa_restorer) __P ((void));
+struct kernel_sigaction
+{
+    void (*sa_handler)();
+    unsigned long sa_mask;
+    unsigned long sa_flags;
+    void (*sa_restorer)();
 };
 
 /* Similar to the sigaction function in libc, except it leaves alone the
-   restorer field */
-
-static int
-wine_sigaction(int sig,struct kernel_sigaction * new, 
-               struct kernel_sigaction * old)
+   restorer field, which is used to specify the signal stack address */
+static __inline__ int wine_sigaction( int sig, struct kernel_sigaction *new,
+                                      struct kernel_sigaction *old )
 {
-	__asm__("int $0x80":"=a" (sig)
-		:"0" (SYS_sigaction),"b" (sig),"c" (new),"d" (old));
-	if (sig>=0)
-		return 0;
-	errno = -sig;
-	return -1;
+    __asm__ __volatile__( "int $0x80"
+                          : "=a" (sig)
+                          : "0" (SYS_sigaction),
+                            "b" (sig),
+                            "c" (new),
+                            "d" (old) );
+    if (sig>=0)
+        return 0;
+    errno = -sig;
+    return -1;
 }
-#endif /* linux */
+#endif /* linux && __i386__ */
 
 
-#ifdef linux
-#define HANDLER_DEF(name) void name (int signal, SIGCONTEXT context_struct)
-#define HANDLER_PROLOG SIGCONTEXT *context = &context_struct; (void)context; {
-#define HANDLER_EPILOG }
-#elif defined(__svr4__) || defined(_SCO_DS)
-#define HANDLER_DEF(name) void name (int signal, void *siginfo, SIGCONTEXT *context)
-#define HANDLER_PROLOG  /* nothing */
-#define HANDLER_EPILOG  /* nothing */
+/* Signal stack */
+
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+# define SIGNAL_STACK_SIZE  MINSIGSTKSZ
+#elif defined (__svr4__) || defined(_SCO_DS)
+# define SIGNAL_STACK_SIZE  SIGSTKSZ
 #else
-#define HANDLER_DEF(name) void name (int signal, int code, SIGCONTEXT *context)
-#define HANDLER_PROLOG  /* nothing */
-#define HANDLER_EPILOG  /* nothing */
+# define SIGNAL_STACK_SIZE  4096
 #endif
 
-extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
+static char SIGNAL_Stack[SIGNAL_STACK_SIZE];
 
-/**********************************************************************
- *		wine_timer
- *
- * SIGALRM handler.
- */
-static
-HANDLER_DEF(wine_timer)
-{
-  HANDLER_PROLOG;
-  /* Should do real-time timers here */
-  DOSMEM_Tick();
-  HANDLER_EPILOG;
-}
-
-/**********************************************************************
- *              SIGNAL_break
- * 
- * Handle Ctrl-C and such
- */
-static
-HANDLER_DEF(SIGNAL_break)
-{
-  HANDLER_PROLOG;
-  if (Options.debug) wine_debug( signal, context );  /* Enter our debugger */
-  exit(0);
-  HANDLER_EPILOG;
-}
 
 /**********************************************************************
  *              SIGNAL_child
  * 
  * wait4 terminated child processes
  */
-static
-HANDLER_DEF(SIGNAL_child)
+static void SIGNAL_child(void)
 {
-  HANDLER_PROLOG;
 #ifdef HAVE_WAIT4
-  wait4( 0, NULL, WNOHANG, NULL);
+    wait4( 0, NULL, WNOHANG, NULL);
 #elif defined (HAVE_WAITPID)
-  /* I am sort-of guessing that this is the same as the wait4 call.  */
-  waitpid (0, NULL, WNOHANG);
+    /* I am sort-of guessing that this is the same as the wait4 call.  */
+    waitpid (0, NULL, WNOHANG);
 #else
-  wait(NULL);
+    wait(NULL);
 #endif
-  HANDLER_EPILOG;
-}
-
-
-/**********************************************************************
- *		SIGNAL_trap
- *
- * SIGTRAP handler.
- */
-static
-HANDLER_DEF(SIGNAL_trap)
-{
-  HANDLER_PROLOG;
-  wine_debug( signal, context );  /* Enter our debugger */
-  HANDLER_EPILOG;
-}
-
-
-/**********************************************************************
- *		SIGNAL_fault
- *
- * Segfault handler.
- */
-static
-HANDLER_DEF(SIGNAL_fault)
-{
-  HANDLER_PROLOG;
-  if (CS_sig(context) == WINE_CODE_SELECTOR)
-    {
-        fprintf( stderr, "Segmentation fault in Wine program (%04x:%08lx)."
-                         "  Please debug.\n",
-		(unsigned short) CS_sig(context), EIP_sig(context));
-    }
-  else
-    {
-        if (INSTR_EmulateInstruction( context )) return;
-        fprintf( stderr, "Segmentation fault in Windows program %04x:%08lx.\n",
-		(unsigned short) CS_sig(context), EIP_sig(context) );
-    }
-  wine_debug( signal, context );
-  HANDLER_EPILOG;
 }
 
 
 /**********************************************************************
  *		SIGNAL_SetHandler
  */
-static void SIGNAL_SetHandler( int sig, void (*func)(), int flags )
+void SIGNAL_SetHandler( int sig, void (*func)(), int flags )
 {
     int ret;
 
-#ifdef linux
+#if defined(linux) && defined(__i386__)
+
     struct kernel_sigaction sig_act;
     sig_act.sa_handler = func;
     sig_act.sa_flags = SA_RESTART | (flags) ? SA_NOMASK : 0;
     /* Point to the top of the stack, minus 4 just in case, and make
        it aligned  */
     sig_act.sa_restorer = 
-        (void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
+        (void (*)())((int)(SIGNAL_Stack + sizeof(SIGNAL_Stack) - 4) & ~3);
     ret = wine_sigaction( sig, &sig_act, NULL );
-#endif  /* linux */
 
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#else  /* linux && __i386__ */
+
     struct sigaction sig_act;
     sigset_t sig_mask;
     sigemptyset(&sig_mask);
     sig_act.sa_handler = func;
+    sig_act.sa_mask = sig_mask;
+
+# if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
     sig_act.sa_flags = SA_ONSTACK;
-    sig_act.sa_mask = sig_mask;
-    ret = sigaction( sig, &sig_act, NULL );
-#endif  /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
-
-#if defined (__svr4__) || defined(_SCO_DS)
-    struct sigaction sig_act;
-    sigset_t sig_mask;
-    sigemptyset(&sig_mask);
-    sig_act.sa_handler = func;
+# elif defined (__svr4__) || defined(_SCO_DS)
     sig_act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART;
-    sig_act.sa_mask = sig_mask;
-    ret = sigaction( sig, &sig_act, NULL );
-#endif  /* __svr4__ || _SCO_DS */
-
-#if defined(__EMX__)
-    struct sigaction sig_act;
-    sigset_t sig_mask;
-    sigemptyset(&sig_mask);
-    sig_act.sa_handler = func;
+# elif defined(__EMX__)
     sig_act.sa_flags = 0; /* FIXME: EMX has only SA_ACK and SA_SYSV */
-    sig_act.sa_mask = sig_mask;
+# else
+    sig_act.sa_flags = 0;
+# endif
     ret = sigaction( sig, &sig_act, NULL );
-#endif  /* __EMX__ */
+
+#endif  /* linux && __i386__ */
 
     if (ret < 0)
     {
@@ -230,53 +146,23 @@
  */
 BOOL32 SIGNAL_Init(void)
 {
-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__svr4__) || defined(_SCO_DS)
     struct sigaltstack ss;
-        
-    if ((ss.ss_sp = malloc(MINSIGSTKSZ)) == NULL) {
-        fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
-                MINSIGSTKSZ);
-        return FALSE;
-    }
-    ss.ss_size = MINSIGSTKSZ;
+    ss.ss_sp    = SIGNAL_Stack;
+    ss.ss_size  = sizeof(SIGNAL_Stack);
     ss.ss_flags = 0;
-    if (sigaltstack(&ss, NULL) < 0) {
+    if (sigaltstack(&ss, NULL) < 0)
+    {
         perror("sigstack");
         return FALSE;
     }
-#endif  /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
-
-#if defined (__svr4__) || defined(_SCO_DS)
-    struct sigaltstack ss;
-        
-    if ((ss.ss_sp = malloc(SIGSTKSZ) ) == NULL) {
-        fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
-                SIGSTKSZ);
-        return FALSE;
-    }
-    ss.ss_size = SIGSTKSZ;
-    ss.ss_flags = 0;
-    if (sigaltstack(&ss, NULL) < 0) {
-        perror("sigstack");
-        return FALSE;
-    }
-#endif  /* __svr4__ || _SCO_DS */
+#endif  /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __svr4__ || _SCO_DS */
     
-    SIGNAL_SetHandler( SIGALRM, (void (*)())wine_timer, 1);
-    SIGNAL_SetHandler( SIGINT,  (void (*)())SIGNAL_break, 1);
     SIGNAL_SetHandler( SIGCHLD, (void (*)())SIGNAL_child, 1);
-    SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault, 1);
-    SIGNAL_SetHandler( SIGILL,  (void (*)())SIGNAL_fault, 1);
-    SIGNAL_SetHandler( SIGFPE,  (void (*)())SIGNAL_fault, 1);
-    SIGNAL_SetHandler( SIGTRAP, (void (*)())SIGNAL_trap, 1); 	/* debugger */
-    SIGNAL_SetHandler( SIGHUP,  (void (*)())SIGNAL_trap, 1); 	/* forced break */
-#ifdef SIGBUS
-    SIGNAL_SetHandler( SIGBUS,  (void (*)())SIGNAL_fault, 1);
-#endif
 #ifdef CONFIG_IPC
     SIGNAL_SetHandler( SIGUSR2, (void (*)())stop_wait, 1); 	/* For IPC */
 #endif
-#ifndef __EMX__ /* FIXME */
+#ifdef SIGIO
     SIGNAL_SetHandler( SIGIO,   (void (*)())WINSOCK_sigio, 0); 
 #endif
     return TRUE;
@@ -284,34 +170,13 @@
 
 
 /**********************************************************************
- *		SIGNAL_StartBIOSTimer
- *
- * Start the BIOS tick timer.
- */
-void SIGNAL_StartBIOSTimer(void)
-{
-#ifndef __EMX__ /* FIXME: Time don't work... Use BIOS directly instead */
-    struct itimerval vt_timer;
-    static int timer_started = 0;
-
-    if (timer_started) return;
-    timer_started = 1;
-    vt_timer.it_interval.tv_sec = 0;
-    vt_timer.it_interval.tv_usec = 54929;
-    vt_timer.it_value = vt_timer.it_interval;
-
-    setitimer(ITIMER_REAL, &vt_timer, NULL);
-#endif
-}
-
-/**********************************************************************
  *              SIGNAL_MaskAsyncEvents
  */
 void SIGNAL_MaskAsyncEvents( BOOL32 flag )
 {
   sigset_t 	set;
   sigemptyset(&set);
-#ifndef __EMX__ /* FIXME */
+#ifdef SIGIO
   sigaddset(&set, SIGIO);
 #endif
   sigaddset(&set, SIGUSR1);
@@ -320,5 +185,3 @@
 #endif
   sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &set, NULL);
 }
-
-#endif /* ifndef WINELIB */