Commit 401710d7 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 0.3.0

Fri Sep 3 11:52:18 1993 Bob Amstadt * [windows/timer.c] Changed to use CallWindowProc() rather directly calling callback. * [windows/event.c] Implemented SetCapture() and ReleaseCapture() * [windows/keyboard.c] Created stub for GetKeyState() * [objects/linedda.c] Created stub for LineDDA() * [if1632/callback.c] Created callback handler for LineDDA callback procedure. * [if1632/callback.c] Created FreeProcInstance() Fri Sep 3 08:36:52 1993 David Metcalfe * [loader/signal.c] Patch to and code for INT 1A Thu Sep 2 00:31:54 1993 Alexandre Julliard * [objects/font.c] [objects/text.c] More text support: implemented justification and underlining. * [windows/clipping.c] [objects/clipping.c] Moved low-level clipping functions to objects/clipping.c. * [windows/clipping.c] [windows/event.c] [windows/message.c] Implemented window update regions. * [windows/dc.c] [objects/dcvalues.c] Moved some device-independent DC functions to objects/dcvalues.c. * [windows/graphics.c] Implemented InvertRect() and GetPixel(). Sat Aug 28 08:40:23 1993 Eric Youngdale * [include/neexe.h] [loader/wine.c] Added code to handle relocation type 4. * [loader/signal.h] [loader/wine.c] [loader/selector.c] Added support for dos interrupts. Thu 26 Aug 19:15:00 1993 Eric Youngdale * [loader/selector.c] Fixed bug dealing with loading DLLs. Thu Aug 26 19:22:40 1993 Alexandre Julliard * [include/gdi.h] [objects/font.c] [windows/dc.c] Beginning of real font support. * [windows/graphics.c] Implemented PatBlt(). * [memory/global.c] Corrected a bug with linked list handling in GlobalAlloc(). * [objects/bitmap.c] Corrected a bug in BITMAP_SelectObject(). Tue Aug 24 19:22:40 1993 David Metcalfe * [controls/Command*] [controls/Label*] [controls[MenuButto*] [controls/SmeMenuButt*] Change code to support & as a special character in menu item text. Tue Aug 24 19:22:40 1993 Alexandre Julliard * [include/gdi.h] [windows/dc.c] Heavily modified the DC structure for better device-independence. * [objects/bitmap.c] Implemented bitmap dimensions. * [windows/dc.c] [windows/dce.c] Implemented DC state saving and restoring. * [windows/dc.c] Implemented ROP mode. * [windows/graphics.c] Implemented FillRect(). Mon Aug 23 22:08:34 1993 Bob Amstadt (bob at pooh) * [misc/xt.c] Fixed bug in InvalidateRect(). Solitaire attempted to clear window before it was realized. * [loader/resource.c] Began rewrite of LoadBitmap(). * [loader/wine.c] Fixed code which set Argv and Argc global variables. * [loader/selector.c] Added code to set up command line arguments. * [include/neexe.h] Fixed error in PSP structure. Tue Aug 17 20:41:12 1993 Alexandre Julliard * [include/gdi.h] [windows/dc.c] Implemented device capabilities. * [objects/region.c] Implemented EqualRgn() and CombineRgn(). * [windows/clipping.c] Implemented Save/RestoreVisRgn(). * [windows/graphics.c] Implemented PaintRgn() and FillRgn(). * [windows/mapping.c] Implemented mapping modes. Tue Aug 10 14:07:38 1993 Alexandre Julliard * [if1632/user.spec] [misc/rect.c] Implemented rectangle API functions. * [if1632/gdi.spec] [include/gdi.h] [objects/region.c] Implemented regions. * [windows/class.c] Corrected a typo in UnregisterClass(). * [windows/clipping.c] [windows/dc.c] Implemented DC clipping and visible region. Tue Aug 10 20:57:56 1993 Bob Amstadt (bob at pooh) * [controls/menu.c] [windows/win.c] SetMenu(), GetMenu(), CheckMenuItem() implemented Thu Aug 5 22:33:22 1993 Bob Amstadt (bob at pooh) * [controls/menu.c] [windows/win.c] Many improvements menus. LoadMenu() should work. Wed Aug 4 14:55:36 1993 Alexandre Julliard * [objects/dib.c] Started the implementation of device-independent bitmaps. * [objects/bitmap.c] Added support for multiple bitmap depths. * [objects/brush.c] Implemented pattern brushes. * [windows/dc.c] [windows/graphics.c] Implemented some GDI graphics primitives. Tue Aug 3 21:16:47 1993 Bob Amstadt (bob at pooh) * [controls/menu.c] [windows/win.c] [include/menu.h] Code to load class menus from executable file. * [if1632/user.spec] Fixed specification of SendMessage() and PostMessage. Mon Jul 26 21:53:24 1993 Alexandre Julliard * [if1632/call.S] Corrected a bug in KERNEL_InitTask(). * [include/windows.h] Added a lot of constants. * [loader/selector.c] Corrected a bug in segment allocation in CreateSelectors(). * [objects/bitmap.c] Implemented SelectObject() for bitmaps. * [objects/brush.c] Implemented hatched brushes and SelectObject(). * [objects/gdiobj.c] Removed linked list (not needed). * [objects/palette.c] Implemented system palette creation and misc. palette API functions. * [windows/timer.c] Implemented timers. * [windows/dc.c] Implemented memory device contexts. Tue Jul 20 10:38:59 1993 Bob Amstadt (bob at pooh) * [dos.c] Split DOS3Call() out of kernel.c. Added support for get date and time functions. * [call.S] Added function ReturnFromRegisterFunc() to allow DOS calls to return values in registers. * [regfunc.h] Macros to access registers saved on stack. Tue Jul 20 10:38:59 1993 Alexandre Julliard * [win.c] Corrected allocation of the WM_CREATE data structure. * [dce.c] [dce.h] Implemented DCE handling. * [bitmap.c] [brush.c] [dc.c] [font.c] [gdi.h] [gdi.spec] [gdiobj.c] [palette.c] [pen.c] Implemented the GDI objects data structures and allocation. * [windows.h] Added several structures and constants for GDI objects. Mon Jul 19 12:51:10 1993 Bob Amstadt (bob at pooh) * [ldtlib.c] Modified system calls to match Linus' new interface for the LDT modification. * [win.c] Fixed bug with WM_CREATE message. * [heap.c] [kernel.spec] Completed local heap allocation functions. * [global.c] Created function GlobalQuickAlloc() for easy allocation from DLLs
parent 75a839a0
This diff is collapsed. Click to expand it.
- EBP and ESP are sometimes corrupted while running 16-bit code.
Fri Sep 3 11:52:18 1993 Bob Amstadt
* [windows/timer.c]
Changed to use CallWindowProc() rather directly calling callback.
* [windows/event.c]
Implemented SetCapture() and ReleaseCapture()
* [windows/keyboard.c]
Created stub for GetKeyState()
* [objects/linedda.c]
Created stub for LineDDA()
* [if1632/callback.c]
Created callback handler for LineDDA callback procedure.
* [if1632/callback.c]
Created FreeProcInstance()
Fri Sep 3 08:36:52 1993 David Metcalfe
* [loader/signal.c]
Patch to and code for INT 1A
Thu Sep 2 00:31:54 1993 Alexandre Julliard
* [objects/font.c] [objects/text.c]
More text support: implemented justification and underlining.
* [windows/clipping.c] [objects/clipping.c]
Moved low-level clipping functions to objects/clipping.c.
* [windows/clipping.c] [windows/event.c] [windows/message.c]
Implemented window update regions.
* [windows/dc.c] [objects/dcvalues.c]
Moved some device-independent DC functions to objects/dcvalues.c.
* [windows/graphics.c]
Implemented InvertRect() and GetPixel().
Sat Aug 28 08:40:23 1993 Eric Youngdale
* [include/neexe.h] [loader/wine.c]
Added code to handle relocation type 4.
* [loader/signal.h] [loader/wine.c] [loader/selector.c]
Added support for dos interrupts.
Thu 26 Aug 19:15:00 1993 Eric Youngdale
* [loader/selector.c]
Fixed bug dealing with loading DLLs.
Thu Aug 26 19:22:40 1993 Alexandre Julliard
* [include/gdi.h] [objects/font.c] [windows/dc.c]
Beginning of real font support.
* [windows/graphics.c]
Implemented PatBlt().
* [memory/global.c]
Corrected a bug with linked list handling in GlobalAlloc().
* [objects/bitmap.c]
Corrected a bug in BITMAP_SelectObject().
Tue Aug 24 19:22:40 1993 David Metcalfe
* [controls/Command*] [controls/Label*] [controls[MenuButto*]
[controls/SmeMenuButt*]
Change code to support & as a special character in menu item text.
Tue Aug 24 19:22:40 1993 Alexandre Julliard
* [include/gdi.h] [windows/dc.c]
Heavily modified the DC structure for better device-independence.
* [objects/bitmap.c]
Implemented bitmap dimensions.
* [windows/dc.c] [windows/dce.c]
Implemented DC state saving and restoring.
* [windows/dc.c]
Implemented ROP mode.
* [windows/graphics.c]
Implemented FillRect().
Mon Aug 23 22:08:34 1993 Bob Amstadt (bob at pooh)
* [misc/xt.c]
Fixed bug in InvalidateRect(). Solitaire attempted to
clear window before it was realized.
* [loader/resource.c]
Began rewrite of LoadBitmap().
* [loader/wine.c]
Fixed code which set Argv and Argc global variables.
* [loader/selector.c]
Added code to set up command line arguments.
* [include/neexe.h]
Fixed error in PSP structure.
Tue Aug 17 20:41:12 1993 Alexandre Julliard
* [include/gdi.h] [windows/dc.c]
Implemented device capabilities.
* [objects/region.c]
Implemented EqualRgn() and CombineRgn().
* [windows/clipping.c]
Implemented Save/RestoreVisRgn().
* [windows/graphics.c]
Implemented PaintRgn() and FillRgn().
* [windows/mapping.c]
Implemented mapping modes.
Tue Aug 10 14:07:38 1993 Alexandre Julliard
* [if1632/user.spec] [misc/rect.c]
Implemented rectangle API functions.
* [if1632/gdi.spec] [include/gdi.h] [objects/region.c]
Implemented regions.
* [windows/class.c]
Corrected a typo in UnregisterClass().
* [windows/clipping.c] [windows/dc.c]
Implemented DC clipping and visible region.
Tue Aug 10 20:57:56 1993 Bob Amstadt (bob at pooh)
* [controls/menu.c] [windows/win.c]
SetMenu(), GetMenu(), CheckMenuItem() implemented
Thu Aug 5 22:33:22 1993 Bob Amstadt (bob at pooh)
* [controls/menu.c] [windows/win.c]
Many improvements menus. LoadMenu() should work.
Wed Aug 4 14:55:36 1993 Alexandre Julliard
* [objects/dib.c]
Started the implementation of device-independent bitmaps.
* [objects/bitmap.c]
Added support for multiple bitmap depths.
* [objects/brush.c]
Implemented pattern brushes.
* [windows/dc.c] [windows/graphics.c]
Implemented some GDI graphics primitives.
Tue Aug 3 21:16:47 1993 Bob Amstadt (bob at pooh)
* [controls/menu.c] [windows/win.c] [include/menu.h]
Code to load class menus from executable file.
* [if1632/user.spec]
Fixed specification of SendMessage() and PostMessage.
Mon Jul 26 21:53:24 1993 Alexandre Julliard
* [if1632/call.S]
Corrected a bug in KERNEL_InitTask().
* [include/windows.h]
Added a lot of constants.
* [loader/selector.c]
Corrected a bug in segment allocation in CreateSelectors().
* [objects/bitmap.c]
Implemented SelectObject() for bitmaps.
* [objects/brush.c]
Implemented hatched brushes and SelectObject().
* [objects/gdiobj.c]
Removed linked list (not needed).
* [objects/palette.c]
Implemented system palette creation and misc. palette API functions.
* [windows/timer.c]
Implemented timers.
* [windows/dc.c]
Implemented memory device contexts.
Tue Jul 20 10:38:59 1993 Bob Amstadt (bob at pooh)
* [dos.c]
Split DOS3Call() out of kernel.c. Added support for get date
and time functions.
* [call.S]
Added function ReturnFromRegisterFunc() to allow DOS calls
to return values in registers.
* [regfunc.h]
Macros to access registers saved on stack.
Tue Jul 20 10:38:59 1993 Alexandre Julliard
* [win.c]
Corrected allocation of the WM_CREATE data structure.
* [dce.c] [dce.h]
Implemented DCE handling.
* [bitmap.c] [brush.c] [dc.c] [font.c] [gdi.h] [gdi.spec]
[gdiobj.c] [palette.c] [pen.c]
Implemented the GDI objects data structures and allocation.
* [windows.h]
Added several structures and constants for GDI objects.
Mon Jul 19 12:51:10 1993 Bob Amstadt (bob at pooh)
* [ldtlib.c]
Modified system calls to match Linus' new interface for
the LDT modification.
* [win.c]
Fixed bug with WM_CREATE message.
* [heap.c] [kernel.spec]
Completed local heap allocation functions.
* [global.c]
Created function GlobalQuickAlloc() for easy allocation from DLLs
Tue Jul 13 20:31:31 1993 Bob Amstadt (bob at pooh)
* [global.c]
......
CFLAGS=-g -DDEBUG_RESOURCE -I./
######################################################################
# FILES:
#
# Be very careful if you change the order of the files listed
# here. if1632.o must linked first to guarrantee that it sits at a low
# enough address. I intend to change this requirement someday, but
# for now live with it.
#
DLL_LENGTH=256
BUILDOBJS=dll_kernel.o dll_user.o dll_gdi.o dll_unixlib.o \
dll_win87em.o dll_shell.o \
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o \
dll_win87em_tab.o dll_shell_tab.o
MUST_BE_LINKED_FIRST=if1632.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) \
callback.o dump.o global.o heap.o ldt.o kernel.o relay.o resource.o \
selector.o message.o user.o wine.o class.o win.o widgets.o event.o xt.o
# These variables are inherited by the sub-makefiles
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
######################################################################
# These definitions are for the top level
TARGET=wine
LIBS=-L. -L/usr/X386/lib -lldt -lXt -lX11
LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o
SUBDIRS=if1632 controls loader memory misc objects windows
all: $(TARGET)
clean:
rm -f *.o *~ *.s dll_* *.a
dummy:
ci:
ci Makefile README *.c *.h *.S build-spec.txt *.spec
clean:
rm -f *~ *.o
@for i in tools $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
$(TARGET): $(OBJS) libldt.a
$(TARGET): dummy
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && $(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) \
COPTS="$(COPTS)" DEBUGOPTS="$(DEBUGOPTS)") || exit; done
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
build: build.c
cc -g -o build build.c
libldt.a: ldtlib.c
$(CC) -O6 -c ldtlib.c
ar rcs libldt.a ldtlib.o
dll_kernel.S dll_kernel_tab.c: build kernel.spec
build kernel.spec
dll_user.S dll_user_tab.c: build user.spec
build user.spec
dll_gdi.S dll_gdi_tab.c: build gdi.spec
build gdi.spec
dll_unixlib.S dll_unixlib_tab.c: build unixlib.spec
build unixlib.spec
dll_win87em.S dll_win87em_tab.c: build win87em.spec
build win87em.spec
dll_shell.S dll_shell_tab.c: build shell.spec
build shell.spec
wintcl.o: wintcl.c windows.h
cc -c -I. -g wintcl.c
depend:
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && \
$(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) depend) \
|| exit; done
......@@ -2,10 +2,70 @@ Copyright Robert J. Amstadt, 1993. All code is provided without
warranty. It is my intent to cover this code with the Gnu Public
License.
So here goes release 0.2.0 of the Windows loader. It will do some
relocations and then run the program. I have successfully loaded
the Windows solitaire game. Try it. It currently stops a call to
GetObject().
INSTALLATION:
Uncompress and untar this archive into the directory of your
choice. This release requires a Linux version 0.99 pl12 kernel with
ALPHA-diffs and sognal-diffs. Apply ALPHA-diffs first, and then
signal-diffs.
To build Wine, first do a "make depend" and then a "make". The
executable "wine" will be built.
WHAT'S NEW with version 0.3.0: (see ChangeLog for details)
- Mouse capture
- Text justification and underlining
- Clipping
- LoadBitmap() completed
- Code generated by the Borland compiler should now work
WHAT'S NEW with version 0.2.8: (see ChangeLog for details)
- Text functions from Alexandre
- INT 21h from Eric
- Menu improvements from David
- Bug fixes and GetProcAddress() stub from me
WHAT'S NEW with version 0.2.7: (see ChangeLog for details)
- sol.exe gets further. I did some debugging and now solitaire
stops when it tries to call GetTextExtent(). Any volunteers?
- Many DC updates from Alexandre.
- Menu updates to support underlining characters from David Metcalfe.
WHAT'S NEW with version 0.2.6: (see ChangeLog for details)
- More region updates from Alexandre
WHAT'S NEW with version 0.2.5: (see ChangeLog for details)
- Regions implemented by Alexandre
- More menuing code from me
WHAT'S NEW with version 0.2.4: (see ChangeLog for details)
- Many improvements to GDI from Alexandre
- Many improvements to menu handling by me.
WHAT'S NEW with version 0.2.3: (see ChangeLog for details)
- Bug fixes with SendMessage() and PostMessage()
- Preliminary menu support
WHAT'S NEW with version 0.2.2: (see ChangeLog for details)
- Misc bug fixes
- More bitmap code
- Timers
- Memory DC's
WHAT'S NEW with version 0.2.1:
- I have placed things into sub-directories. The organization is
not finalized. I imagine that the directory structure will
change as is necessary. Files in the ./misc directory need
to be split apart and placed in apropriate directories.
- Tons of code from Alexandre. He has constructed the framework
for handling GDI objects. He has also provided code for DCEs.
- Local heap functions have been completed.
- Bug fixes in global.c and win.c
- New function GlobalQuickAlloc() combines GlobalAlloc() and
GlobalLock() into a single function call.
- New patch kit for Linux 0.99 pl11 kernel. Thanks to Linus
who has graciously included our patches into the ALPHA patch
release cycle.
WHAT'S NEW with version 0.2.0:
- Alexandre Julliard has provided a replacement for the Tcl code.
......@@ -76,33 +136,9 @@ TODO:
- GlobalAlloc of code segments.
- Rewrite global memory support including kernel mods to allow
application to mess with page map.
- complete and improve local heap allocation.
- Handle self-loading applications.
- Resource loading
INSTALLATION:
Uncompress and untar this archive into the directory of your
choice. The file "ldt.tar" contains a necessary kernel patch against
Linux 0.99.10. "ldt.tar" is unchanged from the version released
with release 0.0.2. In the directory /usr/src/linux (or whereever
you keep your kernel sources), untar this file it contains three files:
kernel/ldt.c
- This is source for a new system call.
include/linux/ldt.h
- This contains structures defining the system call
interface.
ldt.patch
- This is a patch that must be applied to the kernel.
It updates two header files, and the kernel Makefile.
Or follow the same procedure with "ldt512.tar". This file contains
Eric Youngdales patches for ALPHA-pl11. These patches give the
emulator 512 ldt entries instead of the 32 available with the older
patch kit.
- Lots and lots of API fiunctions.
BUILD:
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=menu.o widgets.o SmeMenuButto.o WinLabel.o WinCommand.o WinMenuButto.o
# WinButton.o
default: controls.o
controls.o: $(OBJS)
$(LD) -r -o controls.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
/*
* $XConsortium: SmeMenuButtP.h,v 1.6 89/12/11 15:20:15 kit Exp $
*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris D. Peterson, MIT X Consortium
*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*/
/*
* SmeP.h - Private definitions for Sme object
*
*/
#ifndef _XawSmeMenuButtP_h
#define _XawSmeMenuButtP_h
/***********************************************************************
*
* Sme Object Private Data
*
***********************************************************************/
#include <X11/Xaw/SmeP.h>
#include "SmeMenuButto.h"
/************************************************************
*
* New fields for the Sme Object class record.
*
************************************************************/
typedef struct _SmeMenuButtonClassPart {
XtPointer extension;
} SmeMenuButtonClassPart;
/* Full class record declaration */
typedef struct _SmeMenuButtonClassRec {
RectObjClassPart rect_class;
SmeClassPart sme_class;
SmeMenuButtonClassPart sme_bsb_class;
} SmeMenuButtonClassRec;
extern SmeMenuButtonClassRec smeMenuButtonClassRec;
/* New fields for the Sme Object record */
typedef struct {
/* resources */
String label; /* The entry label. */
int vert_space; /* extra vert space to leave, as a percentage
of the font height of the label. */
Pixmap left_bitmap, right_bitmap; /* bitmaps to show. */
Dimension left_margin, right_margin; /* left and right margins. */
Pixel foreground; /* foreground color. */
XFontStruct * font; /* The font to show label in. */
XtJustify justify; /* Justification for the label. */
String menu_name; /* Menu to activate */
Boolean inactive; /* True if can't be selected */
/* private resources. */
Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */
GC norm_gc; /* noral color gc. */
GC rev_gc; /* reverse color gc. */
GC norm_gray_gc; /* Normal color (grayed out) gc. */
GC invert_gc; /* gc for flipping colors. */
Dimension left_bitmap_width; /* size of each bitmap. */
Dimension left_bitmap_height;
Dimension right_bitmap_width;
Dimension right_bitmap_height;
int ul_pos; /* Offset in chars of underlined character */
/* in label */
} SmeMenuButtonPart;
/****************************************************************
*
* Full instance record declaration
*
****************************************************************/
typedef struct _SmeMenuButtonRec {
ObjectPart object;
RectObjPart rectangle;
SmePart sme;
SmeMenuButtonPart sme_bsb;
} SmeMenuButtonRec;
/************************************************************
*
* Private declarations.
*
************************************************************/
#endif /* _XawSmeMenuButtP_h */
/*
* $XConsortium: SmeMenuButton.h,v 1.5 89/12/11 15:20:14 kit Exp $
*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* SmeMenuButton.h - Public Header file for SmeMenuButton object.
*
* This is the public header file for the Athena BSB Sme object.
* It is intended to be used with the simple menu widget. This object
* provides bitmap - string - bitmap style entries.
*
* Date: April 3, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*/
#ifndef _SmeMenuButto_h
#define _SmeMenuButto_h
#include <X11/Xmu/Converters.h>
#include <X11/Xaw/Sme.h>
/****************************************************************
*
* SmeMenuButton object
*
****************************************************************/
/* BSB Menu Entry Resources:
Name Class RepType Default Value
---- ----- ------- -------------
callback Callback Callback NULL
destroyCallback Callback Pointer NULL
font Font XFontStruct * XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension 0
label Label String Name of entry
leftBitmap LeftBitmap Pixmap None
leftMargin HorizontalMargins Dimension 4
rightBitmap RightBitmap Pixmap None
rightMargin HorizontalMargins Dimension 4
sensitive Sensitive Boolean True
vertSpace VertSpace int 25
width Width Dimension 0
x Position Position 0n
y Position Position 0
menuName MenuName String "menu"
inactive Inactive Boolean False
*/
typedef struct _SmeMenuButtonClassRec *SmeMenuButtonObjectClass;
typedef struct _SmeMenuButtonRec *SmeMenuButtonObject;
extern WidgetClass smeMenuButtonObjectClass;
#define XtNleftBitmap "leftBitmap"
#define XtNleftMargin "leftMargin"
#define XtNrightBitmap "rightBitmap"
#define XtNrightMargin "rightMargin"
#define XtNvertSpace "vertSpace"
#define XtNmenuName "menuName"
#define XtNinactive "inactive"
#define XtCLeftBitmap "LeftBitmap"
#define XtCHorizontalMargins "HorizontalMargins"
#define XtCRightBitmap "RightBitmap"
#define XtCVertSpace "VertSpace"
#define XtCMenuName "MenuName"
#define XtCInactive "Inactive"
#endif /* _SmeMenuButto_h */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinCommand
*/
#ifndef _WinCommand_h
#define _WinCommand_h
#include "WinLabel.h"
/* Command widget resources:
Name Class RepType Default Value
---- ----- ------- -------------
accelerators Accelerators AcceleratorTable NULL
ancestorSensitive AncestorSensitive Boolean True
background Background Pixel XtDefaultBackground
backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
bitmap Pixmap Pixmap None
borderColor BorderColor Pixel XtDefaultForeground
borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
borderWidth BorderWidth Dimension 1
callback Callback XtCallbackList NULL
colormap Colormap Colormap parent's colormap
cornerRoundPercent CornerRoundPercent Dimension 25
cursor Cursor Cursor None
cursorName Cursor String NULL
depth Depth int parent's depth
destroyCallback Callback XtCallbackList NULL
encoding Encoding UnsignedChar XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 0 if shaped, else 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
screen Screen Screen parent's Screen
sensitive Sensitive Boolean True
shapeStyle ShapeStyle ShapeStyle Rectangle
translations Translations TranslationTable see doc or source
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNhighlightThickness "highlightThickness"
#define XtNshapeStyle "shapeStyle"
#define XtCShapeStyle "ShapeStyle"
#define XtRShapeStyle "ShapeStyle"
#define XtNcornerRoundPercent "cornerRoundPercent"
#define XtCCornerRoundPercent "CornerRoundPercent"
#define XawShapeRectangle XmuShapeRectangle
#define XawShapeOval XmuShapeOval
#define XawShapeEllipse XmuShapeEllipse
#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
extern WidgetClass winCommandWidgetClass;
typedef struct _WinCommandClassRec *WinCommandWidgetClass;
typedef struct _WinCommandRec *WinCommandWidget;
#endif /* _WinCommand_h */
/* DON'T ADD STUFF AFTER THIS */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Convrted to WinCommand
*/
/*
* WinCommandP.h - Private definitions for WinCommand widget
*
*/
#ifndef _WinCommandP_h
#define _WinCommandP_h
#include "WinCommand.h"
#include "WinLabelP.h"
/***********************************************************************
*
* WinCommand Widget Private Data
*
***********************************************************************/
typedef enum {
HighlightNone, /* Do not highlight. */
HighlightWhenUnset, /* Highlight only when unset, this is
to preserve current command widget
functionality. */
HighlightAlways /* Always highlight, lets the toggle widget
and other subclasses do the right thing. */
} XtCommandHighlight;
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinCommand widget class record */
typedef struct _WinCommandClass
{
int makes_compiler_happy; /* not used */
} WinCommandClassPart;
/* Full class record declaration */
typedef struct _WinCommandClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
WinCommandClassPart wincommand_class;
} WinCommandClassRec;
extern WinCommandClassRec winCommandClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinCommand widget record */
typedef struct {
/* resources */
Dimension highlight_thickness;
XtCallbackList callbacks;
/* private state */
Pixmap gray_pixmap;
GC normal_GC;
GC inverse_GC;
Boolean set;
XtCommandHighlight highlighted;
/* more resources */
int shape_style;
Dimension corner_round;
} WinCommandPart;
/* XtEventsPtr eventTable;*/
/* Full widget declaration */
typedef struct _WinCommandRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinCommandPart wincommand;
} WinCommandRec;
#endif /* _WinCommandP_h */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinLabel
*/
#ifndef _WinLabel_h
#define _WinLabel_h
/***********************************************************************
*
* WinLabel Widget
*
***********************************************************************/
#include <X11/Xaw/Simple.h>
/* Resources:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
bitmap Pixmap Pixmap None
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
cursor Cursor Cursor None
cursorName Cursor String NULL
destroyCallback Callback XtCallbackList NULL
encoding Encoding unsigned char XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
sensitive Sensitive Boolean True
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XawTextEncoding8bit 0
#define XawTextEncodingChar2b 1
#define XtNleftBitmap "leftBitmap"
#define XtCLeftBitmap "LeftBitmap"
#define XtNencoding "encoding"
#define XtCEncoding "Encoding"
#ifndef _XtStringDefs_h_
#define XtNbitmap "bitmap"
#define XtNforeground "foreground"
#define XtNlabel "label"
#define XtNfont "font"
#define XtNinternalWidth "internalWidth"
#define XtNinternalHeight "internalHeight"
#define XtNresize "resize"
#define XtCResize "Resize"
#define XtCBitmap "Bitmap"
#endif
/* Class record constants */
extern WidgetClass winLabelWidgetClass;
typedef struct _WinLabelClassRec *WinLabelWidgetClass;
typedef struct _WinLabelRec *WinLabelWidget;
#endif /* _WinLabel_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinLabel
*/
/*
* WinLabelP.h - Private definitions for WinLabel widget
*
*/
#ifndef _WinLabelP_h
#define _WinLabelP_h
/***********************************************************************
*
* WinLabel Widget Private Data
*
***********************************************************************/
#include "WinLabel.h"
#include <X11/Xaw/SimpleP.h>
/* New fields for the WinLabel widget class record */
typedef struct {int foo;} WinLabelClassPart;
/* Full class record declaration */
typedef struct _WinLabelClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
} WinLabelClassRec;
extern WinLabelClassRec winLabelClassRec;
/* New fields for the WinLabel widget record */
typedef struct {
/* resources */
Pixel foreground;
XFontStruct *font;
char *label;
XtJustify justify;
Dimension internal_width;
Dimension internal_height;
Pixmap pixmap;
Boolean resize;
unsigned char encoding;
Pixmap left_bitmap;
/* private state */
GC normal_GC;
GC gray_GC;
Pixmap stipple;
Position label_x;
Position label_y;
Dimension label_width;
Dimension label_height;
Dimension label_len;
int lbm_y; /* where in label */
unsigned int lbm_width, lbm_height; /* size of pixmap */
int ul_pos; /* Offset in chars of underlined character */
/* in label */
} WinLabelPart;
/****************************************************************
*
* Full instance record declaration
*
****************************************************************/
typedef struct _WinLabelRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
} WinLabelRec;
#define LEFT_OFFSET(lw) ((lw)->winlabel.left_bitmap \
? (lw)->winlabel.lbm_width + \
(lw)->winlabel.internal_width \
: 0)
#endif /* _WinLabelP_h */
/*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButtP.h - Private Header file for WinMenuButton widget.
*
* This is the private header file for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#ifndef _WinMenuButtonP_h
#define _WinMenuButtonP_h
#include "WinMenuButto.h"
#include "WinCommandP.h"
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinMenuButton widget class record */
typedef struct _WinMenuButtonClass
{
int makes_compiler_happy; /* not used */
} WinMenuButtonClassPart;
/* Full class record declaration */
typedef struct _WinMenuButtonClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winLabel_class;
WinCommandClassPart winCommand_class;
WinMenuButtonClassPart winMenuButton_class;
} WinMenuButtonClassRec;
extern WinMenuButtonClassRec winMenuButtonClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinMenuButton widget record */
typedef struct {
/* resources */
String menu_name;
} WinMenuButtonPart;
/* Full widget declaration */
typedef struct _WinMenuButtonRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinCommandPart wincommand;
WinMenuButtonPart winmenu_button;
} WinMenuButtonRec;
#endif /* _WinMenuButtonP_h */
/*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButto.c - Source code for WinMenuButton widget.
*
* This is the source code for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/XawInit.h>
#include "WinMenuButtP.h"
static void ClassInitialize();
static void PopupMenu();
#define superclass ((WinCommandWidgetClass)&winCommandClassRec)
static char defaultTranslations[] =
"<EnterWindow>: highlight() \n\
<LeaveWindow>: reset() \n\
<BtnDown>: reset() PopupMenu() ";
/****************************************************************
*
* Full class record constant
*
****************************************************************/
/* Private Data */
#define offset(field) XtOffsetOf(WinMenuButtonRec, field)
static XtResource resources[] = {
{
XtNmenuName, XtCMenuName, XtRString, sizeof(String),
offset(winmenu_button.menu_name), XtRString, (XtPointer)"menu"},
};
#undef offset
static XtActionsRec actionsList[] =
{
{"PopupMenu", PopupMenu}
};
WinMenuButtonClassRec winMenuButtonClassRec = {
{
(WidgetClass) superclass, /* superclass */
"WinMenuButton", /* class_name */
sizeof(WinMenuButtonRec), /* size */
ClassInitialize, /* class_initialize */
NULL, /* class_part_initialize */
FALSE, /* class_inited */
NULL, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
actionsList, /* actions */
XtNumber(actionsList), /* num_actions */
resources, /* resources */
XtNumber(resources), /* resource_count */
NULLQUARK, /* xrm_class */
FALSE, /* compress_motion */
TRUE, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
NULL, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
NULL, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
NULL, /* accept_focus */
XtVersion, /* version */
NULL, /* callback_private */
defaultTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display_accelerator */
NULL /* extension */
}, /* CoreClass fields initialization */
{
XtInheritChangeSensitive /* change_sensitive */
}, /* SimpleClass fields initialization */
{
0, /* field not used */
}, /* WinLabelClass fields initialization */
{
0, /* field not used */
}, /* WinCommandClass fields initialization */
{
0, /* field not used */
}, /* WinMenuButtonClass fields initialization */
};
/* for public consumption */
WidgetClass winMenuButtonWidgetClass = (WidgetClass) &winMenuButtonClassRec;
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static void ClassInitialize()
{
XawInitializeWidgetSet();
XtRegisterGrabAction(PopupMenu, True, ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync);
}
/* ARGSUSED */
static void
PopupMenu(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
WinMenuButtonWidget mbw = (WinMenuButtonWidget) w;
Widget menu, temp;
Arg arglist[2];
Cardinal num_args;
int menu_x, menu_y, menu_width, menu_height, button_height;
Position button_x, button_y;
temp = w;
while(temp != NULL) {
menu = XtNameToWidget(temp, mbw->winmenu_button.menu_name);
if (menu == NULL)
temp = XtParent(temp);
else
break;
}
if (menu == NULL) {
char error_buf[BUFSIZ];
sprintf(error_buf, "MenuButton: %s %s.",
"Could not find menu widget named", mbw->winmenu_button.menu_name);
XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
if (!XtIsRealized(menu))
XtRealizeWidget(menu);
menu_width = menu->core.width + 2 * menu->core.border_width;
button_height = w->core.height + 2 * w->core.border_width;
menu_height = menu->core.height + 2 * menu->core.border_width;
XtTranslateCoords(w, 0, 0, &button_x, &button_y);
menu_x = button_x;
menu_y = button_y + button_height;
if (menu_x >= 0) {
int scr_width = WidthOfScreen(XtScreen(menu));
if (menu_x + menu_width > scr_width)
menu_x = scr_width - menu_width;
}
if (menu_x < 0)
menu_x = 0;
if (menu_y >= 0) {
int scr_height = HeightOfScreen(XtScreen(menu));
if (menu_y + menu_height > scr_height)
menu_y = scr_height - menu_height;
}
if (menu_y < 0)
menu_y = 0;
num_args = 0;
XtSetArg(arglist[num_args], XtNx, menu_x); num_args++;
XtSetArg(arglist[num_args], XtNy, menu_y); num_args++;
XtSetValues(menu, arglist, num_args);
XtPopupSpringLoaded(menu);
}
/*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButton.h - Public Header file for WinMenuButton widget.
*
* This is the public header file for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#ifndef _WinMenuButton_h
#define _WinMenuButton_h
#include "WinCommand.h"
/* Resources:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
bitmap Pixmap Pixmap None
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
callback Callback Pointer NULL
cursor Cursor Cursor None
destroyCallback Callback Pointer NULL
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
mappedWhenManaged MappedWhenManaged Boolean True
menuName MenuName String "menu"
resize Resize Boolean True
sensitive Sensitive Boolean True
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNmenuName "menuName"
#define XtCMenuName "MenuName"
extern WidgetClass winMenuButtonWidgetClass;
typedef struct _WinMenuButtonClassRec *WinMenuButtonWidgetClass;
typedef struct _WinMenuButtonRec *WinMenuButtonWidget;
#endif /* _WinMenuButton_h -- DON'T ADD STUFF AFTER THIS */
This diff is collapsed. Click to expand it.
# $Id: gdi.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name gdi
id 3
length 490
27 pascal Rectangle(word word word word word) Rectangle(1 2 3 4 5)
82 pascal GetObject(word word ptr) RSC_GetObject(1 2 3)
87 pascal GetStockObject(word) GetStockObject(1)
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
BUILDOBJS=dll_kernel.o dll_user.o dll_gdi.o dll_unixlib.o \
dll_win87em.o dll_shell.o \
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o \
dll_win87em_tab.o dll_shell_tab.o
MUST_BE_LINKED_FIRST=call.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) callback.o relay.o
default: if1632.o
if1632.o: $(OBJS)
$(LD) -r -o if1632.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
dll_kernel.S dll_kernel_tab.c: ../tools/build kernel.spec
../tools/build kernel.spec
dll_user.S dll_user_tab.c: ../tools/build user.spec
../tools/build user.spec
dll_gdi.S dll_gdi_tab.c: ../tools/build gdi.spec
../tools/build gdi.spec
dll_unixlib.S dll_unixlib_tab.c: ../tools/build unixlib.spec
../tools/build unixlib.spec
dll_win87em.S dll_win87em_tab.c: ../tools/build win87em.spec
../tools/build win87em.spec
dll_shell.S dll_shell_tab.c: ../tools/build shell.spec
../tools/build shell.spec
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
......@@ -35,7 +35,7 @@ offset:
.word 0
.text
/**********************************************************************
* int CallToInit16(unsigned long csip, unsigned long sssp,
* unsigned short ds)
......@@ -93,6 +93,7 @@ _CallToInit16:
movl %eax,%esp
movw 14(%ebp),%ax
movw %ax,%ss
movl %esp,%eax
movl %eax,%ebp
/*
......@@ -100,7 +101,7 @@ _CallToInit16:
*/
.byte 0x66
lcall %fs:(%edx)
/*
* Restore old stack and segment registers.
*
......@@ -135,7 +136,7 @@ _CallToInit16:
.align 2,0x90
leave
ret
/**********************************************************************
* int CallTo16(unsigned long csip, unsigned short ds)
*
......@@ -180,7 +181,7 @@ _CallTo16:
movw %ax,%ds
.byte 0x66
lcall %fs:(%edx)
/*
* Restore old stack and segment registers.
*
......@@ -217,7 +218,7 @@ _CallTo16:
.align 2,0x90
leave
ret
/**********************************************************************
* CallTo32()
*
......@@ -276,7 +277,7 @@ _CallTo32:
pushw _IF1632_Saved16_esp
pushl %eax
call _DLLRelay
/*
* Restore registers, but do not destroy return value.
*/
......@@ -321,19 +322,14 @@ noargs:
.byte 0x66
lret
/**********************************************************************
* KERNEL_InitTask()
*
* This interface functions is special because it returns all
* of its values in registers. Thus we can't just fall back through
* the C functions that called us. Instead we simply abandon
* the 32-bit stack, set up the registers and return.
* ReturnFromRegisterFunc()
*/
.globl _KERNEL_InitTask
_KERNEL_InitTask:
.globl _ReturnFromRegisterFunc
_ReturnFromRegisterFunc:
/*
* Restore stack
* Restore 16-bit stack
*/
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
......@@ -349,32 +345,25 @@ _KERNEL_InitTask:
.align 2,0x90
leave
/*
* Now we need to ditch the parameter bytes that were left on the
* stack. We do this by effectively popping the number of bytes,
* and the return address, removing the parameters and then putting
* the return address back on the stack.
* Normally this field is filled in by the relevant function in
* the emulation library, since it should know how many bytes to
* expect.
* This leaves us with a stack that has number of arguments,
* the return address, the saved registers, and the return
* address again.
*/
popw %gs:nbytes
cmpw $0,%gs:nbytes
je noargs_2
popw %gs:offset
popw %gs:selector
addw %gs:nbytes,%esp
pushw %gs:selector
pushw %gs:offset
noargs_2:
popw %ax /* Throw away the number of arguments */
popl %eax /* Throw away first copy of return address */
popw %es
popw %ds
popw %di
popw %si
popw %bp
popw %ax /* Throw away pushed stack pointer */
popw %bx
popw %dx
popw %cx
popw %ax
/*
* Last, we need to load the return values.
* Return to original caller.
*/
movl $0,%esi
movw $1,%ax
movw %gs:_WIN_StackSize,%cx
movw $1,%dx
movw 0x80,%bx
.byte 0x66
lret
......@@ -109,6 +109,27 @@ CALLBACK_MakeProcInstance(void *func, int instance)
}
/**********************************************************************
* FreeProcInstance (KERNEL.52)
*/
void FreeProcInstance(FARPROC func)
{
int handle;
void *new_func;
struct thunk_s *tp;
int i;
tp = (struct thunk_s *) MakeProcThunks->base_addr;
for (i = 0; i < 0x10000 / sizeof(*tp); i++, tp++)
{
if ((void *) tp->thunk == (void *) func)
{
tp->used = 0;
break;
}
}
}
/**********************************************************************
* CallWindowProc (USER.122)
*/
LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
......@@ -126,3 +147,15 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
else
return WIDGETS_Call32WndProc( func, hwnd, message, wParam, lParam );
}
/**********************************************************************
* CallLineDDAProc
*/
void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
{
PushOn16( CALLBACK_SIZE_WORD, xPos );
PushOn16( CALLBACK_SIZE_WORD, yPos );
PushOn16( CALLBACK_SIZE_LONG, lParam );
CallTo16((unsigned int) func,
FindDataSegmentForCode((unsigned long) func));
}
#! /bin/sh
name="blah"
while [ "$name" != "" ]
do
echo -n 'Function: '
read name
grep -i $name *.spec
done
# $Id: gdi.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name gdi
id 3
length 490
1 pascal SetBkColor(word long) SetBkColor(1 2)
2 pascal SetBkMode(word word) SetBkMode(1 2)
3 pascal SetMapMode(word word) SetMapMode(1 2)
4 pascal SetROP2(word word) SetROP2(1 2)
5 pascal SetRelAbs(word word) SetRelAbs(1 2)
6 pascal SetPolyFillMode(word word) SetPolyFillMode(1 2)
7 pascal SetStretchBltMode(word word) SetStretchBltMode(1 2)
8 pascal SetTextCharacterExtra(word s_word) SetTextCharacterExtra(1 2)
9 pascal SetTextColor(word long) SetTextColor(1 2)
10 pascal SetTextJustification(word s_word s_word) SetTextJustification(1 2 3)
11 pascal SetWindowOrg(word s_word s_word) SetWindowOrg(1 2 3)
12 pascal SetWindowExt(word s_word s_word) SetWindowExt(1 2 3)
13 pascal SetViewportOrg(word s_word s_word) SetViewportOrg(1 2 3)
14 pascal SetViewportExt(word s_word s_word) SetViewportExt(1 2 3)
15 pascal OffsetWindowOrg(word s_word s_word) OffsetWindowOrg(1 2 3)
16 pascal ScaleWindowExt(word s_word s_word s_word s_word)
ScaleWindowExt(1 2 3 4 5)
17 pascal OffsetViewportOrg(word s_word s_word) OffsetViewportOrg(1 2 3)
18 pascal ScaleViewportExt(word s_word s_word s_word s_word)
ScaleViewportExt(1 2 3 4 5)
19 pascal LineTo(word s_word s_word) LineTo(1 2 3)
20 pascal MoveTo(word s_word s_word) MoveTo(1 2 3)
21 pascal ExcludeClipRect(word s_word s_word s_word s_word)
ExcludeClipRect(1 2 3 4 5)
22 pascal IntersectClipRect(word s_word s_word s_word s_word)
IntersectClipRect(1 2 3 4 5)
23 pascal Arc(word s_word s_word s_word s_word s_word s_word s_word s_word)
Arc(1 2 3 4 5 6 7 8 9)
24 pascal Ellipse(word s_word s_word s_word s_word) Ellipse(1 2 3 4 5)
26 pascal Pie(word s_word s_word s_word s_word s_word s_word s_word s_word)
Pie(1 2 3 4 5 6 7 8 9)
27 pascal Rectangle(word s_word s_word s_word s_word) Rectangle(1 2 3 4 5)
29 pascal PatBlt(word s_word s_word s_word s_word long) PatBlt(1 2 3 4 5 6)
30 pascal SaveDC(word) SaveDC(1)
31 pascal SetPixel(word s_word s_word long) SetPixel(1 2 3 4)
32 pascal OffsetClipRgn(word s_word s_word) OffsetClipRgn(1 2 3)
33 pascal TextOut(word s_word s_word ptr word) TextOut(1 2 3 4 5)
34 pascal BitBlt( word s_word s_word s_word s_word word s_word s_word long)
BitBlt(1 2 3 4 5 6 7 8 9)
39 pascal RestoreDC(word s_word) RestoreDC(1 2)
40 pascal FillRgn(word word word) FillRgn(1 2 3)
43 pascal PaintRgn(word word) PaintRgn(1 2)
44 pascal SelectClipRgn(word word) SelectClipRgn(1 2)
45 pascal SelectObject(word word) SelectObject(1 2)
47 pascal CombineRgn(word word word word) CombineRgn(1 2 3 4)
48 pascal CreateBitmap(word word word word ptr) CreateBitmap(1 2 3 4 5)
49 pascal CreateBitmapIndirect(ptr) CreateBitmapIndirect(1)
50 pascal CreateBrushIndirect(ptr) CreateBrushIndirect(1)
51 pascal CreateCompatibleBitmap(word word word) CreateCompatibleBitmap(1 2 3)
52 pascal CreateCompatibleDC(word) CreateCompatibleDC(1)
53 pascal CreateDC(ptr ptr ptr ptr) CreateDC(1 2 3 4)
54 pascal CreateEllipticRgn(s_word s_word s_word s_word)
CreateEllipticRgn(1 2 3 4)
55 pascal CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect(1)
56 pascal CreateFont(s_word s_word s_word s_word s_word word word word
word word word word word ptr)
CreateFont(1 2 3 4 5 6 7 8 9 10 11 12 13 14)
57 pascal CreateFontIndirect(ptr) CreateFontIndirect(1)
58 pascal CreateHatchBrush(word long) CreateHatchBrush(1 2)
60 pascal CreatePatternBrush(word) CreatePatternBrush(1)
61 pascal CreatePen(s_word s_word long) CreatePen(1 2 3)
62 pascal CreatePenIndirect(ptr) CreatePenIndirect(1)
63 pascal CreatePolygonRgn(ptr word word) CreatePolygonRgn(1 2 3)
64 pascal CreateRectRgn(s_word s_word s_word s_word) CreateRectRgn(1 2 3 4)
65 pascal CreateRectRgnIndirect(ptr) CreateRectRgnIndirect(1)
66 pascal CreateSolidBrush(long) CreateSolidBrush(1)
67 pascal DPtoLP(word ptr s_word) DPtoLP(1 2 3)
68 pascal DeleteDC(word) DeleteDC(1)
69 pascal DeleteObject(word) DeleteObject(1)
72 pascal EqualRgn(word word) EqualRgn(1 2)
73 pascal ExcludeVisRect(word s_word s_word s_word s_word)
ExcludeVisRect(1 2 3 4 5)
74 pascal GetBitmapBits(word long ptr) GetBitmapBits(1 2 3)
75 pascal GetBkColor(word) GetBkColor(1)
76 pascal GetBkMode(word) GetBkMode(1)
77 pascal GetClipBox(word ptr) GetClipBox(1 2)
78 pascal GetCurrentPosition(word) GetCurrentPosition(1)
79 pascal GetDCOrg(word) GetDCOrg(1)
80 pascal GetDeviceCaps(word s_word) GetDeviceCaps(1 2)
81 pascal GetMapMode(word) GetMapMode(1)
82 pascal GetObject(word word ptr) GetObject(1 2 3)
83 pascal GetPixel(word s_word s_word) GetPixel(1 2 3)
84 pascal GetPolyFillMode(word) GetPolyFillMode(1)
85 pascal GetROP2(word) GetROP2(1)
86 pascal GetRelAbs(word) GetRelAbs(1)
87 pascal GetStockObject(word) GetStockObject(1)
88 pascal GetStretchBltMode(word) GetStretchBltMode(1)
89 pascal GetTextCharacterExtra(word) GetTextCharacterExtra(1)
90 pascal GetTextColor(word) GetTextColor(1)
91 pascal GetTextExtent(word ptr s_word) GetTextExtent(1 2 3)
93 pascal GetTextMetrics(word ptr) GetTextMetrics(1 2)
94 pascal GetViewportExt(word) GetViewportExt(1)
95 pascal GetViewportOrg(word) GetViewportOrg(1)
96 pascal GetWindowExt(word) GetWindowExt(1)
97 pascal GetWindowOrg(word) GetWindowOrg(1)
98 pascal IntersectVisRect(word s_word s_word s_word s_word)
IntersectVisRect(1 2 3 4 5)
99 pascal LPtoDP(word ptr s_word) LPtoDP(1 2 3)
100 pascal LineDDA(s_word s_word s_word s_word ptr long)
LineDDA(1 2 3 4 5 6)
101 pascal OffsetRgn(word s_word s_word) OffsetRgn(1 2 3)
102 pascal OffsetVisRgn(word s_word s_word) OffsetVisRgn(1 2 3)
103 pascal PtVisible(word s_word s_word) PtVisible(1 2 3)
104 pascal RectVisibleOld(word ptr) RectVisible(1 2)
105 pascal SelectVisRgn(word word) SelectVisRgn(1 2)
106 pascal SetBitmapBits(word long ptr) SetBitmapBits(1 2 3)
117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3)
129 pascal SaveVisRgn(word) SaveVisRgn(1)
130 pascal RestoreVisRgn(word) RestoreVisRgn(1)
131 pascal InquireVisRgn(word) InquireVisRgn(1)
134 pascal GetRgnBox(word ptr) GetRgnBox(1 2)
148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg(1 2 3)
149 pascal GetBrushOrg(word) GetBrushOrg(1)
150 pascal UnrealizeObject(word) UnrealizeObject(1)
161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3)
162 pascal GetBitmapDimension(word) GetBitmapDimension(1)
163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension(1 2 3)
172 pascal SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5)
173 pascal GetClipRgn(word) GetClipRgn(1)
179 pascal GetDCState(word) GetDCState(1)
180 pascal SetDCState(word word) SetDCState(1 2)
181 pascal RectInRegionOld(word ptr) RectInRegion(1 2)
345 pascal GetTextAlign(word) GetTextAlign(1)
346 pascal SetTextAlign(word word) SetTextAlign(1 2)
348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
Chord(1 2 3 4 5 6 7 8 9)
360 pascal CreatePalette(ptr) CreatePalette(1)
363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
364 pascal SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4)
370 pascal GetNearestPaletteIndex(word long) GetNearestPaletteIndex(1 2)
411 pascal GetCurLogFont(word) GetCurLogFont(1)
440 pascal SetDIBits(word word word word ptr ptr word) SetDIBits(1 2 3 4 5 6 7)
441 pascal GetDIBits(word word word word ptr ptr word) GetDIBits(1 2 3 4 5 6 7)
442 pascal CreateDIBitmap(word ptr long ptr ptr word)
CreateDIBitmap(1 2 3 4 5 6)
444 pascal CreateRoundRectRgn(s_word s_word s_word s_word s_word s_word)
CreateRoundRectRgn(1 2 3 4 5 6)
445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
451 pascal CreatePolyPolygonRgn(ptr ptr word word)
CreatePolyPolygonRgn(1 2 3 4)
465 pascal RectVisible(word ptr) RectVisible(1 2)
466 pascal RectInRegion(word ptr) RectInRegion(1 2)
468 pascal GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx(1 2)
469 pascal GetBrushOrgEx(word ptr) GetBrushOrgEx(1 2)
470 pascal GetCurrentPositionEx(word ptr) GetCurrentPositionEx(1 2)
471 pascal GetTextExtentPoint(word ptr s_word ptr) GetTextExtentPoint(1 2 3 4)
472 pascal GetViewportExtEx(word ptr) GetViewportExtEx(1 2)
473 pascal GetViewportOrgEx(word ptr) GetViewportOrgEx(1 2)
474 pascal GetWindowExtEx(word ptr) GetWindowExtEx(1 2)
475 pascal GetWindowOrgEx(word ptr) GetWindowOrgEx(1 2)
476 pascal OffsetViewportOrgEx(word s_word s_word ptr)
OffsetViewportOrgEx(1 2 3 4)
477 pascal OffsetWindowOrgEx(word s_word s_word ptr) OffsetWindowOrgEx(1 2 3 4)
478 pascal SetBitmapDimensionEx(word s_word s_word ptr)
SetBitmapDimensionEx(1 2 3 4)
479 pascal SetViewportExtEx(word s_word s_word ptr) SetViewportExtEx(1 2 3 4)
480 pascal SetViewportOrgEx(word s_word s_word ptr) SetViewportOrgEx(1 2 3 4)
481 pascal SetWindowExtEx(word s_word s_word ptr) SetWindowExtEx(1 2 3 4)
482 pascal SetWindowOrgEx(word s_word s_word ptr) SetWindowOrgEx(1 2 3 4)
483 pascal MoveToEx(word s_word s_word ptr) MoveToEx(1 2 3 4)
484 pascal ScaleViewportExtEx(word s_word s_word s_word s_word ptr)
ScaleViewportExtEx(1 2 3 4 5 6)
485 pascal ScaleWindowExtEx(word s_word s_word s_word s_word ptr)
ScaleWindowExtEx(1 2 3 4 5 6)
......@@ -5,7 +5,17 @@ id 1
length 410
3 return GetVersion 0 0x301
5 pascal LocalAlloc(word word) HEAP_LocalAlloc(1 2)
4 pascal LocalInit(word word word) LocalInit(1 2 3)
5 pascal LocalAlloc(word word) LocalAlloc(1 2)
6 pascal LocalReAlloc(word word word) LocalReAlloc(1 2 3)
7 pascal LocalFree(word) LocalFree(1)
8 pascal LocalLock(word) LocalLock(1)
9 pascal LocalUnlock(word) LocalUnlock(1)
10 pascal LocalSize(word) LocalSize(1)
11 pascal LocalHandle(word) ReturnArg(1)
12 pascal LocalFlags(word) LocalFlags(1)
13 pascal LocalCompact(word) LocalCompact(1)
14 return LocalNotify 4 0
15 pascal GlobalAlloc(word long) GlobalAlloc(1 2)
16 pascal GlobalReAlloc(word long word) GlobalReAlloc(1 2 3)
17 pascal GlobalFree(word) GlobalFree(1)
......@@ -19,13 +29,22 @@ length 410
25 pascal GlobalCompact(long) GlobalCompact(1)
30 pascal WaitEvent(word) KERNEL_WaitEvent(1)
49 pascal GetModuleFileName(word ptr s_word) KERNEL_GetModuleFileName(1 2 3)
50 pascal GetProcAddress(word ptr) GetProcAddress(1 2)
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
91 pascal InitTask() KERNEL_InitTask()
52 pascal FreeProcInstance(ptr) FreeProcInstance(1)
91 register InitTask(word word word word word
word word word word word)
KERNEL_InitTask()
102 register DOS3Call(word word word word word
word word word word word)
KERNEL_DOS3Call(1 2 3 4 5 6 7 8 9 10)
KERNEL_DOS3Call()
111 pascal GlobalWire(word) GlobalLock(1)
112 pascal GlobalUnWire(word) GlobalUnlock(1)
121 return LocalShrink 4 0
127 pascal GetPrivateProfileInt(ptr ptr s_word ptr)
GetPrivateProfileInt(1 2 3 4)
128 pascal GetPrivateProfileString(ptr ptr ptr ptr s_word ptr)
GetPrivateProfileString(1 2 3 4 5 6)
131 pascal GetDOSEnvironment() GetDOSEnvironment()
132 return GetWinFlags 0 0x413
154 return GlobalNotify 4 0
......
......@@ -31,6 +31,10 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
unsigned short *Stack16Frame;
extern unsigned long IF1632_Saved16_esp;
extern unsigned long IF1632_Saved16_ebp;
extern unsigned short IF1632_Saved16_ss;
/**********************************************************************
* DLLRelay
*
......@@ -61,6 +65,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
void *arg_ptr;
int (*func_ptr)();
int i;
int ret_val;
/*
* Determine address of arguments.
......@@ -75,18 +80,35 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
ordinal = func_num & 0xffff;
dll_p = &dll_builtin_table[dll_id].dll_table[ordinal];
#ifdef RELAY_DEBUG
#ifdef DEBUG_RELAY
{
unsigned int *ret_addr;
unsigned short *stack_p;
ret_addr = (unsigned int *) ((char *) seg_off + 0x14);
printf("RELAY: Calling %s.%d, 16-bit stack at %04x:%04x, ",
printf("Calling %s (%s.%d), 16-bit stack at %04x:%04x, ",
dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal,
seg_off >> 16, seg_off & 0xffff);
printf("return to %08x\n", *ret_addr);
#ifdef STACK_DEBUG
printf(" ESP %08x, EBP %08x, SS %04x\n",
IF1632_Saved16_esp, IF1632_Saved16_ebp,
IF1632_Saved16_ss);
if (strcmp("GetMessage", dll_p->export_name) == 0 &&
seg_off == 0x00972526 &&
*ret_addr == 0x004700cd &&
IF1632_Saved16_esp == 0x2526 &&
IF1632_Saved16_ebp == 0x2534 &&
IF1632_Saved16_ss == 0x0097)
printf("ACK!!\n");
#if 0
IF1632_Saved16_esp &= 0x0000ffff;
IF1632_Saved16_ebp &= 0x0000ffff;
#endif
#ifdef DEBUG_STACK
stack_p = (unsigned short *) seg_off;
for (i = 0; i < 24; i++, stack_p++)
{
......@@ -95,9 +117,9 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
printf("\n");
}
printf("\n");
#endif /* STACK_DEBUG */
#endif /* DEBUG_STACK */
}
#endif /* RELAY_DEBUG */
#endif /* DEBUG_RELAY */
/*
* Make sure we have a handler defined for this call.
......@@ -155,12 +177,21 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
/*
* Call the handler
*/
return (*func_ptr)(arg_table[0], arg_table[1], arg_table[2],
arg_table[3], arg_table[4], arg_table[5],
arg_table[6], arg_table[7], arg_table[8],
arg_table[9], arg_table[10], arg_table[11],
arg_table[12], arg_table[13], arg_table[14],
arg_table[15]);
ret_val = (*func_ptr)(arg_table[0], arg_table[1], arg_table[2],
arg_table[3], arg_table[4], arg_table[5],
arg_table[6], arg_table[7], arg_table[8],
arg_table[9], arg_table[10], arg_table[11],
arg_table[12], arg_table[13], arg_table[14],
arg_table[15]);
#ifdef DEBUG_RELAY
printf("Returning %08.8x from %s (%s.%d)\n",
ret_val,
dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal);
#endif
return ret_val;
}
/**********************************************************************
......
......@@ -7,37 +7,79 @@ length 540
1 pascal MessageBox(word ptr ptr word) MessageBox(1 2 3 4)
5 pascal InitApp(word) USER_InitApp(1)
6 pascal PostQuitMessage(word) PostQuitMessage(1)
10 pascal SetTimer(word word word ptr) SetTimer(1 2 3 4)
11 pascal SetSystemTimer(word word word ptr) SetSystemTimer(1 2 3 4)
12 pascal KillTimer(word word) KillTimer(1 2)
13 pascal GetTickCount() GetTickCount()
14 return GetTimerResolution 0 1000
15 pascal GetCurrentTime() GetTickCount()
18 pascal SetCapture(word) SetCapture(1)
19 pascal ReleaseCapture() ReleaseCapture()
31 pascal IsIconic(word) IsIconic(1)
33 pascal GetClientRect(word ptr) GetClientRect(1 2)
39 pascal BeginPaint(word ptr) BeginPaint(1 2)
40 pascal EndPaint(word ptr) EndPaint(1 2)
41 pascal CreateWindow(ptr ptr long word word word word word word word ptr)
41 pascal CreateWindow(ptr ptr long s_word s_word s_word s_word word word word ptr)
CreateWindow(1 2 3 4 5 6 7 8 9 10 11)
42 pascal ShowWindow(word word) ShowWindow(1 2)
53 pascal DestroyWindow(word) DestroyWindow(1)
57 pascal RegisterClass(ptr) RegisterClass(1)
66 pascal GetDC(word) GetDC(1)
68 pascal ReleaseDC(word word) ReleaseDC(1 2)
72 pascal SetRect(ptr s_word s_word s_word s_word) SetRect(1 2 3 4 5)
73 pascal SetRectEmpty(ptr) SetRectEmpty(1)
74 pascal CopyRect(ptr ptr) CopyRect(1 2)
75 pascal IsRectEmpty(ptr) IsRectEmpty(1)
76 pascal PtInRect(ptr long) PtInRect(1 2)
77 pascal OffsetRect(ptr s_word s_word) OffsetRect(1 2 3)
78 pascal InflateRect(ptr s_word s_word) InflateRect(1 2 3)
79 pascal IntersectRect(ptr ptr ptr) IntersectRect(1 2 3)
80 pascal UnionRect(ptr ptr ptr) UnionRect(1 2 3)
81 pascal FillRect(word ptr word) FillRect(1 2 3)
82 pascal InvertRect(word ptr) InvertRect(1 2)
85 pascal DrawText(word ptr s_word ptr word) DrawText(1 2 3 4 5)
102 pascal AdjustWindowRect(ptr long word) AdjustWindowRect(1 2 3)
104 pascal MessageBeep(word) MessageBeep(1)
106 pascal GetKeyState(word) GetKeyState(1)
107 pascal DefWindowProc(word word word long) DefWindowProc(1 2 3 4)
108 pascal GetMessage(ptr word word word) GetMessage(1 2 3 4)
109 pascal PeekMessage(ptr word word word word) PeekMessage(1 2 3 4 5)
110 pascal PostMessage(word word word word) PostMessage(1 2 3 4)
111 pascal SendMessage(word word word word) SendMessage(1 2 3 4)
110 pascal PostMessage(word word word long) PostMessage(1 2 3 4)
111 pascal SendMessage(word word word long) SendMessage(1 2 3 4)
113 pascal TranslateMessage(ptr) TranslateMessage(1)
114 pascal DispatchMessage(ptr) DispatchMessage(1)
118 pascal RegisterWindowMessage(ptr) RegisterWindowMessage(1)
119 pascal GetMessagePos() GetMessagePos()
120 pascal GetMessageTime() GetMessageTime()
124 pascal UpdateWindow(word) UpdateWindow(1)
125 pascal InvalidateRect(word ptr word) InvalidateRect(1 2 3)
126 pascal InvalidateRgn(word word word) InvalidateRgn(1 2 3)
127 pascal ValidateRect(word ptr) ValidateRect(1 2)
128 pascal ValidateRgn(word word) ValidateRgn(1 2)
129 pascal GetClassWord(word s_word) GetClassWord(1 2)
130 pascal SetClassWord(word s_word word) SetClassWord(1 2 3)
131 pascal GetClassLong(word s_word) GetClassLong(1 2)
132 pascal SetClassLong(word s_word long) SetClassLong(1 2 3)
150 pascal LoadMenu(word ptr) LoadMenu(1 2)
151 pascal CreateMenu() CreateMenu()
154 pascal CheckMenu(word word word) CheckMenu(1 2 3)
157 pascal GetMenu(word) GetMenu(1)
158 pascal SetMenu(word word) SetMenu(1 2)
173 pascal LoadCursor(word ptr) RSC_LoadCursor(1 2)
174 pascal LoadIcon(word ptr) RSC_LoadIcon(1 2)
175 pascal LoadBitmap(word ptr) RSC_LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) RSC_LoadString(1 2 3 4)
173 pascal LoadCursor(word ptr) LoadCursor(1 2)
174 pascal LoadIcon(word ptr) LoadIcon(1 2)
175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) LoadString(1 2 3 4)
179 pascal GetSystemMetrics(word) GetSystemMetrics(1)
182 pascal KillSystemTimer(word word) KillSystemTimer(1 2)
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
237 pascal GetUpdateRgn(word word word) GetUpdateRgn(1 2 3)
244 pascal EqualRect(ptr ptr) EqualRect(1 2)
266 pascal SetMessageQueue(word) SetMessageQueue(1)
288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
334 pascal GetQueueStatus(word) GetQueueStatus(1)
335 pascal GetInputState() GetInputState()
373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
#define check_bitmap_width 10
#define check_bitmap_height 10
#define check_bitmap_x_hot 0
#define check_bitmap_y_hot 0
static char check_bitmap_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0x01, 0xc0, 0x00,
0x63, 0x00, 0x36, 0x00, 0x1c, 0x00, 0x08, 0x00};
#define nocheck_bitmap_width 10
#define nocheck_bitmap_height 10
#define nocheck_bitmap_x_hot 0
#define nocheck_bitmap_y_hot 0
static char nocheck_bitmap_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
......@@ -11,6 +11,7 @@
#define CLASS_MAGIC 0x4b4e /* 'NK' */
/* !! Don't change this structure (see GetClassLong()) */
typedef struct tagCLASS
{
HCLASS hNext; /* Next class */
......@@ -23,9 +24,6 @@ typedef struct tagCLASS
} CLASS;
/* The caller must GlobalUnlock the pointer returned
* by these functions (except when NULL).
*/
HCLASS CLASS_FindClassByName( char * name, CLASS **ptr );
CLASS * CLASS_FindClassPtr( HCLASS hclass );
......
/*
* USER DCE definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef DCE_H
#define DCE_H
#include "windows.h"
typedef struct tagDCE
{
HANDLE hNext;
HWND hwndCurrent;
HDC hdc;
BYTE flags;
BOOL inUse;
WORD xOrigin;
WORD yOrigin;
} DCE;
#endif /* DCE_H */
/*
* GDI definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef GDI_H
#define GDI_H
#include <X11/Intrinsic.h>
#include "windows.h"
#include "segmem.h"
#include "heap.h"
/* GDI objects magic numbers */
#define PEN_MAGIC 0x4f47
#define BRUSH_MAGIC 0x4f48
#define FONT_MAGIC 0x4f49
#define PALETTE_MAGIC 0x4f4a
#define BITMAP_MAGIC 0x4f4b
#define REGION_MAGIC 0x4f4c
#define DC_MAGIC 0x4f4d
#define DISABLED_DC_MAGIC 0x4f4e
#define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51
typedef struct tagREGION
{
WORD type;
RECT box;
Pixmap pixmap;
} REGION;
typedef struct tagGDIOBJHDR
{
HANDLE hNext;
WORD wMagic;
DWORD dwCount;
WORD wMetaList;
} GDIOBJHDR;
typedef struct tagBRUSHOBJ
{
GDIOBJHDR header;
LOGBRUSH logbrush __attribute__ ((packed));
} BRUSHOBJ;
typedef struct tagPENOBJ
{
GDIOBJHDR header;
LOGPEN logpen __attribute__ ((packed));
} PENOBJ;
typedef struct tagPALETTEOBJ
{
GDIOBJHDR header;
LOGPALETTE logpalette __attribute__ ((packed));
} PALETTEOBJ;
typedef struct tagFONTOBJ
{
GDIOBJHDR header;
LOGFONT logfont __attribute__ ((packed));
} FONTOBJ;
typedef struct tagBITMAPOBJ
{
GDIOBJHDR header;
HANDLE hBitmap;
BOOL bSelected;
HDC hdc;
SIZE size;
} BITMAPOBJ;
typedef struct tagRGNOBJ
{
GDIOBJHDR header;
REGION region;
} RGNOBJ;
typedef struct
{
WORD version; /* 0: driver version */
WORD technology; /* 2: device technology */
WORD horzSize; /* 4: width of display in mm */
WORD vertSize; /* 6: height of display in mm */
WORD horzRes; /* 8: width of display in pixels */
WORD vertRes; /* 10: width of display in pixels */
WORD bitsPixel; /* 12: bits per pixel */
WORD planes; /* 14: color planes */
WORD numBrushes; /* 16: device-specific brushes */
WORD numPens; /* 18: device-specific pens */
WORD numMarkers; /* 20: device-specific markers */
WORD numFonts; /* 22: device-specific fonts */
WORD numColors; /* 24: size of color table */
WORD pdeviceSize; /* 26: size of PDEVICE structure */
WORD curveCaps; /* 28: curve capabilities */
WORD lineCaps; /* 30: line capabilities */
WORD polygonalCaps; /* 32: polygon capabilities */
WORD textCaps; /* 34: text capabilities */
WORD clipCaps; /* 36: clipping capabilities */
WORD rasterCaps; /* 38: raster capabilities */
WORD aspectX; /* 40: relative width of device pixel */
WORD aspectY; /* 42: relative height of device pixel */
WORD aspectXY; /* 44: relative diagonal width of device pixel */
WORD pad1[21]; /* 46-86: reserved */
WORD logPixelsX; /* 88: pixels / logical X inch */
WORD logPixelsY; /* 90: pixels / logical Y inch */
WORD pad2[6]; /* 92-102: reserved */
WORD sizePalette; /* 104: entries in system palette */
WORD numReserved; /* 106: reserved entries */
WORD colorRes; /* 108: color resolution */
} DeviceCaps;
/* Device independent DC information */
typedef struct
{
int flags;
DeviceCaps *devCaps;
HANDLE hMetaFile;
HRGN hClipRgn; /* Clip region */
HRGN hVisRgn; /* Visible region */
HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
HPEN hPen;
HBRUSH hBrush;
HFONT hFont;
HBITMAP hBitmap;
HANDLE hDevice;
HPALETTE hPalette;
WORD ROPmode;
WORD polyFillMode;
WORD stretchBltMode;
WORD relAbsMode;
WORD backgroundMode;
COLORREF backgroundColor;
COLORREF textColor;
int backgroundPixel;
int textPixel;
short brushOrgX;
short brushOrgY;
WORD textAlign; /* Text alignment from SetTextAlign() */
short charExtra; /* Spacing from SetTextCharacterExtra() */
short breakTotalExtra; /* Total extra space for justification */
short breakCount; /* Break char. count */
short breakExtra; /* breakTotalExtra / breakCount */
short breakRem; /* breakTotalExtra % breakCount */
BYTE planes;
BYTE bitsPerPixel;
WORD MapMode;
short DCOrgX; /* DC origin */
short DCOrgY;
short CursPosX; /* Current position */
short CursPosY;
short WndOrgX;
short WndOrgY;
short WndExtX;
short WndExtY;
short VportOrgX;
short VportOrgY;
short VportExtX;
short VportExtY;
} WIN_DC_INFO;
/* X physical pen */
typedef struct
{
int style;
int pixel;
int width;
} X_PHYSPEN;
/* X physical brush */
typedef struct
{
int style;
int fillStyle;
int pixel;
Pixmap pixmap;
} X_PHYSBRUSH;
/* X physical font */
typedef struct
{
XFontStruct * fstruct;
TEXTMETRIC metrics;
} X_PHYSFONT;
/* X-specific DC information */
typedef struct
{
GC gc; /* X Window GC */
Drawable drawable;
Widget widget;
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
} X_DC_INFO;
typedef struct tagDC
{
GDIOBJHDR header;
WORD saveLevel;
WIN_DC_INFO w;
union
{
X_DC_INFO x;
/* other devices (e.g. printer) */
} u;
} DC;
/* DC flags */
#define DC_MEMORY 1 /* It is a memory DC */
#define DC_SAVED 2 /* It is a saved DC */
/* Last 32 bytes are reserved for stock object handles */
#define GDI_HEAP_SIZE 0xffe0
/* First handle possible for stock objects (must be >= GDI_HEAP_SIZE) */
#define FIRST_STOCK_HANDLE GDI_HEAP_SIZE
/* Stock objects handles */
#define STOCK_WHITE_BRUSH (FIRST_STOCK_HANDLE + WHITE_BRUSH)
#define STOCK_LTGRAY_BRUSH (FIRST_STOCK_HANDLE + LTGRAY_BRUSH)
#define STOCK_GRAY_BRUSH (FIRST_STOCK_HANDLE + GRAY_BRUSH)
#define STOCK_DKGRAY_BRUSH (FIRST_STOCK_HANDLE + DKGRAY_BRUSH)
#define STOCK_BLACK_BRUSH (FIRST_STOCK_HANDLE + BLACK_BRUSH)
#define STOCK_NULL_BRUSH (FIRST_STOCK_HANDLE + NULL_BRUSH)
#define STOCK_HOLLOW_BRUSH (FIRST_STOCK_HANDLE + HOLLOW_BRUSH)
#define STOCK_WHITE_PEN (FIRST_STOCK_HANDLE + WHITE_PEN)
#define STOCK_BLACK_PEN (FIRST_STOCK_HANDLE + BLACK_PEN)
#define STOCK_NULL_PEN (FIRST_STOCK_HANDLE + NULL_PEN)
#define STOCK_OEM_FIXED_FONT (FIRST_STOCK_HANDLE + OEM_FIXED_FONT)
#define STOCK_ANSI_FIXED_FONT (FIRST_STOCK_HANDLE + ANSI_FIXED_FONT)
#define STOCK_ANSI_VAR_FONT (FIRST_STOCK_HANDLE + ANSI_VAR_FONT)
#define STOCK_SYSTEM_FONT (FIRST_STOCK_HANDLE + SYSTEM_FONT)
#define STOCK_DEVICE_DEFAULT_FONT (FIRST_STOCK_HANDLE + DEVICE_DEFAULT_FONT)
#define STOCK_DEFAULT_PALETTE (FIRST_STOCK_HANDLE + DEFAULT_PALETTE)
#define STOCK_SYSTEM_FIXED_FONT (FIRST_STOCK_HANDLE + SYSTEM_FIXED_FONT)
#define NB_STOCK_OBJECTS (SYSTEM_FIXED_FONT + 1)
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
#define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT
/* Device <-> logical coords conversion */
#define XDPTOLP(dc,x) \
(((x)-(dc)->w.VportOrgX) * (dc)->w.WndExtX / (dc)->w.VportExtX+(dc)->w.WndOrgX)
#define YDPTOLP(dc,y) \
(((y)-(dc)->w.VportOrgY) * (dc)->w.WndExtY / (dc)->w.VportExtY+(dc)->w.WndOrgY)
#define XLPTODP(dc,x) \
(((x)-(dc)->w.WndOrgX) * (dc)->w.VportExtX / (dc)->w.WndExtX+(dc)->w.VportOrgX)
#define YLPTODP(dc,y) \
(((y)-(dc)->w.WndOrgY) * (dc)->w.VportExtY / (dc)->w.WndExtY+(dc)->w.VportOrgY)
/* GDI local heap */
extern MDESC *GDI_Heap;
#define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff)
#define GDI_HEAP_ADDR(handle) ((void *)(handle | ((int)GDI_Heap & 0xffff0000)))
#define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle)))
extern HANDLE GDI_AllocObject( WORD, WORD );
extern BOOL GDI_FreeObject( HANDLE );
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern Display * XT_display;
extern Screen * XT_screen;
#endif /* GDI_H */
......@@ -9,13 +9,18 @@
typedef struct heap_mem_desc_s
{
struct heap_mem_desc_s *prev, *next;
int length;
unsigned short length;
unsigned char lock;
unsigned char flags;
} MDESC;
extern void HEAP_Init(MDESC **free_list, void *start, int length);
extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
extern void HEAP_Free(MDESC **free_list, void *block);
extern int HEAP_Free(MDESC **free_list, void *block);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags);
extern void *GlobalQuickAlloc(int size);
extern unsigned int GlobalHandleFromPointer(void *block);
#endif /* HEAP_H */
/* $Id$
*
* Menu definitions
*/
#ifndef MENU_H
#define MENU_H
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Box.h>
#include "windows.h"
typedef struct tagMENUITEM
{
struct tagMENUITEM *next;
struct tagMENUITEM *prev;
struct tagMENUITEM *child;
struct tagMENUITEM *parent;
WORD item_flags;
WORD item_id;
char *item_text;
Widget w;
Widget menu_w;
char menu_name[10];
} MENUITEM;
typedef struct tagMENUBAR
{
struct tagMENUBAR *next;
HANDLE menuDescription; /* Memory containing menu desc. */
HWND ownerWnd; /* Owner window */
int nItems; /* Number of items on menu */
Widget parentWidget; /* Parent of menu widget */
Widget menuBarWidget; /* Widget to contain menu options */
MENUITEM *firstItem;
} MENUBAR, *LPMENUBAR;
typedef struct
{
WORD version; /* Should be zero */
WORD reserved; /* Must be zero */
} MENU_HEADER;
typedef struct
{
WORD item_flags; /* See windows.h */
char item_text[1]; /* Text for menu item */
} MENU_POPUPITEM;
typedef struct
{
WORD item_flags; /* See windows.h */
WORD item_id; /* Control Id for menu item */
char item_text[1]; /* Text for menu item */
} MENU_NORMALITEM;
extern LPMENUBAR MENU_CreateMenuBar(Widget parent, HANDLE instance,
HWND wnd, char *menu_name, int width);
extern LPMENUBAR MENU_UseMenu(Widget parent, HANDLE instance,
HWND wnd, HMENU hmenu, int width);
#endif /* MENU_H */
......@@ -133,7 +133,9 @@ struct relocation_entry_s
#define NE_RELTYPE_ORDINAL 1
#define NE_RELTYPE_NAME 2
#define NE_RELTYPE_OSFIXUP 3
/* Used by Windows 3.0 programs, like when getting selector to be
given to makeprocinst */
#define NE_RELTYPE_INT1 4
/*
* DOS PSP
*/
......@@ -151,6 +153,7 @@ struct dos_psp_s
unsigned short pspReserved3[23];
unsigned char pspFCB_1[16];
unsigned char pspFCB_2[16];
unsigned char pspReserved4[4];
unsigned char pspCommandTailCount;
unsigned char pspCommandTail[128];
};
......
/* $Id$
*/
#ifndef REGFUNC_H
#define REGFUNC_H
extern unsigned short *Stack16Frame;
#define _AX Stack16Frame[21]
#define _BX Stack16Frame[18]
#define _CX Stack16Frame[20]
#define _DX Stack16Frame[19]
#define _SP Stack16Frame[17]
#define _BP Stack16Frame[16]
#define _SI Stack16Frame[15]
#define _DI Stack16Frame[14]
#define _DS Stack16Frame[13]
#define _ES Stack16Frame[12]
extern void ReturnFromRegisterFunc(void);
#endif /* REGFUNC_H */
/*
* USER definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef USER_H
#define USER_H
#include "segmem.h"
#include "heap.h"
/* USER local heap */
extern MDESC *USER_Heap;
#define USER_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&USER_Heap,f,size) & 0xffff)
#define USER_HEAP_ADDR(handle) ((void *)(handle|((int)USER_Heap & 0xffff0000)))
#define USER_HEAP_FREE(handle) (HEAP_Free(&USER_Heap,USER_HEAP_ADDR(handle)))
#endif /* USER_H */
......@@ -12,7 +12,7 @@
#include <X11/Core.h>
#include "windows.h"
#include "menu.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */
......@@ -35,11 +35,17 @@ typedef struct tagWND
HANDLE hDCE; /* Window DC Entry (if CS_OWNDC) */
HMENU hmenuSystem; /* System menu */
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
WORD flags; /* Misc. flags */
Widget shellWidget; /* For top-level windows */
Widget winWidget; /* For all windows */
Widget compositeWidget;/* For top-level windows */
LPMENUBAR menuBarPtr; /* Menu bar */
WORD wExtra[1]; /* Window extra bytes */
} WND;
/* WND flags values */
#define WIN_ERASE_UPDATERGN 1 /* Update region needs erasing */
/* The caller must GlobalUnlock the pointer returned
* by this function (except when NULL).
......
File deleted
File deleted
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=dump.o ldt.o ldtlib.o resource.o selector.o signal.o wine.o
default: loader.o
loader.o: $(OBJS)
$(LD) -r -o loader.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
......@@ -8,12 +8,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <linux/head.h>
#include <linux/ldt.h>
_syscall2(int, modify_ldt, int, func, void *, ptr)
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)
int
get_ldt(void *buffer)
{
return modify_ldt(0, buffer);
return modify_ldt(0, buffer, 32 * sizeof(struct modify_ldt_ldt_s));
}
int
......@@ -31,5 +31,5 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
ldt_info.read_exec_only = read_only_flag;
ldt_info.limit_in_pages = limit_in_pages_flag;
return modify_ldt(1, &ldt_info);
return modify_ldt(1, &ldt_info, sizeof(ldt_info));
}
static char RCSId[] = "$Id: resource.c,v 1.4 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "prototypes.h"
#include "neexe.h"
#include "windows.h"
#include "gdi.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
/**********************************************************************
* ConvertCoreBitmap
*/
HBITMAP
ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image )
{
BITMAPINFO * bmpInfo;
HBITMAP hbitmap;
char * bits;
int i, size, n_colors;
n_colors = 1 << image->bcBitCount;
if (image->bcBitCount < 24)
{
size = sizeof(BITMAPINFOHEADER) + n_colors * sizeof(RGBQUAD);
bits = (char *) (image + 1) + (n_colors * sizeof(RGBTRIPLE));
}
else
{
size = sizeof(BITMAPINFOHEADER);
bits = (char *) (image + 1);
}
bmpInfo = (BITMAPINFO *) malloc( size );
bmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfo->bmiHeader.biWidth = image->bcWidth;
bmpInfo->bmiHeader.biHeight = image->bcHeight;
bmpInfo->bmiHeader.biPlanes = image->bcPlanes;
bmpInfo->bmiHeader.biBitCount = image->bcBitCount;
bmpInfo->bmiHeader.biCompression = 0;
bmpInfo->bmiHeader.biSizeImage = 0;
bmpInfo->bmiHeader.biXPelsPerMeter = 0;
bmpInfo->bmiHeader.biYPelsPerMeter = 0;
bmpInfo->bmiHeader.biClrUsed = 0;
bmpInfo->bmiHeader.biClrImportant = 0;
if (image->bcBitCount < 24)
{
RGBTRIPLE * oldMap = (RGBTRIPLE *)(image + 1);
RGBQUAD * newMap = bmpInfo->bmiColors;
for (i = 0; i < n_colors; i++, oldMap++, newMap++)
{
newMap->rgbRed = oldMap->rgbtRed;
newMap->rgbGreen = oldMap->rgbtGreen;
newMap->rgbBlue = oldMap->rgbtBlue;
newMap->rgbReserved = 0;
}
}
hbitmap = CreateDIBitmap( hdc, &bmpInfo->bmiHeader, CBM_INIT,
bits, bmpInfo, DIB_RGB_COLORS );
free( bmpInfo );
return hbitmap;
}
/**********************************************************************
* ConvertInfoBitmap
*/
HBITMAP
ConvertInfoBitmap( HDC hdc, BITMAPINFO * image )
{
char * bits = ((char *)image) + DIB_BitmapInfoSize(image, DIB_RGB_COLORS);
return CreateDIBitmap( hdc, &image->bmiHeader, CBM_INIT,
bits, image, DIB_RGB_COLORS );
}
/**********************************************************************
* FindResourceByNumber
*/
int
FindResourceByNumber(struct resource_nameinfo_s *result_p,
int type_id, int resource_id)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
int i;
/*
* Move to beginning of resource table.
*/
lseek(CurrentNEFile, (CurrentMZHeader->ne_offset +
CurrentNEHeader->resource_tab_offset), SEEK_SET);
/*
* Read block size.
*/
if (read(CurrentNEFile, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
return -1;
}
/*
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
if (read(CurrentNEFile, &typeinfo, sizeof(typeinfo)) !=
sizeof(typeinfo))
{
return -1;
}
if (typeinfo.type_id != 0)
{
for (i = 0; i < typeinfo.count; i++)
{
if (read(CurrentNEFile, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
return -1;
}
#if defined(DEBUG_RESOURCE) && defined(VERBOSE_DEBUG)
if (type_id == typeinfo.type_id)
{
printf("FindResource: type id = %d, resource id = %x\n",
type_id, nameinfo.id);
}
#endif
if ((type_id == -1 || typeinfo.type_id == type_id) &&
nameinfo.id == resource_id)
{
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
}
return -1;
}
/**********************************************************************
* FindResourceByName
*/
int
FindResourceByName(struct resource_nameinfo_s *result_p,
int type_id, char *resource_name)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
off_t old_pos, new_pos;
unsigned char nbytes;
char name[256];
int i;
/*
* Move to beginning of resource table.
*/
lseek(CurrentNEFile, (CurrentMZHeader->ne_offset +
CurrentNEHeader->resource_tab_offset), SEEK_SET);
/*
* Read block size.
*/
if (read(CurrentNEFile, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
return -1;
}
/*
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
if (read(CurrentNEFile, &typeinfo, sizeof(typeinfo)) !=
sizeof(typeinfo))
{
return -1;
}
if (typeinfo.type_id == type_id || type_id == -1)
{
for (i = 0; i < typeinfo.count; i++)
{
if (read(CurrentNEFile, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
return -1;
}
if (nameinfo.id & 0x8000)
continue;
old_pos = lseek(CurrentNEFile, 0, SEEK_CUR);
new_pos = (CurrentMZHeader->ne_offset +
CurrentNEHeader->resource_tab_offset +
nameinfo.id);
lseek(CurrentNEFile, new_pos, SEEK_SET);
read(CurrentNEFile, &nbytes, 1);
read(CurrentNEFile, name, nbytes);
lseek(CurrentNEFile, old_pos, SEEK_SET);
name[nbytes] = '\0';
if (strcasecmp(name, resource_name) == 0)
{
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
}
return -1;
}
/**********************************************************************
* LoadString
*/
int
LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
{
struct resource_nameinfo_s nameinfo;
unsigned short target_id;
unsigned char string_length;
int size_shift;
int string_num;
int i;
#ifdef DEBUG_RESOURCE
printf("LoadString: instance = %04x, id = %d, "
"buffer = %08x, length = %d\n",
instance, resource_id, buffer, buflen);
#endif
/*
* Find string entry.
*/
target_id = (resource_id >> 4) + 0x8001;
string_num = resource_id & 0x000f;
size_shift = FindResourceByNumber(&nameinfo, NE_RSCTYPE_STRING, target_id);
if (size_shift == -1)
return 0;
lseek(CurrentNEFile, (int) nameinfo.offset << size_shift, SEEK_SET);
for (i = 0; i < string_num; i++)
{
read(CurrentNEFile, &string_length, 1);
lseek(CurrentNEFile, string_length, SEEK_CUR);
}
read(CurrentNEFile, &string_length, 1);
i = MIN(string_length, buflen - 1);
read(CurrentNEFile, buffer, i);
buffer[i] = '\0';
#ifdef DEBUG_RESOURCE
printf(" '%s'\n", buffer);
#endif
return i;
}
/**********************************************************************
* LoadIcon
*/
HICON
LoadIcon(HANDLE instance, LPSTR icon_name)
{
return 0;
}
/**********************************************************************
* LoadCursor
*/
HCURSOR
LoadCursor(HANDLE instance, LPSTR cursor_name)
{
return 0;
}
/**********************************************************************
* RSC_LoadResource
*/
HANDLE
RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
{
struct resource_nameinfo_s nameinfo;
HANDLE hmem;
void *image;
int image_size;
int size_shift;
/*
* Built-in resources
*/
if (instance == 0)
{
return 0;
}
/*
* Get resource by ordinal
*/
else if (((int) rsc_name & 0xffff0000) == 0)
{
size_shift = FindResourceByNumber(&nameinfo, type,
(int) rsc_name | 0x8000);
}
/*
* Get resource by name
*/
else
{
size_shift = FindResourceByName(&nameinfo, type, rsc_name);
}
if (size_shift == -1)
return 0;
/*
* Read resource.
*/
lseek(CurrentNEFile, ((int) nameinfo.offset << size_shift), SEEK_SET);
image_size = nameinfo.length << size_shift;
if (image_size_ret != NULL)
*image_size_ret = image_size;
hmem = GlobalAlloc(GMEM_MOVEABLE, image_size);
image = GlobalLock(hmem);
if (image == NULL || read(CurrentNEFile, image, image_size) != image_size)
{
GlobalFree(hmem);
return 0;
}
GlobalUnlock(hmem);
return hmem;
}
/**********************************************************************
* RSC_LoadMenu
*/
HANDLE
RSC_LoadMenu(HANDLE instance, LPSTR menu_name)
{
return RSC_LoadResource(instance, menu_name, NE_RSCTYPE_MENU, NULL);
}
/**********************************************************************
* LoadBitmap
*/
HBITMAP
LoadBitmap(HANDLE instance, LPSTR bmp_name)
{
HBITMAP hbitmap;
HANDLE rsc_mem;
HDC hdc;
long *lp;
int image_size;
#ifdef DEBUG_RESOURCE
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
#endif
if (!(hdc = GetDC( 0 ))) return 0;
rsc_mem = RSC_LoadResource(instance, bmp_name, NE_RSCTYPE_BITMAP,
&image_size);
lp = (long *) GlobalLock(rsc_mem);
if (lp == NULL)
{
GlobalFree(rsc_mem);
return 0;
}
if (*lp == sizeof(BITMAPCOREHEADER))
hbitmap = ConvertCoreBitmap( hdc, (BITMAPCOREHEADER *) lp );
else if (*lp == sizeof(BITMAPINFOHEADER))
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
else hbitmap = 0;
GlobalFree(rsc_mem);
ReleaseDC( 0, hdc );
return hbitmap;
}
......@@ -27,10 +27,13 @@ unsigned short PSPSelector;
unsigned char ran_out = 0;
unsigned short SelectorOwners[MAX_SELECTORS];
static int next_unused_selector = 0;
static int next_unused_selector = 8;
extern void KERNEL_Ordinal_102();
extern void UNIXLIB_Ordinal_0();
extern char **Argv;
extern int Argc;
/**********************************************************************
* GetNextSegment
*/
......@@ -142,7 +145,12 @@ unsigned int GetEntryDLLOrdinal(char * dll_name, int ordinal, int * sel,
j = GetEntryPointFromOrdinal(wpnt, ordinal);
*addr = j & 0xffff;
j = j >> 16;
#if 0
/* This seems like it would never work */
*sel = wpnt->selector_table[j].selector;
#else
*sel = j; /* Is there any reason this will ever fail?? */
#endif
return 0;
};
return 1;
......@@ -322,6 +330,8 @@ CreatePSP(FILE *zfile)
unsigned short *usp;
int sel_idx;
struct segment_descriptor_s * s;
char *p1, *p2;
int i;
s = (struct segment_descriptor_s *)
malloc(sizeof(struct segment_descriptor_s));
......@@ -355,9 +365,22 @@ CreatePSP(FILE *zfile)
psp->pspCritErrorVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspCritErrorVector[1] = 0x0023;
psp->pspEnvironment = EnvironmentSelector->selector;
psp->pspCommandTailCount = 1;
strcpy(psp->pspCommandTail, "\r");
p1 = psp->pspCommandTail;
for (i = 1; i < Argc; i++)
{
if ((int) ((int) p1 - (int) psp->pspCommandTail) +
strlen(Argv[i]) > 124)
break;
for (p2 = Argv[i]; *p2 != '\0'; )
*p1++ = *p2++;
*p1++ = ' ';
}
*p1++ = '\r';
*p1 = '\0';
psp->pspCommandTailCount = strlen(psp->pspCommandTail);
/*
* Create entry in LDT for this segment.
......@@ -387,7 +410,7 @@ CreateSelectors(struct w_files * wpnt)
int i;
int status;
FILE * zfile;
int old_length;
int old_length, file_image_length;
/*
* Allocate memory for the table to keep track of all selectors.
......@@ -433,7 +456,9 @@ CreateSelectors(struct w_files * wpnt)
/*
* Image in file, let's just point to the image in memory.
*/
s->length = seg_table[i].seg_data_length;
s->length = seg_table[i].min_alloc;
file_image_length = seg_table[i].seg_data_length;
if (file_image_length == 0) file_image_length = 0x10000;
}
if (s->length == 0)
......@@ -484,13 +509,13 @@ CreateSelectors(struct w_files * wpnt)
*/
status = lseek(fd, seg_table[i].seg_data_offset *
(1 << ne_header->align_shift_count), SEEK_SET);
if(read(fd, s->base_addr, old_length) != old_length)
if(read(fd, s->base_addr, file_image_length) != file_image_length)
myerror("Unable to read segment from file");
}
/*
* Create entry in LDT for this segment.
*/
if (set_ldt_entry(i, (unsigned long) s->base_addr,
if (set_ldt_entry(s->selector >> 3, (unsigned long) s->base_addr,
(s->length - 1) & 0xffff, 0,
contents, read_only, 0) < 0)
{
......
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <syscall.h>
#include <signal.h>
#include <errno.h>
#include <linux/sched.h>
#include <asm/system.h>
extern void ___sig_restore();
extern void ___masksig_restore();
/* Similar to the sigaction function in libc, except it leaves alone the
restorer field */
static int
wine_sigaction(int sig,struct sigaction * new, struct 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;
}
char * cstack[4096];
struct sigaction segv_act;
struct sigcontext_struct {
unsigned short gs, __gsh;
unsigned short fs, __fsh;
unsigned short es, __esh;
unsigned short ds, __dsh;
unsigned long edi;
unsigned long esi;
unsigned long ebp;
unsigned long esp;
unsigned long ebx;
unsigned long edx;
unsigned long ecx;
unsigned long eax;
unsigned long trapno;
unsigned long err;
unsigned long eip;
unsigned short cs, __csh;
unsigned long eflags;
unsigned long esp_at_signal;
unsigned short ss, __ssh;
unsigned long i387;
unsigned long oldmask;
unsigned long cr2;
};
static void
GetTimeDate(int time_flag, struct sigcontext_struct * context)
{
struct tm *now;
time_t ltime;
ltime = time(NULL);
now = localtime(&ltime);
if (time_flag)
{
context->ecx = (now->tm_hour << 8) | now->tm_min;
context->edx = now->tm_sec << 8;
}
else
{
context->ecx = now->tm_year + 1900;
context->edx = ((now->tm_mon + 1) << 8) | now->tm_mday;
context->eax &= 0xff00;
context->eax |= now->tm_wday;
}
}
/* We handle all int21 calls here. There is some duplicate code from
misc/dos.c that I am unsure how to deal with, since the locations
that we store the registers are all different */
static int
do_int21(struct sigcontext_struct * context){
fprintf(stderr,"Doing int21 %x ", (context->eax >> 8) & 0xff);
switch((context->eax >> 8) & 0xff){
case 0x30:
context->eax = 0x0303; /* Hey folks, this is DOS V3.3! */
context->ebx = 0;
context->ecx = 0;
break;
/* Ignore any attempt to set a segment vector */
case 0x25:
return 1;
case 0x35: /* Return a NULL segment selector - this will bomb
if anyone ever tries to use it */
context->es = 0;
context->ebx = 0;
break;
case 0x2a:
GetTimeDate(0, context);
/* Function does not return */
case 0x2c:
GetTimeDate(1, context);
/* Function does not return */
case 0x4c:
exit(context->eax & 0xff);
default:
fprintf(stderr,"Unable to handle int 0x21 %x\n", context->eax);
return 1;
};
return 1;
}
static int
do_int1A(struct sigcontext_struct * context){
time_t ltime;
int ticks;
switch((context->eax >> 8) & 0xff){
case 0:
ltime = time(NULL);
ticks = (int) (ltime * HZ);
context->ecx = ticks >> 16;
context->edx = ticks & 0x0000FFFF;
context->eax = 0; /* No midnight rollover */
break;
default:
fprintf(stderr,"Unable to handle int 0x1A %x\n", context->eax);
return 1;
};
return 1;
}
static void win_segfault(int signal, struct sigcontext_struct context){
unsigned char * instr;
unsigned char intno;
unsigned int * dump;
int i;
/* First take care of a few preliminaries */
if(signal != SIGSEGV) exit(1);
if((context.cs & 7) != 7){
fprintf(stderr,
"Segmentation fault in Wine program (%x:%x)."
" Please debug\n",
context.cs, context.eip);
goto oops;
};
/* Now take a look at the actual instruction where the program
bombed */
instr = (char *) ((context.cs << 16) | (context.eip & 0xffff));
if(*instr != 0xcd) {
fprintf(stderr,
"Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
#if 0
return;
#else
goto oops;
#endif
};
instr++;
intno = *instr;
switch(intno){
case 0x21:
if(!do_int21(&context)) goto oops;
break;
case 0x1A:
if(!do_int1A(&context)) goto oops;
break;
default:
fprintf(stderr,"Unexpected Windows interrupt %x\n", intno);
goto oops;
};
/* OK, done handling the interrupt */
context.eip += 2; /* Bypass the int instruction */
return;
oops:
fprintf(stderr,"In win_segfault %x:%x\n", context.cs, context.eip);
fprintf(stderr,"Stack: %x:%x\n", context.ss, context.esp_at_signal);
dump = (int*) &context;
for(i=0; i<22; i++)
{
fprintf(stderr," %8.8x", *dump++);
if ((i % 8) == 7)
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
exit(1);
}
int
init_wine_signals(){
segv_act.sa_handler = (__sighandler_t) win_segfault;
/* Point to the top of the stack, minus 4 just in case, and make
it aligned */
segv_act.sa_restorer =
(void (*)()) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL);
}
......@@ -18,6 +18,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "dlls.h"
#include "wine.h"
#include "windows.h"
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
......@@ -52,13 +53,10 @@ DebugPrintString(char *str)
void
myerror(const char *s)
{
char buffer[200];
sprintf(buffer, "%s", Argv[0]);
if (s == NULL)
perror(buffer);
perror("wine");
else
fprintf(stderr, "%s: %s\n", buffer, s);
fprintf(stderr, "wine: %s\n", s);
exit(1);
}
......@@ -229,8 +227,8 @@ _WinMain(int argc, char **argv)
int i;
int rv;
Argc = argc;
Argv = argv;
Argc = argc - 1;
Argv = argv + 1;
if (argc < 2)
{
......@@ -272,6 +270,8 @@ _WinMain(int argc, char **argv)
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
init_wine_signals();
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
......@@ -452,6 +452,7 @@ FixupSegment(struct w_files * wpnt, int segment_num)
break;
case NE_RELTYPE_INTERNAL:
case NE_RELTYPE_INT1:
if (rep->target1 == 0x00ff)
{
address = GetEntryPointFromOrdinal(wpnt, rep->target2);
......@@ -549,3 +550,16 @@ FixupSegment(struct w_files * wpnt, int segment_num)
free(rep1);
return 0;
}
/**********************************************************************
* GetProcAddress
*/
FARPROC GetProcAddress(HINSTANCE hinstance, char *proc_name)
{
if ((int) proc_name & 0xffff0000)
printf("GetProcAddress: %#04x, '%s'\n", hinstance, proc_name);
else
printf("GetProcAddress: %#04x, %d\n", hinstance, (int) proc_name);
return NULL;
}
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=global.o heap.o
default: memory.o
memory.o: $(OBJS)
$(LD) -r -o memory.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
......@@ -220,6 +220,7 @@ GlobalAlloc(unsigned int flags, unsigned long size)
g->addr = m;
g->length = size;
g->next = g_prev->next;
if (g->next) g->next->prev = g;
g->lock_count = 0;
g_prev->next = g;
......@@ -274,7 +275,7 @@ GlobalFree(unsigned int block)
*/
if (g->sequence == 0)
{
HEAP_Free((MDESC **) (block & 0xffff0000), (void *) block);
HEAP_Free((MDESC **) ((int) g->addr & 0xffff0000), (void *) g->addr);
g->prev->next = g->next;
......@@ -677,3 +678,46 @@ GlobalReAlloc(unsigned int block, unsigned int new_size, unsigned int flags)
*/
return 0;
}
/**********************************************************************
* GlobalQuickAlloc
*/
void *
GlobalQuickAlloc(int size)
{
unsigned int hmem;
hmem = GlobalAlloc(GLOBAL_FLAGS_MOVEABLE, size);
if (hmem == 0)
return NULL;
else
return GlobalLock(hmem);
}
/**********************************************************************
* GlobalHandleFromPointer
*/
unsigned int
GlobalHandleFromPointer(void *block)
{
GDESC *g;
if (block == NULL)
return 0;
/*
* Find GDESC for this block.
*/
for (g = GlobalList; g != NULL; g = g->next)
if (g->handle > 0 && g->addr == block)
break;
if (g == NULL)
return 0;
else
return g->handle;
}
......@@ -61,6 +61,8 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->prev = m;
m->next = m;
m->lock = 0;
m->flags = 0;
if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
......@@ -82,6 +84,8 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->prev = m;
m->next = m;
m->lock = 0;
m->flags = 0;
if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
......@@ -103,14 +107,76 @@ void *
HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags)
{
return 0;
MDESC *m_free;
MDESC *m;
/*
* Check validity of block
*/
m = (MDESC *) old_block - 1;
if (m->prev != m || m->next != m ||
((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000))
{
#ifdef DEBUG_HEAP
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list);
#endif
return NULL;
}
/*
* Check for grow block
*/
if (new_size > m->length)
{
m_free = m + 1 + m->length / sizeof(MDESC);
if (m_free->next != m_free ||
m_free->prev != m_free ||
m_free->length + sizeof(MDESC) < new_size)
{
void *new_p = HEAP_Alloc(free_list, flags, new_size);
if (new_p ==NULL)
return NULL;
memcpy(new_p, old_block, m->length);
HEAP_Free(free_list, old_block);
return new_p;
}
if (m_free->prev == NULL)
*free_list = m_free->next;
else
m_free->prev->next = m_free->next;
if (m_free->next != NULL)
m_free->next->prev = m_free->prev;
m->length += sizeof(MDESC) + m_free->length;
if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m_free, '\0', sizeof(MDESC) + m_free->length);
}
/*
* Check for shrink block.
*/
if (new_size < m->length - 4 * sizeof(MDESC))
{
m_free = m + new_size / sizeof(MDESC) + 2;
m_free->next = m_free;
m_free->prev = m_free;
m_free->length = m->length - (int) m_free - (int) m;
m->length = (int) m_free - (int) (m + 1);
HEAP_Free(free_list, m_free + 1);
}
return old_block;
}
/**********************************************************************
* HEAP_Free
*/
void
int
HEAP_Free(MDESC **free_list, void *block)
{
MDESC *m_free;
......@@ -129,7 +195,7 @@ HEAP_Free(MDESC **free_list, void *block)
"m_free = %08x, *free_list = %08x\n",
m_free, free_list);
#endif
return;
return -1;
}
/*
......@@ -146,7 +212,7 @@ HEAP_Free(MDESC **free_list, void *block)
"m_free = %08x, m_prev = %08x (length %x)\n",
m_free, m_prev, m_prev->length);
#endif
return;
return -1;
}
if ((m != NULL && (int) m_free + m_free->length > (int) m) ||
......@@ -157,7 +223,7 @@ HEAP_Free(MDESC **free_list, void *block)
"m_free = %08x (length %x), m = %08x\n",
m_free, m_free->length, m);
#endif
return;
return -1;
}
/*
......@@ -203,6 +269,8 @@ HEAP_Free(MDESC **free_list, void *block)
{
m_free->next = NULL;
}
return 0;
}
/**********************************************************************
......@@ -215,10 +283,10 @@ HEAP_LocalInit(void *start, int length)
}
/**********************************************************************
* HEAP_LocalAlloc
* LocalAlloc
*/
void *
HEAP_LocalAlloc(int flags, int bytes)
LocalAlloc(int flags, int bytes)
{
void *m;
......@@ -235,10 +303,10 @@ HEAP_LocalAlloc(int flags, int bytes)
}
/**********************************************************************
* HEAP_LocalCompact
* LocalCompact
*/
int
HEAP_LocalCompact(int min_free)
LocalCompact(int min_free)
{
MDESC *m;
int max_block;
......@@ -250,3 +318,113 @@ HEAP_LocalCompact(int min_free)
return max_block;
}
/**********************************************************************
* LocalFlags
*/
unsigned int
LocalFlags(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
return m->lock;
}
/**********************************************************************
* LocalFree
*/
unsigned int
LocalFree(unsigned int handle)
{
unsigned int addr;
addr = ((int) LOCAL_FreeList & 0xffff0000) | (handle & 0xffff);
if (HEAP_Free(&LOCAL_FreeList, (void *) addr) < 0)
return handle;
else
return 0;
}
/**********************************************************************
* LocalInit
*/
unsigned int
LocalInit(unsigned int segment, unsigned int start, unsigned int end)
{
HEAP_Init(&LOCAL_FreeList,
(void *) ((segment << 16) | start), end - start + 1);
return segment;
}
/**********************************************************************
* LocalLock
*/
void *
LocalLock(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
m->lock++;
return (void *) (m + 1);
}
/**********************************************************************
* LocalReAlloc
*/
void *
LocalReAlloc(unsigned int handle, int flags, int bytes)
{
void *m;
m = HEAP_ReAlloc(&LOCAL_FreeList, (void *)
(((int) LOCAL_FreeList & 0xffff0000) | (handle & 0xffff)),
bytes, flags);
return m;
}
/**********************************************************************
* LocalSize
*/
unsigned int
LocalSize(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
return m->length;
}
/**********************************************************************
* LocalUnlock
*/
unsigned int
LocalUnlock(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 1;
if (m->lock > 0)
m->lock--;
return 0;
}
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=dos.o kernel.o user.o xt.o rect.o
default: misc.o
misc.o: $(OBJS)
$(LD) -r -o misc.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
static char RCSId[] = "$Id$";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "prototypes.h"
#include "regfunc.h"
static void
GetTimeDate(int time_flag)
{
struct tm *now;
time_t ltime;
ltime = time(NULL);
now = localtime(&ltime);
if (time_flag)
{
_CX = (now->tm_hour << 8) | now->tm_min;
_DX = now->tm_sec << 8;
}
else
{
_CX = now->tm_year + 1900;
_DX = ((now->tm_mon + 1) << 8) | now->tm_mday;
_AX &= 0xff00;
_AX |= now->tm_wday;
}
#ifdef DEBUG_DOS
printf("GetTimeDate: AX = %04x, CX = %04x, DX = %04x\n", _AX, _CX, _DX);
#endif
ReturnFromRegisterFunc();
/* Function does not return */
}
/**********************************************************************
* KERNEL_DOS3Call
*/
int
KERNEL_DOS3Call()
{
switch ((_AX >> 8) & 0xff)
{
case 0x30:
_AX = 0x0303;
ReturnFromRegisterFunc();
/* Function does not return */
case 0x25:
case 0x35:
return 0;
case 0x2a:
GetTimeDate(0);
/* Function does not return */
case 0x2c:
GetTimeDate(1);
/* Function does not return */
case 0x4c:
exit(_AX & 0xff);
default:
fprintf(stderr, "DOS: AX %04x, BX %04x, CX %04x, DX %04x\n",
_AX, _BX, _CX, _DX);
fprintf(stderr, " SP %04x, BP %04x, SI %04x, DI %04x\n",
_SP, _BP, _SI, _DI);
fprintf(stderr, " DS %04x, ES %04x\n",
_DS, _ES);
}
return 0;
}
......@@ -4,8 +4,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "prototypes.h"
#include "regfunc.h"
extern unsigned short *Stack16Frame;
extern unsigned short WIN_StackSize;
/**********************************************************************
* KERNEL_LockSegment
......@@ -40,6 +41,20 @@ KERNEL_UnlockSegment(int segment)
}
/**********************************************************************
* KERNEL_InitTask
*/
KERNEL_InitTask()
{
_BX = 0x81;
_AX = 1;
_CX = WIN_StackSize;
_DX = 1;
_SI = 0;
ReturnFromRegisterFunc();
/* Function does not return */
}
/**********************************************************************
* KERNEL_WaitEvent
*/
int
......@@ -65,34 +80,3 @@ KERNEL_GetModuleFileName(int module, char *filename, int bytes)
return strlen(filename);
}
/**********************************************************************
* KERNEL_DOS3Call
*/
int
KERNEL_DOS3Call(int ax, int cx, int dx, int bx, int sp, int bp,
int si, int di, int ds, int es)
{
switch ((ax >> 8) & 0xff)
{
case 0x30:
return 0x0303;
case 0x25:
case 0x35:
return 0;
case 0x4c:
exit(ax & 0xff);
default:
fprintf(stderr, "DOS: AX %04x, BX %04x, CX %04x, DX %04x\n",
ax, bx, cx, dx);
fprintf(stderr, " SP %04x, BP %04x, SI %04x, DI %04x\n",
sp, bp, si, di);
fprintf(stderr, " DS %04x, ES %04x\n",
ds, es);
}
return 0;
}
/*
* Rectangle-related functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
/***********************************************************************
* SetRect (USER.72)
*/
void SetRect( LPRECT rect, short left, short top, short right, short bottom )
{
rect->left = left;
rect->right = right;
rect->top = top;
rect->bottom = bottom;
}
/***********************************************************************
* SetRectEmpty (USER.73)
*/
void SetRectEmpty( LPRECT rect )
{
rect->left = rect->right = rect->top = rect->bottom = 0;
}
/***********************************************************************
* CopyRect (USER.74)
*/
void CopyRect( LPRECT dest, LPRECT src )
{
*dest = *src;
}
/***********************************************************************
* IsRectEmpty (USER.75)
*/
BOOL IsRectEmpty( LPRECT rect )
{
return ((rect->left == rect->right) || (rect->top == rect->bottom));
}
/***********************************************************************
* PtInRect (USER.76)
*/
BOOL PtInRect( LPRECT rect, POINT pt )
{
return ((pt.x >= rect->left) && (pt.x < rect->right) &&
(pt.y >= rect->top) && (pt.y < rect->bottom));
}
/***********************************************************************
* OffsetRect (USER.77)
*/
void OffsetRect( LPRECT rect, short x, short y )
{
rect->left += x;
rect->right += x;
rect->top += y;
rect->bottom += y;
}
/***********************************************************************
* InflateRect (USER.78)
*/
void InflateRect( LPRECT rect, short x, short y )
{
rect->right += x;
rect->bottom += y;
}
/***********************************************************************
* IntersectRect (USER.79)
*/
BOOL IntersectRect( LPRECT dest, LPRECT src1, LPRECT src2 )
{
if ((src1->left >= src2->right) || (src2->left >= src1->right) ||
(src1->top >= src2->bottom) || (src2->top >= src1->bottom))
{
SetRectEmpty( dest );
return FALSE;
}
dest->left = MAX( src1->left, src2->left );
dest->right = MIN( src1->right, src2->right );
dest->top = MAX( src1->top, src2->top );
dest->bottom = MIN( src1->bottom, src2->bottom );
return TRUE;
}
/***********************************************************************
* UnionRect (USER.80)
*/
BOOL UnionRect( LPRECT dest, LPRECT src1, LPRECT src2 )
{
if (IsRectEmpty(src1))
{
if (IsRectEmpty(src2))
{
SetRectEmpty( dest );
return FALSE;
}
else *dest = *src2;
}
else
{
if (IsRectEmpty(src2)) *dest = *src1;
else
{
dest->left = MIN( src1->left, src2->left );
dest->right = MAX( src1->right, src2->right );
dest->top = MIN( src1->top, src2->top );
dest->bottom = MAX( src1->bottom, src2->bottom );
}
}
return TRUE;
}
/***********************************************************************
* EqualRect (USER.244)
*/
BOOL EqualRect( LPRECT rect1, LPRECT rect2 )
{
return ((rect1->left == rect2->left) && (rect1->right == rect2->right) &&
(rect1->top == rect2->top) && (rect1->bottom == rect2->bottom));
}
/***********************************************************************
* SubtractRect (USER.373)
*/
BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 )
{
RECT tmp;
*dest = *src1;
if (IntersectRect( &tmp, src1, src2 ))
{
if (EqualRect( &tmp, dest )) SetRectEmpty( src1 );
else if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
{
if (tmp.left == dest->left) dest->right = tmp.right;
else if (tmp.right == dest->right) dest->left = tmp.left;
}
else if ((tmp.left == dest->left) && (tmp.right == dest->right))
{
if (tmp.top == dest->top) dest->bottom = tmp.bottom;
else if (tmp.bottom == dest->bottom) dest->top = tmp.top;
}
}
return TRUE;
}
......@@ -4,9 +4,30 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include "prototypes.h"
#include "windows.h"
#include "user.h"
#define DEFAULT_MSG_QUEUE_SIZE 8
#define USER_HEAP_SIZE 0x10000
MDESC *USER_Heap = NULL;
/***********************************************************************
* USER_HeapInit
*/
static BOOL USER_HeapInit()
{
struct segment_descriptor_s * s;
s = GetNextSegment( 0, 0x10000 );
if (s == NULL) return FALSE;
HEAP_Init( &USER_Heap, s->base_addr, USER_HEAP_SIZE );
free(s);
return TRUE;
}
/**********************************************************************
* USER_InitApp
......@@ -16,6 +37,15 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
int
USER_InitApp(int hInstance)
{
/* GDI initialisation */
if (!GDI_Init()) return 0;
/* Create USER heap */
if (!USER_HeapInit()) return 0;
/* Create the DCEs */
DCE_Init();
/* Initialize built-in window classes */
WIDGETS_Init();
......
......@@ -6,6 +6,9 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <sys/param.h>
#include <sys/times.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
......@@ -14,11 +17,15 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "message.h"
#include "callback.h"
#include "win.h"
#include "class.h"
#include "gdi.h"
Widget XT_topLevelWidget;
Display * XT_display;
Screen * XT_screen;
XtAppContext XT_app_context;
static XtAppContext app_context;
static Widget topLevelWidget;
/***********************************************************************
......@@ -26,31 +33,16 @@ static XtAppContext app_context;
*/
void main(int argc, char **argv)
{
XT_topLevelWidget = XtVaAppInitialize(&app_context,
"XWine", /* Application class */
NULL, 0, /* Option list */
&argc, argv, /* Command line args */
NULL, /* Fallback resources */
NULL );
_WinMain( argc, argv );
}
/***********************************************************************
* GetMessage (USER.108)
*/
BOOL GetMessage( LPMSG msg, HWND hwnd, WORD first, WORD last )
{
XEvent event;
topLevelWidget = XtVaAppInitialize(&XT_app_context,
"XWine", /* Application class */
NULL, 0, /* Option list */
&argc, argv, /* Command line args */
NULL, /* Fallback resources */
NULL );
XT_display = XtDisplay( topLevelWidget );
XT_screen = XtScreen( topLevelWidget );
while(1)
{
if (PeekMessage( msg, hwnd, first, last, PM_REMOVE )) break;
XtAppNextEvent( app_context, &event );
XtDispatchEvent( &event );
}
return (msg->message != WM_QUIT);
_WinMain( argc, argv );
}
......@@ -59,20 +51,41 @@ BOOL GetMessage( LPMSG msg, HWND hwnd, WORD first, WORD last )
*/
LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
{
PAINTSTRUCT paintstruct;
WND * wndPtr;
CLASS * classPtr;
printf( "DefWindowProc: %d %d %d %d\n", hwnd, msg, wParam, lParam );
#ifdef DEBUG_MESSAGE
printf( "DefWindowProc: %d %d %d %08x\n", hwnd, msg, wParam, lParam );
#endif
switch(msg)
{
case WM_PAINT:
BeginPaint( hwnd, &paintstruct );
EndPaint( hwnd, &paintstruct );
return 0;
{
PAINTSTRUCT paintstruct;
BeginPaint( hwnd, &paintstruct );
EndPaint( hwnd, &paintstruct );
return 0;
}
case WM_CREATE:
return 0;
case WM_CLOSE:
DestroyWindow( hwnd );
return 0;
case WM_ERASEBKGND:
case WM_ICONERASEBKGND:
{
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 1;
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 1;
if (!classPtr->wc.hbrBackground) return 1;
FillWindow( wndPtr->hwndParent, hwnd, (HDC)wParam,
classPtr->wc.hbrBackground );
GlobalUnlock( hwnd );
return 0;
}
}
return 0;
}
......@@ -85,59 +98,77 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
*/
HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
int MessageBox( HWND hwnd, LPSTR str, LPSTR title, WORD type )
{
return hwnd;
printf( "MessageBox: '%s'\n", str );
}
void MessageBeep( WORD i )
{
printf( "MessageBeep: %d\n", i );
}
void EndPaint( HWND hwnd, LPPAINTSTRUCT lps )
WORD RegisterWindowMessage( LPSTR str )
{
MSG_EndPaint();
printf( "RegisterWindowMessage: '%s'\n", str );
return 0xc000;
}
int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
/***********************************************************************
* GetTickCount (USER.13)
*/
DWORD GetTickCount()
{
struct tms dummy;
return times(&dummy) / (1000 / HZ);
}
int GetSystemMetrics( short index )
{
WND * wndPtr = WIN_FindWndPtr( hdc );
int x = rect->left, y = rect->top;
if (flags & DT_CENTER) x = (rect->left + rect->right) / 2;
if (flags & DT_VCENTER) y = (rect->top + rect->bottom) / 2;
if (count == -1) count = strlen(str);
printf( "DrawText: %d,%d '%s'\n", x, y, str );
if (wndPtr)
printf( "GetSystemMetrics: %d\n", index );
switch(index)
{
XDrawString( XtDisplay(wndPtr->winWidget),
XtWindow(wndPtr->winWidget),
DefaultGCOfScreen(XtScreen(wndPtr->winWidget)),
x, y, str, count );
GlobalUnlock( hdc );
case SM_CXSCREEN:
return DisplayWidth( XT_display, DefaultScreen( XT_display ));
case SM_CYSCREEN:
return DisplayHeight( XT_display, DefaultScreen( XT_display ));
default:
return 0;
}
}
int MessageBox( HWND hwnd, LPSTR str, LPSTR title, WORD type )
void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
{
printf( "MessageBox: '%s'\n", str );
printf( "AdjustWindowRect: (%d,%d)-(%d,%d) %d %d\n", rect->left, rect->top,
rect->right, rect->bottom, style, menu );
}
void MessageBeep( WORD i )
WORD GetPrivateProfileInt( LPSTR section, LPSTR entry,
short defval, LPSTR filename )
{
printf( "MessageBeep: %d\n", i );
printf( "GetPrivateProfileInt: %s %s %d %s\n", section, entry, defval, filename );
return defval;
}
HDC GetDC( HWND hwnd ) { }
HMENU CreateMenu() { }
short GetPrivateProfileString( LPSTR section, LPSTR entry, LPSTR defval,
LPSTR buffer, short count, LPSTR filename )
{
printf( "GetPrivateProfileString: %s %s %s %d %s\n", section, entry, defval, count, filename );
strncpy( buffer, defval, count );
buffer[count-1] = 0;
return strlen(buffer);
}
HMENU GetMenu( HWND hwnd ) { }
BOOL IsIconic( HWND hwnd )
{
printf( "IsIconic: returning FALSE\n" );
return FALSE;
}
BOOL SetMenu( HWND hwnd, HMENU hmenu ) { }
HMENU CreateMenu() { }
BOOL AppendMenu( HMENU hmenu, WORD flags, WORD id, LPSTR text ) { }
BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom ) { }
HANDLE GetStockObject( int obj ) { }
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=bitmap.o brush.o font.o gdiobj.o palette.o pen.o dib.o region.o \
text.o dcvalues.o clipping.o bitblt.o linedda.o
default: objects.o
objects.o: $(OBJS)
$(LD) -r -o objects.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
/*
* GDI bit-blit operations
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include "gdi.h"
extern const int DC_XROPfunction[];
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
/***********************************************************************
* PatBlt (GDI.29)
*/
BOOL PatBlt( HDC hdc, short left, short top,
short width, short height, DWORD rop)
{
int x1, x2, y1, y2;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
#ifdef DEBUG_GDI
printf( "PatBlt: %d %d,%d %dx%d %06x\n",
hdc, left, top, width, height, rop );
#endif
rop >>= 16;
if (!DC_SetupGCForBrush( dc )) rop &= 0x0f;
else rop = (rop & 0x03) | ((rop >> 4) & 0x0c);
XSetFunction( XT_display, dc->u.x.gc, DC_XROPfunction[rop] );
x1 = XLPTODP( dc, left );
x2 = XLPTODP( dc, left + width );
y1 = YLPTODP( dc, top );
y2 = YLPTODP( dc, top + height );
XFillRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc,
MIN(x1,x2), MIN(y1,y2), abs(x2-x1), abs(y2-y1) );
return TRUE;
}
/***********************************************************************
* BitBlt (GDI.34)
*/
BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
HDC hdcSrc, short xSrc, short ySrc, DWORD rop )
{
int xs1, xs2, ys1, ys2;
int xd1, xd2, yd1, yd2;
DC *dcDest, *dcSrc;
#ifdef DEBUG_GDI
printf( "BitBlt: %d %d,%d %dx%d %d %d,%d %08x\n",
hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop );
#endif
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
return PatBlt( hdcDest, xDest, yDest, width, height, rop );
rop >>= 16;
if ((rop & 0x0f) != (rop >> 4))
{
printf( "BitBlt: Unimplemented ROP %02x\n", rop );
return FALSE;
}
dcDest = (DC *) GDI_GetObjPtr( hdcDest, DC_MAGIC );
if (!dcDest) return FALSE;
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
if (!dcSrc) return FALSE;
xs1 = XLPTODP( dcSrc, xSrc );
xs2 = XLPTODP( dcSrc, xSrc + width );
ys1 = YLPTODP( dcSrc, ySrc );
ys2 = YLPTODP( dcSrc, ySrc + height );
xd1 = XLPTODP( dcDest, xDest );
xd2 = XLPTODP( dcDest, xDest + width );
yd1 = YLPTODP( dcDest, yDest );
yd2 = YLPTODP( dcDest, yDest + height );
if ((abs(xs2-xs1) != abs(xd2-xd1)) || (abs(ys2-ys1) != abs(yd2-yd1)))
return FALSE; /* Should call StretchBlt here */
DC_SetupGCForText( dcDest );
XSetFunction( XT_display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f] );
if (dcSrc->w.bitsPerPixel == dcDest->w.bitsPerPixel)
{
XCopyArea( XT_display, dcSrc->u.x.drawable,
dcDest->u.x.drawable, dcDest->u.x.gc,
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
MIN(xd1,xd2), MIN(yd1,yd2) );
}
else
{
if (dcSrc->w.bitsPerPixel != 1) return FALSE;
XCopyPlane( XT_display, dcSrc->u.x.drawable,
dcDest->u.x.drawable, dcDest->u.x.gc,
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
MIN(xd1,xd2), MIN(yd1,yd2), 1 );
}
return TRUE;
}
/*
* GDI brush objects
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
extern Display * XT_display;
extern Screen * XT_screen;
#define NB_HATCH_STYLES 6
static char HatchBrushes[NB_HATCH_STYLES][8] =
{
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HS_VERTICAL */
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HS_FDIAGONAL */
{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HS_BDIAGONAL */
{ 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HS_CROSS */
{ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 } /* HS_DIAGCROSS */
};
extern XImage * BITMAP_BmpToImage( BITMAP *, void * );
/***********************************************************************
* CreateBrushIndirect (GDI.50)
*/
HBRUSH CreateBrushIndirect( LOGBRUSH * brush )
{
BRUSHOBJ * brushPtr;
HBRUSH hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC );
if (!hbrush) return 0;
brushPtr = (BRUSHOBJ *) GDI_HEAP_ADDR( hbrush );
memcpy( &brushPtr->logbrush, brush, sizeof(LOGBRUSH) );
return hbrush;
}
/***********************************************************************
* CreateHatchBrush (GDI.58)
*/
HBRUSH CreateHatchBrush( short style, COLORREF color )
{
LOGBRUSH logbrush = { BS_HATCHED, color, style };
#ifdef DEBUG_GDI
printf( "CreateHatchBrush: %d %06x\n", style, color );
#endif
if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
return CreateBrushIndirect( &logbrush );
}
/***********************************************************************
* CreatePatternBrush (GDI.60)
*/
HBRUSH CreatePatternBrush( HBITMAP hbitmap )
{
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
BITMAPOBJ * bmpObj;
BITMAP * bmp;
#ifdef DEBUG_GDI
printf( "CreatePatternBrush: %d\n", hbitmap );
#endif
/* Make a copy of the bitmap */
if (!(bmpObj = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return 0;
if (!(bmp = (BITMAP *) GlobalLock( bmpObj->hBitmap ))) return 0;
logbrush.lbHatch = CreateBitmap( bmp->bmWidth, bmp->bmHeight,
bmp->bmPlanes, bmp->bmBitsPixel,
((char *)bmp) + sizeof(BITMAP) );
GlobalUnlock( bmpObj->hBitmap );
if (!logbrush.lbHatch) return 0;
return CreateBrushIndirect( &logbrush );
}
/***********************************************************************
* CreateDIBPatternBrush (GDI.445)
*/
HBRUSH CreateDIBPatternBrush( HANDLE hbitmap, WORD coloruse )
{
LOGBRUSH logbrush = { BS_DIBPATTERN, coloruse, 0 };
BITMAPINFO *info, *newInfo;
int size;
#ifdef DEBUG_GDI
printf( "CreateDIBPatternBrush: %d\n", hbitmap );
#endif
/* Make a copy of the bitmap */
if (!(info = (BITMAPINFO *) GlobalLock( hbitmap ))) return 0;
size = info->bmiHeader.biSizeImage;
if (!size)
size = (info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) / 32
* 8 * info->bmiHeader.biHeight;
size += DIB_BitmapInfoSize( info, coloruse );
if (!(logbrush.lbHatch = GlobalAlloc( GMEM_MOVEABLE, size )))
{
GlobalUnlock( hbitmap );
return 0;
}
newInfo = (BITMAPINFO *) GlobalLock( logbrush.lbHatch );
memcpy( newInfo, info, size );
GlobalUnlock( logbrush.lbHatch );
GlobalUnlock( hbitmap );
return CreateBrushIndirect( &logbrush );
}
/***********************************************************************
* CreateSolidBrush (GDI.66)
*/
HBRUSH CreateSolidBrush( COLORREF color )
{
LOGBRUSH logbrush = { BS_SOLID, color, 0 };
#ifdef DEBUG_GDI
printf( "CreateSolidBrush: %06x\n", color );
#endif
return CreateBrushIndirect( &logbrush );
}
/***********************************************************************
* SetBrushOrg (GDI.148)
*/
DWORD SetBrushOrg( HDC hdc, short x, short y )
{
DWORD retval;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
retval = dc->w.brushOrgX | (dc->w.brushOrgY << 16);
dc->w.brushOrgX = x;
dc->w.brushOrgY = y;
return retval;
}
/***********************************************************************
* BRUSH_DeleteObject
*/
BOOL BRUSH_DeleteObject( HBRUSH hbrush, BRUSHOBJ * brush )
{
switch(brush->logbrush.lbStyle)
{
case BS_PATTERN:
DeleteObject( brush->logbrush.lbHatch );
break;
case BS_DIBPATTERN:
GlobalFree( brush->logbrush.lbHatch );
break;
}
return GDI_FreeObject( hbrush );
}
/***********************************************************************
* BRUSH_GetObject
*/
int BRUSH_GetObject( BRUSHOBJ * brush, int count, LPSTR buffer )
{
if (count > sizeof(LOGBRUSH)) count = sizeof(LOGBRUSH);
memcpy( buffer, &brush->logbrush, count );
return count;
}
/***********************************************************************
* BRUSH_SelectPatternBrush
*/
BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
{
BITMAPOBJ * bmpObjPtr;
BITMAP * bmp;
bmpObjPtr = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmpObjPtr) return FALSE;
if (!(bmp = (BITMAP *) GlobalLock( bmpObjPtr->hBitmap ))) return FALSE;
dc->u.x.brush.pixmap = XCreatePixmap( XT_display,
DefaultRootWindow(XT_display),
8, 8, bmp->bmBitsPixel );
BITMAP_CopyToPixmap( bmp, dc->u.x.brush.pixmap, 0, 0, 8, 8 );
if (bmp->bmBitsPixel > 1)
{
dc->u.x.brush.fillStyle = FillTiled;
XSetTile( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.pixel = 0; /* Ignored */
}
else
{
dc->u.x.brush.fillStyle = FillOpaqueStippled;
XSetStipple( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
}
return TRUE;
}
/***********************************************************************
* BRUSH_SelectObject
*/
HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
{
HBITMAP hBitmap;
BITMAPINFO * bmpInfo;
HBRUSH prevHandle = dc->w.hBrush;
dc->w.hBrush = hbrush;
if (dc->u.x.brush.pixmap)
{
XFreePixmap( XT_display, dc->u.x.brush.pixmap );
dc->u.x.brush.pixmap = 0;
}
dc->u.x.brush.style = brush->logbrush.lbStyle;
switch(brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_NULL:
dc->u.x.brush.pixel = GetNearestPaletteIndex( dc->w.hPalette,
brush->logbrush.lbColor );
dc->u.x.brush.fillStyle = FillSolid;
break;
case BS_HATCHED:
dc->u.x.brush.pixel = GetNearestPaletteIndex( dc->w.hPalette,
brush->logbrush.lbColor );
dc->u.x.brush.pixmap = XCreateBitmapFromData(XT_display,
DefaultRootWindow(XT_display),
HatchBrushes[brush->logbrush.lbHatch],
8, 8 );
XSetStipple( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.fillStyle = FillStippled;
break;
case BS_PATTERN:
BRUSH_SelectPatternBrush( dc, brush->logbrush.lbHatch );
break;
case BS_DIBPATTERN:
if ((bmpInfo = (BITMAPINFO *) GlobalLock( brush->logbrush.lbHatch )))
{
int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
hBitmap = CreateDIBitmap( hdc, &bmpInfo->bmiHeader, CBM_INIT,
((char *)bmpInfo) + size, bmpInfo,
(WORD) brush->logbrush.lbColor );
BRUSH_SelectPatternBrush( dc, hBitmap );
DeleteObject( hBitmap );
GlobalUnlock( brush->logbrush.lbHatch );
}
break;
}
return prevHandle;
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment