Release 0.4.3
Tue Sep 28 19:59:21 1993 David Metcalfe * [windows/win.c] Implemented support for windows with no borders. Added GetParent(), GetDlgCtrlID(), GetWindowText() and GetWindowTextLength() functions. * [misc/xt.c] Added processing of WM_GETTEXT and WM_GETTEXTLENGTH messages to DefWindowProc and Implemented MessageBeep(). * [windows/syscolor.c] Added preliminary system color support. * [controls/button1.c] Mods to new button control and integration with Wine. Tue Sep 28 19:59:21 1993 Johannes Ruscheinski * [controls/button1.c] New button control using GDI functions. Tue Sep 28 19:59:21 1993 Eric Youngdale * [debugger/*] Added debugging capabilities to Wine Sat Sep 25 13:22:50 1993 Alexandre Julliard (julliard@di.epfl.ch) * [objects/region.c] Bug fix Fri Sep 24 07:35:11 1993 Bob Amstadt (bob at pooh) * [tools/build.c] Changed the entry point code to reduce the standard entry point size from 22 bytes to 10 bytes. This leaves about 4000 free entry points instead of the 800 in version 0.4.2. * [loader/resource.c] Rewrote functions to allow loading of resources from any DLL. * [loader/wine.c] [include/wine.h] Added functions GetFilenameFromInstance() and GetFileInfo() to search for a loaded file based on its instance handle. Added a field in struct w_files to make searching by an instance handle faster. Tue Sep 21 09:57:01 1993 miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza) * [misc/profile.c] Implementation of .INI file handling Mon Sep 20 10:54:32 1993 David Metcalfe * [misc/profile.c.old] Implementation of .INI file handling Mon Sep 20 10:54:32 1993 John Brezak * [controls/WinButton.c] Bug fix with call to XtVaSetValues. Mon Sep 20 10:54:32 1993 Alexandre Julliard * [windows/win.c] Quick patch to get colormaps to work with button widget. Mon Sep 20 02:42:54 1993 (yngvi@hafro.is) * misc/keyboard.c: Ifdefed out some bogus Ansi<->Oem conversion functions * misc/lstr.c: New file with string functions like lstr* IsChar* *Ansi* Wed Sep 15 20:35:10 1993 John Brezak * [loader/signal.c] Additional changes to support NetBSD. Wed Sep 15 22:19:22 1993 Martin Ayotte * [windows/graphics.c] Added FrameRect function Tue Sep 14 13:54:45 1993 Alexandre Julliard * [objects/color.c] [objects/palette.c] Preliminary support for private color map. * [windows/class.c] Implemented CS_CLASSDC style. * [windows/dce.c] Moved DCEs to USER heap. Implemented class and window DCs. * [windows/event.c] Implemented CS_DBLCLKS style. * [windows/graphics.c] Bug fix in SetPixel(). * [windows/win.c] Implemented CS_OWNDC style. Implemented Get/SetWindowLong(). * [controls/menu.c] [windows/class.c] [windows/clipping.c] [windows/dce.c] [windows/message.c] [windows/win.c] Moved windows from global heap to USER heap.
7864
ALPHA-pl13.diff
113
ChangeLog
|
@ -1,3 +1,116 @@
|
|||
Tue Sep 28 19:59:21 1993 David Metcalfe
|
||||
|
||||
* [windows/win.c]
|
||||
Implemented support for windows with no borders. Added
|
||||
GetParent(), GetDlgCtrlID(), GetWindowText() and
|
||||
GetWindowTextLength() functions.
|
||||
|
||||
* [misc/xt.c]
|
||||
Added processing of WM_GETTEXT and WM_GETTEXTLENGTH messages
|
||||
to DefWindowProc and Implemented MessageBeep().
|
||||
|
||||
* [windows/syscolor.c]
|
||||
Added preliminary system color support.
|
||||
|
||||
* [controls/button1.c]
|
||||
Mods to new button control and integration with Wine.
|
||||
|
||||
Tue Sep 28 19:59:21 1993 Johannes Ruscheinski
|
||||
|
||||
* [controls/button1.c]
|
||||
New button control using GDI functions.
|
||||
|
||||
Tue Sep 28 19:59:21 1993 Eric Youngdale
|
||||
|
||||
* [debugger/*]
|
||||
Added debugging capabilities to Wine
|
||||
|
||||
Sat Sep 25 13:22:50 1993 Alexandre Julliard (julliard@di.epfl.ch)
|
||||
|
||||
* [objects/region.c]
|
||||
Bug fix
|
||||
|
||||
Fri Sep 24 07:35:11 1993 Bob Amstadt (bob at pooh)
|
||||
|
||||
* [tools/build.c]
|
||||
Changed the entry point code to reduce the standard entry
|
||||
point size from 22 bytes to 10 bytes. This leaves about
|
||||
4000 free entry points instead of the 800 in version 0.4.2.
|
||||
|
||||
* [loader/resource.c]
|
||||
Rewrote functions to allow loading of resources from any
|
||||
DLL.
|
||||
|
||||
* [loader/wine.c] [include/wine.h]
|
||||
Added functions GetFilenameFromInstance() and GetFileInfo()
|
||||
to search for a loaded file based on its instance handle.
|
||||
Added a field in struct w_files to make searching by an instance
|
||||
handle faster.
|
||||
|
||||
Tue Sep 21 09:57:01 1993 miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza)
|
||||
|
||||
* [misc/profile.c]
|
||||
Implementation of .INI file handling
|
||||
|
||||
Mon Sep 20 10:54:32 1993 David Metcalfe
|
||||
|
||||
* [misc/profile.c.old]
|
||||
Implementation of .INI file handling
|
||||
|
||||
Mon Sep 20 10:54:32 1993 John Brezak
|
||||
|
||||
* [controls/WinButton.c]
|
||||
Bug fix with call to XtVaSetValues.
|
||||
|
||||
Mon Sep 20 10:54:32 1993 Alexandre Julliard
|
||||
|
||||
* [windows/win.c]
|
||||
Quick patch to get colormaps to work with button widget.
|
||||
|
||||
Mon Sep 20 02:42:54 1993 (yngvi@hafro.is)
|
||||
|
||||
* misc/keyboard.c:
|
||||
Ifdefed out some bogus Ansi<->Oem conversion functions
|
||||
|
||||
* misc/lstr.c:
|
||||
New file with string functions like lstr* IsChar* *Ansi*
|
||||
|
||||
Wed Sep 15 20:35:10 1993 John Brezak
|
||||
|
||||
* [loader/signal.c]
|
||||
Additional changes to support NetBSD.
|
||||
|
||||
Wed Sep 15 22:19:22 1993 Martin Ayotte
|
||||
|
||||
* [windows/graphics.c]
|
||||
Added FrameRect function
|
||||
|
||||
Tue Sep 14 13:54:45 1993 Alexandre Julliard
|
||||
|
||||
* [objects/color.c] [objects/palette.c]
|
||||
Preliminary support for private color map.
|
||||
|
||||
* [windows/class.c]
|
||||
Implemented CS_CLASSDC style.
|
||||
|
||||
* [windows/dce.c]
|
||||
Moved DCEs to USER heap.
|
||||
Implemented class and window DCs.
|
||||
|
||||
* [windows/event.c]
|
||||
Implemented CS_DBLCLKS style.
|
||||
|
||||
* [windows/graphics.c]
|
||||
Bug fix in SetPixel().
|
||||
|
||||
* [windows/win.c]
|
||||
Implemented CS_OWNDC style.
|
||||
Implemented Get/SetWindowLong().
|
||||
|
||||
* [controls/menu.c] [windows/class.c] [windows/clipping.c]
|
||||
[windows/dce.c] [windows/message.c] [windows/win.c]
|
||||
Moved windows from global heap to USER heap.
|
||||
|
||||
Mon Sep 13 05:00:11 1993 Eric Youngdale
|
||||
|
||||
* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
|
||||
|
|
5
Makefile
|
@ -3,14 +3,15 @@
|
|||
DEBUGOPTS=
|
||||
COPTS=-O2 -m486
|
||||
INCLUDE_DIR=include
|
||||
LDFLAGS=
|
||||
|
||||
######################################################################
|
||||
# These definitions are for the top level
|
||||
TARGET=wine
|
||||
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
|
||||
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
|
||||
SUBDIRS=if1632 controls loader memory misc objects windows debugger
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
|
25
README
|
@ -7,14 +7,13 @@ INSTALLATION:
|
|||
Linux:
|
||||
|
||||
Uncompress and untar this archive into the directory of your
|
||||
choice. This release requires a Linux version 0.99 pl12 kernel with
|
||||
ALPHA-pl13-diffs.
|
||||
choice. This release requires a Linux version 0.99 pl13 kernel
|
||||
or above.
|
||||
|
||||
NetBSD:
|
||||
|
||||
If you use BSD make rather than GNU make, you must apply the patches
|
||||
in the file "bsdmake.patch". This release requires NetBSD 0.9 with
|
||||
additional patches.
|
||||
in the file "bsdmake.patch". This release requires NetBSD-current.
|
||||
|
||||
All:
|
||||
|
||||
|
@ -28,6 +27,24 @@ Grab a copy of Windows sol.exe (Solitaire) and run it with the command:
|
|||
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
|
||||
So, occassionally it will crash.
|
||||
|
||||
WHAT'S NEW with version 0.4.3: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- Resource loading now able to load DLL resources
|
||||
- Button control now based on GDI calls
|
||||
- Preliminary system color support
|
||||
- Miscellaneous window functions
|
||||
- Limited debugging facility (sometimes hangs)
|
||||
|
||||
WHAT'S NEW with version 0.4.2: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- 32-bit callback functions allowed
|
||||
- .INI file handling
|
||||
- lstr* functions and ANSI<->OEM conversion functions.
|
||||
|
||||
WHAT'S NEW with version 0.4.1: (see ChangeLog for details)
|
||||
- Bug fixes
|
||||
- Memory usage changes.
|
||||
|
||||
WHAT'S NEW with version 0.4.0: (see ChangeLog for details)
|
||||
- Wine now compiles and runs under NetBSD. Patches are
|
||||
required for NetBSD.
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
Date: Sun, 26 Sep 93 03:18:19 EDT
|
||||
From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
|
||||
Message-Id: <9309260718.AA13966@tantalus.nrl.navy.mil>
|
||||
To: bob@amscons.amscons.com
|
||||
Cc: linux-activists@Niksula.hut.fi
|
||||
In-Reply-To: Bob Amstadt's message of Sat, 25 Sep 1993 23:36:32 +0300
|
||||
<m0oggMt-000CrhC@amscons.amscons.com>
|
||||
X-Mn-Key: WABI
|
||||
|
||||
|
||||
|
||||
>I may just be dreaming, but I'm beginning to like the idea of a built
|
||||
>in debugger.
|
||||
|
||||
So do I. I like it so much that I wrote one. It turns out that the
|
||||
disassembly code in gdb is pretty much localized to one source file, and this
|
||||
was easy to splice into a simple program. In addition, there are 2 variables
|
||||
that you set if you are disassembling 16 bit code, so it makes it all the
|
||||
better.
|
||||
|
||||
Anyway, there is a parser that understands a limited set of gdb
|
||||
commands (very limited, but the 'x' command is pretty functional as long as you
|
||||
stick to numeric rather than symbolic addresses). The parser understands $pc
|
||||
and $sp for your convenience, and you can do things like "x/10i $pc" and "info
|
||||
regs" to see what is going on. In principle you can do "x/x", "x/s", "x/d",
|
||||
"x/w", "x/b", "x/i" and "x/c". I implemented an "info stack" command that
|
||||
simply dumps a number of bytes from the stack onto the screen, but it currently
|
||||
makes no attempt to actually interpret the stack frames.
|
||||
|
||||
This will probably not work on non-linux systems, and I have no idea
|
||||
how much work it will be to fix it. To start with we need some simple macros
|
||||
to determine (based upon a segment selector) whether we are in a 16 bit or a 32
|
||||
bit segment, but this should be pretty easy to fix. I shamelessly ripped off a
|
||||
bunch of files from gdb, and I obviously picked the ones for linux. For other
|
||||
systems you may need to make adjustments to these files somehow. It is too
|
||||
late in the evening to worry about this now.
|
||||
|
||||
It will probably be easy to modify the parser to allow you to change
|
||||
memory locations and/or register values and then continue execution. Also,
|
||||
some of the hooks for using readline with the parser are in place, but it does
|
||||
not work reliably for some reason, so I left it out for now. Adding gnu
|
||||
readline really would bloat the package a lot. Instead I could use Rich Salz's
|
||||
editlib (the canonical test case for the DLL tools), which has a command line
|
||||
history feature that could be an acceptable substitute - this is much smaller
|
||||
than gnu readline, but I am not sure what features are present.
|
||||
|
||||
-Eric
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
In this directory you might find my implemantation of the Windows
|
||||
String. The patch lstr.patch includes whats needed for the following
|
||||
functions:
|
||||
lstrcat,lstrcmp,lstrcmpi,lstrcpy,lstrcpyn,lstrlen,AnsiUpper,AnsiLower,
|
||||
IsCharAlpha,IsCharAlphanumeric,IsCharUpper,IsCharLower,AnsiUpperBuff,
|
||||
AnsiLowerBuff,AnsiNext,AnsiPrev. Simply apply the patch to Wine.0.4.1
|
||||
and remake.
|
||||
|
||||
|
||||
Also there should be the files oem2ansi.trl and ansi2oem.trl that
|
||||
define how to translate between ansi and oem codepage 861 I believe
|
||||
they call it. These files where created by the Windows program
|
||||
oemansi.exe which is also included. To get the oem<->ansi translations
|
||||
right for your part of the world just run oemansi under Windows not
|
||||
Wine and oemansi will create oem2ansi and ansi2oem for your locale
|
||||
that is if your Windows/Dos is set up correctly. Move the .trl files
|
||||
into the directory from where you run wine. If Wine does not find the
|
||||
*.trl in the current directory AnsiToOem and OemToAnsi will be
|
||||
passive.
|
||||
|
||||
Shortcomings/Bugs:
|
||||
Some functions depend upon libc functions like toupper, tolower and
|
||||
isalpha that, as far as I know, are totally without support for NLS
|
||||
and ISO 8859-1. Default Ansi<->OEM translations when *.trl files are
|
||||
not found are missing.
|
||||
|
||||
|
||||
NOTE: Please don't run oemansi.exe under wine.
|
271
bsdmake.patch
|
@ -1,147 +1,124 @@
|
|||
*** ./windows/Makefile.orig Fri Sep 3 16:37:58 1993
|
||||
--- ./windows/Makefile Thu Sep 9 22:56:21 1993
|
||||
***************
|
||||
*** 14,19 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 14,19 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
*** ./tools/Makefile.orig Tue Jul 20 18:40:18 1993
|
||||
--- ./tools/Makefile Thu Sep 9 22:56:21 1993
|
||||
***************
|
||||
*** 12,17 ****
|
||||
#
|
||||
# Dependency lists
|
||||
#
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 12,21 ----
|
||||
#
|
||||
# Dependency lists
|
||||
#
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
!
|
||||
! #ifeq (.depend,$(wildcard .depend))
|
||||
! #include .depend
|
||||
! #endif
|
||||
*** ./objects/Makefile.orig Fri Sep 3 16:39:20 1993
|
||||
--- ./objects/Makefile Thu Sep 9 22:56:23 1993
|
||||
***************
|
||||
*** 14,19 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 14,19 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
*** ./misc/Makefile.orig Thu Sep 9 11:16:49 1993
|
||||
--- ./misc/Makefile Thu Sep 9 22:56:23 1993
|
||||
***************
|
||||
*** 13,18 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 13,18 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
*** ./memory/Makefile.orig Tue Jul 20 18:43:02 1993
|
||||
--- ./memory/Makefile Thu Sep 9 22:56:34 1993
|
||||
***************
|
||||
*** 13,18 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 13,18 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
*** ./loader/Makefile.orig Mon Aug 30 20:44:18 1993
|
||||
--- ./loader/Makefile Thu Sep 9 22:56:36 1993
|
||||
***************
|
||||
*** 13,18 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 13,18 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
*** ./if1632/Makefile.orig Thu Sep 9 11:15:58 1993
|
||||
--- ./if1632/Makefile Thu Sep 9 22:56:38 1993
|
||||
***************
|
||||
*** 42,50 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
|
||||
|
||||
|
||||
--- 42,50 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
|
||||
|
||||
|
||||
*** ./controls/Makefile.orig Mon Aug 30 19:40:39 1993
|
||||
--- ./controls/Makefile Thu Sep 9 22:56:43 1993
|
||||
***************
|
||||
*** 14,19 ****
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! ifeq (.depend,$(wildcard .depend))
|
||||
! include .depend
|
||||
! endif
|
||||
--- 14,20 ----
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
! .if exists(.depend)
|
||||
! .include ".depend"
|
||||
! .endif
|
||||
!
|
||||
diff -ruN ../Backup//Makefile ./Makefile
|
||||
--- ../Backup//Makefile Tue Sep 14 09:47:00 1993
|
||||
+++ ./Makefile Thu Sep 16 09:59:52 1993
|
||||
@@ -7,7 +7,7 @@
|
||||
######################################################################
|
||||
# These definitions are for the top level
|
||||
TARGET=wine
|
||||
-LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
|
||||
+LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm -li386
|
||||
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
|
||||
diff -ruN ../Backup//controls/Makefile ./controls/Makefile
|
||||
--- ../Backup//controls/Makefile Sat Sep 11 22:13:44 1993
|
||||
+++ ./controls/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -14,6 +14,7 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
+
|
||||
diff -ruN ../Backup//if1632/Makefile ./if1632/Makefile
|
||||
--- ../Backup//if1632/Makefile Tue Sep 14 08:56:17 1993
|
||||
+++ ./if1632/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -45,9 +45,9 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
|
||||
|
||||
|
||||
diff -ruN ../Backup//loader/Makefile ./loader/Makefile
|
||||
--- ../Backup//loader/Makefile Sat Sep 11 21:42:05 1993
|
||||
+++ ./loader/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -13,6 +13,6 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
diff -ruN ../Backup//memory/Makefile ./memory/Makefile
|
||||
--- ../Backup//memory/Makefile Sat Sep 11 21:42:05 1993
|
||||
+++ ./memory/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -13,6 +13,6 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
diff -ruN ../Backup//misc/Makefile ./misc/Makefile
|
||||
--- ../Backup//misc/Makefile Tue Sep 14 09:17:00 1993
|
||||
+++ ./misc/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -14,6 +14,6 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
diff -ruN ../Backup//objects/Makefile ./objects/Makefile
|
||||
--- ../Backup//objects/Makefile Tue Sep 14 13:59:04 1993
|
||||
+++ ./objects/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -14,6 +14,6 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
diff -ruN ../Backup//tools/Makefile ./tools/Makefile
|
||||
--- ../Backup//tools/Makefile Tue Sep 14 09:46:40 1993
|
||||
+++ ./tools/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -14,6 +14,10 @@
|
||||
#
|
||||
# Dependency lists
|
||||
#
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
+
|
||||
+#ifeq (.depend,$(wildcard .depend))
|
||||
+#include .depend
|
||||
+#endif
|
||||
diff -ruN ../Backup//windows/Makefile ./windows/Makefile
|
||||
--- ../Backup//windows/Makefile Tue Sep 14 08:39:45 1993
|
||||
+++ ./windows/Makefile Thu Sep 16 10:00:24 1993
|
||||
@@ -14,6 +14,6 @@
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -M *.c > .depend
|
||||
|
||||
-ifeq (.depend,$(wildcard .depend))
|
||||
-include .depend
|
||||
-endif
|
||||
+.if exists(.depend)
|
||||
+.include ".depend"
|
||||
+.endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||
|
||||
OBJS=menu.o widgets.o button.o SmeMenuButto.o WinLabel.o WinCommand.o \
|
||||
WinMenuButto.o WinButton.o
|
||||
WinMenuButto.o
|
||||
|
||||
default: controls.o
|
||||
|
||||
|
|
|
@ -1,605 +0,0 @@
|
|||
/***********************************************************
|
||||
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/28/93 David Metcalfe (david@prism.demon.co.uk)
|
||||
* Created from Command widget and added 3D effect
|
||||
*/
|
||||
|
||||
/*
|
||||
* WinButton.c - WinButton button widget
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/IntrinsicP.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include <X11/Xmu/Misc.h>
|
||||
#include <X11/Xaw/XawInit.h>
|
||||
#include "WinButtonP.h"
|
||||
#include <X11/Xmu/Converters.h>
|
||||
|
||||
#define DEFAULT_HIGHLIGHT_THICKNESS 0
|
||||
#define DEFAULT_SHAPE_HIGHLIGHT 32767
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Full class record constant
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
/* Private Data */
|
||||
|
||||
static char defaultTranslations[] =
|
||||
"<EnterWindow>: highlight() \n\
|
||||
<LeaveWindow>: reset() \n\
|
||||
<Btn1Down>: set() \n\
|
||||
<Btn1Up>: notify() unset() ";
|
||||
|
||||
#define offset(field) XtOffsetOf(WinButtonRec, field)
|
||||
static XtResource resources[] = {
|
||||
{XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer),
|
||||
offset(winbutton.callbacks), XtRCallback, (XtPointer)NULL},
|
||||
{XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension),
|
||||
offset(winbutton.highlight_thickness), XtRImmediate,
|
||||
(XtPointer) DEFAULT_SHAPE_HIGHLIGHT},
|
||||
{XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int),
|
||||
offset(winbutton.shape_style), XtRImmediate,
|
||||
(XtPointer)XawShapeRectangle},
|
||||
{XtNcornerRoundPercent, XtCCornerRoundPercent,
|
||||
XtRDimension, sizeof(Dimension),
|
||||
offset(winbutton.corner_round), XtRImmediate, (XtPointer) 25},
|
||||
{XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension),
|
||||
offset(winbutton.shadow_thickness), XtRImmediate, (XtPointer) 2},
|
||||
{XtNshadowHighlight, XtCShadowHighlight, XtRPixel, sizeof(Pixel),
|
||||
offset(winbutton.shadow_highlight), XtRString, (XtPointer) "white"},
|
||||
{XtNshadowShade, XtCShadowShade, XtRPixel, sizeof(Pixel),
|
||||
offset(winbutton.shadow_shade), XtRString, (XtPointer) "grey25"},
|
||||
};
|
||||
#undef offset
|
||||
|
||||
static Boolean SetValues();
|
||||
static void Initialize(), Redisplay(), Set(), Reset(), Notify(), Unset();
|
||||
static void Highlight(), Unhighlight(), Destroy(), PaintWinButtonWidget();
|
||||
static void ClassInitialize();
|
||||
static Boolean ShapeButton();
|
||||
static void Realize(), Resize();
|
||||
|
||||
static XtActionsRec actionsList[] = {
|
||||
{"set", Set},
|
||||
{"notify", Notify},
|
||||
{"highlight", Highlight},
|
||||
{"reset", Reset},
|
||||
{"unset", Unset},
|
||||
{"unhighlight", Unhighlight}
|
||||
};
|
||||
|
||||
#define SuperClass ((WinLabelWidgetClass)&winLabelClassRec)
|
||||
|
||||
WinButtonClassRec winButtonClassRec = {
|
||||
{
|
||||
(WidgetClass) SuperClass, /* superclass */
|
||||
"WinButton", /* class_name */
|
||||
sizeof(WinButtonRec), /* size */
|
||||
ClassInitialize, /* class_initialize */
|
||||
NULL, /* class_part_initialize */
|
||||
FALSE, /* class_inited */
|
||||
Initialize, /* initialize */
|
||||
NULL, /* initialize_hook */
|
||||
Realize, /* 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 */
|
||||
Destroy, /* destroy */
|
||||
Resize, /* resize */
|
||||
Redisplay, /* expose */
|
||||
SetValues, /* 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 */
|
||||
}, /* WinButtonClass fields initialization */
|
||||
};
|
||||
|
||||
/* for public consumption */
|
||||
WidgetClass winButtonWidgetClass = (WidgetClass) &winButtonClassRec;
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Private Procedures
|
||||
*
|
||||
****************************************************************/
|
||||
|
||||
static GC
|
||||
Get_GC(cbw, fg, bg)
|
||||
WinButtonWidget cbw;
|
||||
Pixel fg, bg;
|
||||
{
|
||||
XGCValues values;
|
||||
|
||||
values.foreground = fg;
|
||||
values.background = bg;
|
||||
values.font = cbw->winlabel.font->fid;
|
||||
values.cap_style = CapProjecting;
|
||||
|
||||
if (cbw->winbutton.highlight_thickness > 1 )
|
||||
values.line_width = cbw->winbutton.highlight_thickness;
|
||||
else
|
||||
values.line_width = 0;
|
||||
|
||||
return XtGetGC((Widget)cbw,
|
||||
(GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle),
|
||||
&values);
|
||||
}
|
||||
|
||||
static void
|
||||
Get_Shadow_GCs(cbw)
|
||||
WinButtonWidget cbw;
|
||||
{
|
||||
XGCValues values;
|
||||
|
||||
values.foreground = cbw->winbutton.shadow_highlight;
|
||||
values.line_width = cbw->winbutton.shadow_thickness;
|
||||
values.cap_style = CapProjecting;
|
||||
cbw->winbutton.shadow_highlight_gc =
|
||||
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
|
||||
|
||||
values.foreground = cbw->winbutton.shadow_shade;
|
||||
values.line_width = cbw->winbutton.shadow_thickness;
|
||||
values.cap_style = CapProjecting;
|
||||
cbw->winbutton.shadow_shade_gc =
|
||||
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
|
||||
}
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Initialize(request, new, args, num_args)
|
||||
Widget request, new;
|
||||
ArgList args; /* unused */
|
||||
Cardinal *num_args; /* unused */
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget) new;
|
||||
int shape_event_base, shape_error_base;
|
||||
|
||||
if (cbw->winbutton.shape_style != XawShapeRectangle
|
||||
&& !XShapeQueryExtension(XtDisplay(new), &shape_event_base,
|
||||
&shape_error_base))
|
||||
cbw->winbutton.shape_style = XawShapeRectangle;
|
||||
if (cbw->winbutton.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
|
||||
if (cbw->winbutton.shape_style != XawShapeRectangle)
|
||||
cbw->winbutton.highlight_thickness = 0;
|
||||
else
|
||||
cbw->winbutton.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
|
||||
}
|
||||
|
||||
XtVaSetValues(new, XtNbackground, "grey75");
|
||||
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
|
||||
cbw->core.background_pixel);
|
||||
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
|
||||
cbw->winlabel.foreground);
|
||||
XtReleaseGC(new, cbw->winlabel.normal_GC);
|
||||
cbw->winlabel.normal_GC = cbw->winbutton.normal_GC;
|
||||
|
||||
Get_Shadow_GCs(cbw);
|
||||
|
||||
cbw->winbutton.set = FALSE;
|
||||
cbw->winbutton.highlighted = HighlightNone;
|
||||
}
|
||||
|
||||
static Region
|
||||
HighlightRegion(cbw)
|
||||
WinButtonWidget cbw;
|
||||
{
|
||||
static Region outerRegion = NULL, innerRegion, emptyRegion;
|
||||
XRectangle rect;
|
||||
|
||||
if (cbw->winbutton.highlight_thickness == 0 ||
|
||||
cbw->winbutton.highlight_thickness >
|
||||
(Dimension) ((Dimension) Min(cbw->core.width, cbw->core.height)/2))
|
||||
return(NULL);
|
||||
|
||||
if (outerRegion == NULL) {
|
||||
/* save time by allocating scratch regions only once. */
|
||||
outerRegion = XCreateRegion();
|
||||
innerRegion = XCreateRegion();
|
||||
emptyRegion = XCreateRegion();
|
||||
}
|
||||
|
||||
rect.x = rect.y = 0;
|
||||
rect.width = cbw->core.width;
|
||||
rect.height = cbw->core.height;
|
||||
XUnionRectWithRegion( &rect, emptyRegion, outerRegion );
|
||||
rect.x = rect.y = cbw->winbutton.highlight_thickness;
|
||||
rect.width -= cbw->winbutton.highlight_thickness * 2;
|
||||
rect.height -= cbw->winbutton.highlight_thickness * 2;
|
||||
XUnionRectWithRegion( &rect, emptyRegion, innerRegion );
|
||||
XSubtractRegion( outerRegion, innerRegion, outerRegion );
|
||||
return outerRegion;
|
||||
}
|
||||
|
||||
/***************************
|
||||
*
|
||||
* Action Procedures
|
||||
*
|
||||
***************************/
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Set(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
if (cbw->winbutton.set)
|
||||
return;
|
||||
|
||||
cbw->winbutton.set= TRUE;
|
||||
if (XtIsRealized(w))
|
||||
PaintWinButtonWidget(w, (Region) NULL, TRUE);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Unset(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params;
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
if (!cbw->winbutton.set)
|
||||
return;
|
||||
|
||||
cbw->winbutton.set = FALSE;
|
||||
if (XtIsRealized(w)) {
|
||||
XClearWindow(XtDisplay(w), XtWindow(w));
|
||||
PaintWinButtonWidget(w, (Region) NULL, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Reset(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
if (cbw->winbutton.set) {
|
||||
cbw->winbutton.highlighted = HighlightNone;
|
||||
Unset(w, event, params, num_params);
|
||||
}
|
||||
else
|
||||
Unhighlight(w, event, params, num_params);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Highlight(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params;
|
||||
Cardinal *num_params;
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
if ( *num_params == (Cardinal) 0)
|
||||
cbw->winbutton.highlighted = HighlightWhenUnset;
|
||||
else {
|
||||
if ( *num_params != (Cardinal) 1)
|
||||
XtWarning("Too many parameters passed to highlight action table.");
|
||||
switch (params[0][0]) {
|
||||
case 'A':
|
||||
case 'a':
|
||||
cbw->winbutton.highlighted = HighlightAlways;
|
||||
break;
|
||||
default:
|
||||
cbw->winbutton.highlighted = HighlightWhenUnset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (XtIsRealized(w))
|
||||
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Unhighlight(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
cbw->winbutton.highlighted = HighlightNone;
|
||||
if (XtIsRealized(w))
|
||||
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Notify(w,event,params,num_params)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
String *params; /* unused */
|
||||
Cardinal *num_params; /* unused */
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget)w;
|
||||
|
||||
/* check to be sure state is still Set so that user can cancel
|
||||
the action (e.g. by moving outside the window, in the default
|
||||
bindings.
|
||||
*/
|
||||
if (cbw->winbutton.set)
|
||||
XtCallCallbackList(w, cbw->winbutton.callbacks, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Repaint the widget window
|
||||
*/
|
||||
|
||||
/************************
|
||||
*
|
||||
* REDISPLAY (DRAW)
|
||||
*
|
||||
************************/
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
Redisplay(w, event, region)
|
||||
Widget w;
|
||||
XEvent *event;
|
||||
Region region;
|
||||
{
|
||||
PaintWinButtonWidget(w, region, FALSE);
|
||||
}
|
||||
|
||||
/* Function Name: PaintWinButtonWidget
|
||||
* Description: Paints the winbutton widget.
|
||||
* Arguments: w - the winbutton widget.
|
||||
* region - region to paint (passed to the superclass).
|
||||
* change - did it change either set or highlight state?
|
||||
* Returns: none
|
||||
*/
|
||||
|
||||
static void
|
||||
PaintWinButtonWidget(w, region, change)
|
||||
Widget w;
|
||||
Region region;
|
||||
Boolean change;
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget) w;
|
||||
Boolean very_thick;
|
||||
GC norm_gc, rev_gc;
|
||||
int offset;
|
||||
|
||||
very_thick = cbw->winbutton.highlight_thickness >
|
||||
(Dimension)((Dimension) Min(cbw->core.width,
|
||||
cbw->core.height)/2);
|
||||
|
||||
offset = cbw->winbutton.shadow_thickness / 2;
|
||||
if (cbw->winbutton.set) {
|
||||
XClearWindow(XtDisplay(w), XtWindow(w));
|
||||
region = NULL; /* Force label to repaint text. */
|
||||
}
|
||||
else {
|
||||
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
|
||||
offset, offset, cbw->core.width - offset, offset);
|
||||
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
|
||||
offset, offset, offset, cbw->core.height - offset);
|
||||
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
|
||||
offset, cbw->core.height - offset + 1,
|
||||
cbw->core.width - offset, cbw->core.height - offset);
|
||||
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
|
||||
cbw->core.width - offset, offset + 1,
|
||||
cbw->core.width - offset, cbw->core.height - offset);
|
||||
}
|
||||
|
||||
if (cbw->winbutton.highlight_thickness <= 0)
|
||||
{
|
||||
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are set then use the same colors as if we are not highlighted.
|
||||
*/
|
||||
|
||||
if (cbw->winbutton.set == (cbw->winbutton.highlighted == HighlightNone)) {
|
||||
norm_gc = cbw->winbutton.inverse_GC;
|
||||
rev_gc = cbw->winbutton.normal_GC;
|
||||
}
|
||||
else {
|
||||
norm_gc = cbw->winbutton.normal_GC;
|
||||
rev_gc = cbw->winbutton.inverse_GC;
|
||||
}
|
||||
|
||||
if ( !( (!change && (cbw->winbutton.highlighted == HighlightNone)) ||
|
||||
((cbw->winbutton.highlighted == HighlightWhenUnset) &&
|
||||
(cbw->winbutton.set))) ) {
|
||||
if (very_thick) {
|
||||
cbw->winlabel.normal_GC = norm_gc; /* Give the label the right GC. */
|
||||
XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc,
|
||||
0, 0, cbw->core.width, cbw->core.height);
|
||||
}
|
||||
else {
|
||||
/* wide lines are centered on the path, so indent it */
|
||||
int offset = cbw->winbutton.highlight_thickness/2;
|
||||
XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, offset, offset,
|
||||
cbw->core.width - cbw->winbutton.highlight_thickness,
|
||||
cbw->core.height - cbw->winbutton.highlight_thickness);
|
||||
}
|
||||
}
|
||||
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
|
||||
}
|
||||
|
||||
static void
|
||||
Destroy(w)
|
||||
Widget w;
|
||||
{
|
||||
WinButtonWidget cbw = (WinButtonWidget) w;
|
||||
|
||||
/* so WinLabel can release it */
|
||||
if (cbw->winlabel.normal_GC == cbw->winbutton.normal_GC)
|
||||
XtReleaseGC( w, cbw->winbutton.inverse_GC );
|
||||
else
|
||||
XtReleaseGC( w, cbw->winbutton.normal_GC );
|
||||
}
|
||||
|
||||
/*
|
||||
* Set specified arguments into widget
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static Boolean
|
||||
SetValues (current, request, new)
|
||||
Widget current, request, new;
|
||||
{
|
||||
WinButtonWidget oldcbw = (WinButtonWidget) current;
|
||||
WinButtonWidget cbw = (WinButtonWidget) new;
|
||||
Boolean redisplay = False;
|
||||
|
||||
if ( oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
|
||||
/* about to become insensitive */
|
||||
cbw->winbutton.set = FALSE;
|
||||
cbw->winbutton.highlighted = HighlightNone;
|
||||
redisplay = TRUE;
|
||||
}
|
||||
|
||||
if ( (oldcbw->winlabel.foreground != cbw->winlabel.foreground) ||
|
||||
(oldcbw->core.background_pixel != cbw->core.background_pixel) ||
|
||||
(oldcbw->winbutton.highlight_thickness !=
|
||||
cbw->winbutton.highlight_thickness) ||
|
||||
(oldcbw->winlabel.font != cbw->winlabel.font) )
|
||||
{
|
||||
if (oldcbw->winlabel.normal_GC == oldcbw->winbutton.normal_GC)
|
||||
/* WinLabel has release one of these */
|
||||
XtReleaseGC(new, cbw->winbutton.inverse_GC);
|
||||
else
|
||||
XtReleaseGC(new, cbw->winbutton.normal_GC);
|
||||
|
||||
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
|
||||
cbw->core.background_pixel);
|
||||
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
|
||||
cbw->winlabel.foreground);
|
||||
XtReleaseGC(new, cbw->winlabel.normal_GC);
|
||||
cbw->winlabel.normal_GC = (cbw->winbutton.set
|
||||
? cbw->winbutton.inverse_GC
|
||||
: cbw->winbutton.normal_GC);
|
||||
|
||||
redisplay = True;
|
||||
}
|
||||
|
||||
if ( XtIsRealized(new)
|
||||
&& oldcbw->winbutton.shape_style != cbw->winbutton.shape_style
|
||||
&& !ShapeButton(cbw, TRUE))
|
||||
{
|
||||
cbw->winbutton.shape_style = oldcbw->winbutton.shape_style;
|
||||
}
|
||||
|
||||
return (redisplay);
|
||||
}
|
||||
|
||||
static void ClassInitialize()
|
||||
{
|
||||
XawInitializeWidgetSet();
|
||||
XtSetTypeConverter( XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
|
||||
NULL, 0, XtCacheNone, NULL );
|
||||
}
|
||||
|
||||
|
||||
static Boolean
|
||||
ShapeButton(cbw, checkRectangular)
|
||||
WinButtonWidget cbw;
|
||||
Boolean checkRectangular;
|
||||
{
|
||||
Dimension corner_size;
|
||||
|
||||
if ( (cbw->winbutton.shape_style == XawShapeRoundedRectangle) ) {
|
||||
corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width
|
||||
: cbw->core.height;
|
||||
corner_size = (int) (corner_size * cbw->winbutton.corner_round) / 100;
|
||||
}
|
||||
|
||||
if (checkRectangular || cbw->winbutton.shape_style != XawShapeRectangle) {
|
||||
if (!XmuReshapeWidget((Widget) cbw, cbw->winbutton.shape_style,
|
||||
corner_size, corner_size)) {
|
||||
cbw->winbutton.shape_style = XawShapeRectangle;
|
||||
return(False);
|
||||
}
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static void Realize(w, valueMask, attributes)
|
||||
Widget w;
|
||||
Mask *valueMask;
|
||||
XSetWindowAttributes *attributes;
|
||||
{
|
||||
(*winButtonWidgetClass->core_class.superclass->core_class.realize)
|
||||
(w, valueMask, attributes);
|
||||
|
||||
ShapeButton( (WinButtonWidget) w, FALSE);
|
||||
}
|
||||
|
||||
static void Resize(w)
|
||||
Widget w;
|
||||
{
|
||||
if (XtIsRealized(w))
|
||||
ShapeButton( (WinButtonWidget) w, FALSE);
|
||||
|
||||
(*winButtonWidgetClass->core_class.superclass->core_class.resize)(w);
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/***********************************************************
|
||||
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/28/93 David Metcalfe (david@prism.demon.co.uk)
|
||||
* Created from Command widget and added 3D effect
|
||||
*/
|
||||
|
||||
#ifndef _WinButton_h
|
||||
#define _WinButton_h
|
||||
|
||||
#include "WinLabel.h"
|
||||
|
||||
/* WinButton 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
|
||||
shadowHighlight ShadowHighlight Pixel White
|
||||
shadowShade ShadowShade Pixel Grey25
|
||||
shadowThickness ShadowThickness Dimension 2
|
||||
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 XtNshadowThickness "shadowThickness"
|
||||
#define XtCShadowThickness "ShadowThickness"
|
||||
#define XtNshadowHighlight "shadowHighlight"
|
||||
#define XtCShadowHighlight "ShadowHighlight"
|
||||
#define XtNshadowShade "shadowShade"
|
||||
#define XtCShadowShade "ShadowShade"
|
||||
|
||||
#define XawShapeRectangle XmuShapeRectangle
|
||||
#define XawShapeOval XmuShapeOval
|
||||
#define XawShapeEllipse XmuShapeEllipse
|
||||
#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
|
||||
|
||||
extern WidgetClass winButtonWidgetClass;
|
||||
|
||||
typedef struct _WinButtonClassRec *WinButtonWidgetClass;
|
||||
typedef struct _WinButtonRec *WinButtonWidget;
|
||||
|
||||
#endif /* _WinButton_h */
|
||||
/* DON'T ADD STUFF AFTER THIS */
|
|
@ -1,123 +0,0 @@
|
|||
/***********************************************************
|
||||
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/28/93 David Metcalfe (david@prism.demon.co.uk)
|
||||
* Created from Command widget and added 3D effect
|
||||
*/
|
||||
|
||||
/*
|
||||
* WinButtonP.h - Private definitions for WinButton widget
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WinButtonP_h
|
||||
#define _WinButtonP_h
|
||||
|
||||
#include "WinButton.h"
|
||||
#include "WinLabelP.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* WinButton 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 WinButton widget class record */
|
||||
typedef struct _WinButtonClass
|
||||
{
|
||||
int makes_compiler_happy; /* not used */
|
||||
} WinButtonClassPart;
|
||||
|
||||
/* Full class record declaration */
|
||||
typedef struct _WinButtonClassRec {
|
||||
CoreClassPart core_class;
|
||||
SimpleClassPart simple_class;
|
||||
WinLabelClassPart winlabel_class;
|
||||
WinButtonClassPart winbutton_class;
|
||||
} WinButtonClassRec;
|
||||
|
||||
extern WinButtonClassRec winButtonClassRec;
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* Instance (widget) structure
|
||||
*
|
||||
**************************************/
|
||||
|
||||
/* New fields for the WinButton widget record */
|
||||
typedef struct {
|
||||
/* resources */
|
||||
Dimension highlight_thickness;
|
||||
Dimension shadow_thickness;
|
||||
Pixel shadow_shade;
|
||||
Pixel shadow_highlight;
|
||||
XtCallbackList callbacks;
|
||||
|
||||
/* private state */
|
||||
Pixmap gray_pixmap;
|
||||
GC normal_GC;
|
||||
GC inverse_GC;
|
||||
GC shadow_highlight_gc;
|
||||
GC shadow_shade_gc;
|
||||
Boolean set;
|
||||
XtCommandHighlight highlighted;
|
||||
/* more resources */
|
||||
int shape_style;
|
||||
Dimension corner_round;
|
||||
} WinButtonPart;
|
||||
|
||||
|
||||
/* XtEventsPtr eventTable;*/
|
||||
|
||||
|
||||
/* Full widget declaration */
|
||||
typedef struct _WinButtonRec {
|
||||
CorePart core;
|
||||
SimplePart simple;
|
||||
WinLabelPart winlabel;
|
||||
WinButtonPart winbutton;
|
||||
} WinButtonRec;
|
||||
|
||||
#endif /* _WinButtonP_h */
|
||||
|
||||
|
|
@ -1,86 +1,351 @@
|
|||
/*
|
||||
* Interface code to button widgets
|
||||
/* File: button.c -- MS-Windows(tm) compatible "Button" replacement widget
|
||||
*
|
||||
* Copyright David W. Metcalfe, 1993
|
||||
* programmed by Johannes Ruscheinski for the Linux WABI
|
||||
* project.
|
||||
* (C) 1993 by Johannes Ruscheinski
|
||||
*
|
||||
* Modifications by David Metcalfe
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include "WinButton.h"
|
||||
#include "windows.h"
|
||||
#include "heap.h"
|
||||
#include <windows.h>
|
||||
#include "win.h"
|
||||
|
||||
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
|
||||
XtPointer call_data);
|
||||
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
|
||||
|
||||
void BUTTON_CreateButton(LPSTR className, LPSTR buttonLabel, HWND hwnd)
|
||||
static COLORREF color_windowframe, color_btnface, color_btnshadow,
|
||||
color_btntext, color_btnhighlight;
|
||||
|
||||
static BOOL pressed;
|
||||
|
||||
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
|
||||
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
|
||||
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
|
||||
#define DIM(array) ((sizeof array)/(sizeof array[0]))
|
||||
|
||||
static LONG PB_Paint(HWND hWnd);
|
||||
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG PB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam);
|
||||
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc);
|
||||
static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
||||
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
|
||||
DWORD style;
|
||||
char widgetName[15];
|
||||
LONG (*paintfn)();
|
||||
LONG (*lButtonDownfn)();
|
||||
LONG (*lButtonUpfn)();
|
||||
LONG (*lButtonDblClkfn)();
|
||||
} BTNFN;
|
||||
|
||||
#ifdef DEBUG_BUTTON
|
||||
printf("button: label = %s, x = %d, y = %d\n", buttonLabel,
|
||||
wndPtr->rectClient.left, wndPtr->rectClient.top);
|
||||
printf(" width = %d, height = %d\n",
|
||||
wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
|
||||
#define MAX_BTN_TYPE 2
|
||||
|
||||
static BTNFN btnfn[MAX_BTN_TYPE] =
|
||||
{
|
||||
{
|
||||
(LONG(*)())PB_Paint, /* BS_PUSHBUTTON */
|
||||
(LONG(*)())PB_LButtonDown,
|
||||
(LONG(*)())PB_LButtonUp,
|
||||
(LONG(*)())PB_LButtonDblClk
|
||||
},
|
||||
{
|
||||
(LONG(*)())PB_Paint, /* BS_DEFPUSHBUTTON */
|
||||
(LONG(*)())PB_LButtonDown,
|
||||
(LONG(*)())PB_LButtonUp,
|
||||
(LONG(*)())PB_LButtonDblClk
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
|
||||
{
|
||||
LONG lResult = 0;
|
||||
HDC hDC;
|
||||
RECT rc;
|
||||
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
LONG style = wndPtr->dwStyle & 0x0000000F;
|
||||
|
||||
switch (uMsg) {
|
||||
/* case WM_GETDLGCODE:
|
||||
lResult = DLGC_BUTTON;
|
||||
break;
|
||||
*/
|
||||
case WM_ENABLE:
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
if (style < 0L || style >= (LONG)DIM(btnfn))
|
||||
lResult = -1L;
|
||||
else
|
||||
{
|
||||
/* initialise colours used for button rendering: */
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_btnface = GetSysColor(COLOR_BTNFACE);
|
||||
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
|
||||
color_btntext = GetSysColor(COLOR_BTNTEXT);
|
||||
color_btnhighlight = GetSysColor(COLOR_BTNHIGHLIGHT);
|
||||
|
||||
pressed = FALSE;
|
||||
lResult = 0L;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
(btnfn[style].paintfn)(hWnd);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
(btnfn[style].lButtonDownfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
(btnfn[style].lButtonUpfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
(btnfn[style].lButtonDblClkfn)(hWnd, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
break;
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
|
||||
color_btnface = GetSysColor(COLOR_BTNFACE);
|
||||
color_btnshadow = GetSysColor(COLOR_BTNSHADOW);
|
||||
color_btntext = GetSysColor(COLOR_BTNTEXT);
|
||||
color_btnhighlight = GetSysColor(COLOR_BTNHIGHLIGHT);
|
||||
InvalidateRect(hWnd, NULL, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
GlobalUnlock(hWnd);
|
||||
return lResult;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Push Button Functions
|
||||
*/
|
||||
|
||||
static LONG PB_Paint(HWND hWnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
GetClientRect(hWnd, &rc);
|
||||
if (pressed)
|
||||
DrawPressedPushButton(hDC, hWnd, rc);
|
||||
else
|
||||
DrawRaisedPushButton(hDC, hWnd, rc);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
|
||||
static LONG PB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
/* SetFocus(hWnd); */
|
||||
SetCapture(hWnd);
|
||||
pressed = TRUE;
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG PB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
pressed = FALSE;
|
||||
ReleaseCapture();
|
||||
GetClientRect(hWnd, &rc);
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_CLICKED);
|
||||
InvalidateRect(hWnd, NULL, FALSE);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
static LONG PB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
GetClientRect(hWnd, &rc);
|
||||
if (PtInRect(&rc, MAKEPOINT(lParam)))
|
||||
NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED);
|
||||
}
|
||||
|
||||
static void DrawRaisedPushButton(HDC hDC, HWND hButton, RECT rc)
|
||||
{
|
||||
HPEN hOldPen, hFramePen;
|
||||
HBRUSH hOldBrush, hShadowBrush, hHighlightBrush, hBackgrndBrush;
|
||||
HRGN rgn1, rgn2, rgn;
|
||||
int len;
|
||||
static char text[50+1];
|
||||
POINT points[6];
|
||||
DWORD dwTextSize;
|
||||
int delta;
|
||||
TEXTMETRIC tm;
|
||||
int i;
|
||||
|
||||
hFramePen = CreatePen(PS_SOLID, 1, color_windowframe);
|
||||
hBackgrndBrush = CreateSolidBrush(color_btnface);
|
||||
|
||||
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hFramePen);
|
||||
hOldBrush = (HBRUSH)SelectObject(hDC, (HANDLE)hBackgrndBrush);
|
||||
SetBkMode(hDC, TRANSPARENT);
|
||||
|
||||
rgn = CreateRectRgn(0, 0, 0, 0);
|
||||
rgn1 = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
SendMessage(GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hButton, CTLCOLOR_BTN));
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
/* draw button label, if any: */
|
||||
len = GetWindowText(hButton, text, sizeof text);
|
||||
if (len >= 1) {
|
||||
rc.left--; rc.bottom--;
|
||||
DrawText(hDC, text, len, &rc,
|
||||
DT_SINGLELINE | DT_CENTER| DT_VCENTER);
|
||||
}
|
||||
|
||||
/* draw button highlight */
|
||||
points[0].x = rc.left+2;
|
||||
points[0].y = rc.bottom;
|
||||
points[1].x = rc.left+4;
|
||||
points[1].y = rc.bottom-2;
|
||||
points[2].x = rc.left+4;
|
||||
points[2].y = rc.top+3;
|
||||
points[3].x = rc.right-3;
|
||||
points[3].y = rc.top+3;
|
||||
points[4].x = rc.right-1;
|
||||
points[4].y = rc.top+1;
|
||||
points[5].x = rc.left+2;
|
||||
points[5].y = rc.top+1;
|
||||
hHighlightBrush = CreateSolidBrush(color_btnhighlight);
|
||||
rgn2 = CreatePolygonRgn(points, DIM(points), ALTERNATE);
|
||||
CombineRgn(rgn, rgn1, rgn2, RGN_AND);
|
||||
FillRgn(hDC, rgn2, hHighlightBrush);
|
||||
|
||||
/* draw button shadow: */
|
||||
points[0].x = rc.left+2;
|
||||
points[0].y = rc.bottom;
|
||||
points[1].x = rc.left+4;
|
||||
points[1].y = rc.bottom-2;
|
||||
points[2].x = rc.right-3;
|
||||
points[2].y = rc.bottom-2;
|
||||
points[3].x = rc.right-3;
|
||||
points[3].y = rc.top+3;
|
||||
points[4].x = rc.right-1;
|
||||
points[4].y = rc.top;
|
||||
points[5].x = rc.right-1;
|
||||
points[5].y = rc.bottom;
|
||||
hShadowBrush = CreateSolidBrush(color_btnshadow);
|
||||
rgn2 = CreatePolygonRgn(points, DIM(points), ALTERNATE);
|
||||
CombineRgn(rgn, rgn1, rgn2, RGN_AND);
|
||||
FillRgn(hDC, rgn2, hShadowBrush);
|
||||
|
||||
#if 0
|
||||
/* do we have the focus? */
|
||||
if (len >= 1 && GetFocus() == hButton) {
|
||||
dwTextSize = GetTextExtent(hDC, text, len);
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize) + 1) >> 1;
|
||||
rc.left += delta; rc.right -= delta;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
delta = ((rc.bottom - rc.top) -
|
||||
tm.tmHeight + tm.tmInternalLeading) >> 1;
|
||||
rc.top += delta; rc.bottom -= delta;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!wndPtr)
|
||||
return;
|
||||
|
||||
style = wndPtr->dwStyle & 0x0000000F;
|
||||
|
||||
switch (style)
|
||||
{
|
||||
case BS_PUSHBUTTON:
|
||||
case BS_DEFPUSHBUTTON:
|
||||
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
|
||||
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
|
||||
winButtonWidgetClass,
|
||||
parentPtr->winWidget,
|
||||
XtNlabel, buttonLabel,
|
||||
XtNx, wndPtr->rectClient.left,
|
||||
XtNy, wndPtr->rectClient.top,
|
||||
XtNwidth, wndPtr->rectClient.right -
|
||||
wndPtr->rectClient.left,
|
||||
XtNheight, wndPtr->rectClient.bottom -
|
||||
wndPtr->rectClient.top,
|
||||
XtVaTypedArg, XtNbackground, XtRString,
|
||||
"grey70", strlen("grey75")+1,
|
||||
NULL);
|
||||
|
||||
XtAddCallback(wndPtr->winWidget, XtNcallback,
|
||||
BUTTON_WinButtonCallback, (XtPointer) hwnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("CreateButton: Unsupported button style %lX\n",
|
||||
wndPtr->dwStyle);
|
||||
}
|
||||
|
||||
GlobalUnlock(hwnd);
|
||||
GlobalUnlock(wndPtr->hwndParent);
|
||||
SelectObject(hDC, (HANDLE)hOldPen);
|
||||
SelectObject(hDC, (HANDLE)hOldBrush);
|
||||
DeleteObject((HANDLE)hFramePen);
|
||||
DeleteObject((HANDLE)hShadowBrush);
|
||||
DeleteObject((HANDLE)hBackgrndBrush);
|
||||
DeleteObject((HANDLE)rgn1);
|
||||
#if 0
|
||||
DeleteObject((HANDLE)rgn2);
|
||||
DeleteObject((HANDLE)rgn);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
|
||||
XtPointer call_data)
|
||||
|
||||
static void DrawPressedPushButton(HDC hDC, HWND hButton, RECT rc)
|
||||
{
|
||||
HWND hwnd = (HWND) client_data;
|
||||
WND *wndPtr;
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
HPEN hOldPen, hShadowPen, hFramePen;
|
||||
HBRUSH hOldBrush, hBackgrndBrush;
|
||||
HRGN rgn1, rgn2, rgn;
|
||||
int len;
|
||||
static char text[50+1];
|
||||
DWORD dwTextSize;
|
||||
int delta;
|
||||
TEXTMETRIC tm;
|
||||
|
||||
CallWindowProc(wndPtr->lpfnWndProc, wndPtr->hwndParent, WM_COMMAND,
|
||||
wndPtr->wIDmenu, MAKELPARAM(hwnd, BN_CLICKED));
|
||||
hFramePen = CreatePen(PS_SOLID, 1, color_windowframe);
|
||||
hBackgrndBrush = CreateSolidBrush(color_btnface);
|
||||
|
||||
GlobalUnlock(hwnd);
|
||||
hOldBrush = (HBRUSH)SelectObject(hDC, (HANDLE)hBackgrndBrush);
|
||||
hOldPen = (HPEN)SelectObject(hDC, (HANDLE)hFramePen);
|
||||
SetBkMode(hDC, TRANSPARENT);
|
||||
|
||||
/* give parent a chance to alter parameters: */
|
||||
SendMessage(GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
|
||||
MAKELPARAM(hButton, CTLCOLOR_BTN));
|
||||
Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
|
||||
|
||||
/* draw button shadow: */
|
||||
hShadowPen = CreatePen(PS_SOLID, 1, color_btnshadow);
|
||||
SelectObject(hDC, (HANDLE)hShadowPen);
|
||||
MoveTo(hDC, rc.left+1, rc.bottom-1);
|
||||
LineTo(hDC, rc.left+1, rc.top+1);
|
||||
LineTo(hDC, rc.right-1, rc.top+1);
|
||||
|
||||
/* draw button label, if any: */
|
||||
len = GetWindowText(hButton, text, sizeof text);
|
||||
if (len >= 1) {
|
||||
rc.top++; rc.left++;
|
||||
DrawText(hDC, text, len, &rc,
|
||||
DT_SINGLELINE | DT_CENTER| DT_VCENTER);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* do we have the focus? */
|
||||
if (len >= 1 && GetFocus() == hButton) {
|
||||
dwTextSize = GetTextExtent(hDC, text, len);
|
||||
delta = ((rc.right - rc.left) - LOWORD(dwTextSize)) >> 1;
|
||||
rc.left += delta; rc.right -= delta;
|
||||
GetTextMetrics(hDC, &tm);
|
||||
delta = ((rc.bottom - rc.top) -
|
||||
tm.tmHeight + tm.tmInternalLeading) >> 1;
|
||||
rc.top += delta; rc.bottom -= delta;
|
||||
DrawFocusRect(hDC, &rc);
|
||||
}
|
||||
#endif
|
||||
|
||||
SelectObject(hDC, (HANDLE)hOldPen);
|
||||
SelectObject(hDC, (HANDLE)hOldBrush);
|
||||
DeleteObject((HANDLE)hBackgrndBrush);
|
||||
DeleteObject(SelectObject(hDC, (HANDLE)hFramePen));
|
||||
DeleteObject(SelectObject(hDC, (HANDLE)hShadowPen));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ MENU_SelectionCallback(Widget w, XtPointer client_data, XtPointer call_data)
|
|||
menu = MENU_FindMenuBar(this_item);
|
||||
if (menu != NULL)
|
||||
{
|
||||
wndPtr = (WND *) GlobalLock(menu->ownerWnd);
|
||||
wndPtr = WIN_FindWndPtr(menu->ownerWnd);
|
||||
if (wndPtr == NULL)
|
||||
return;
|
||||
|
||||
|
@ -152,8 +152,6 @@ MENU_SelectionCallback(Widget w, XtPointer client_data, XtPointer call_data)
|
|||
|
||||
CallWindowProc(wndPtr->lpfnWndProc, menu->ownerWnd, WM_COMMAND,
|
||||
this_item->item_id, 0);
|
||||
|
||||
GlobalUnlock(menu->ownerWnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
#include "win.h"
|
||||
|
||||
|
||||
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam );
|
||||
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||
static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam );
|
||||
|
||||
|
@ -19,8 +18,8 @@ static LONG WIDGETS_StaticWndProc( HWND hwnd, WORD message,
|
|||
|
||||
static WNDCLASS WIDGETS_BuiltinClasses[NB_BUILTIN_CLASSES] =
|
||||
{
|
||||
{ 0, WIDGETS_ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
|
||||
{ 0, WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
|
||||
{ 0, (LONG(*)())ButtonWndProc, 0, 0, 0, 0, 0, 0, NULL, "BUTTON" },
|
||||
{ 0, (LONG(*)())WIDGETS_StaticWndProc, 0, 0, 0, 0, 0, 0, NULL, "STATIC" }
|
||||
};
|
||||
|
||||
static FARPROC WndProc32[NB_BUILTIN_CLASSES];
|
||||
|
@ -38,8 +37,6 @@ BOOL WIDGETS_Init()
|
|||
|
||||
for (i = 0; i < NB_BUILTIN_CLASSES; i++, pClass++)
|
||||
{
|
||||
WndProc32[i] = pClass->lpfnWndProc;
|
||||
pClass->lpfnWndProc = (FARPROC) i+1;
|
||||
if (!RegisterClass(pClass)) return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -60,39 +57,6 @@ LONG WIDGETS_Call32WndProc( FARPROC func, HWND hwnd, WORD message,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_ButtonWndProc
|
||||
*/
|
||||
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
switch(message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
BeginPaint( hwnd, &ps );
|
||||
EndPaint( hwnd, &ps );
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
WND *wndParent;
|
||||
wndParent = WIN_FindWndPtr(hwnd);
|
||||
CallWindowProc(wndParent->lpfnWndProc, hwnd, message, wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
default:
|
||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* WIDGETS_StaticWndProc
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
CFLAGS=-g -I../include # -DUSE_READLINE
|
||||
LIBS= readline/libedit.a
|
||||
OBJS=dbg.tab.o hash.o lex.yy.o info.o i386-pinsn.o
|
||||
|
||||
debugger.o: ${OBJS} readline/libedit.a
|
||||
(cd readline; make)
|
||||
ld -r -o debugger.o ${OBJS} $(LIBS)
|
||||
|
||||
|
||||
readline/libedit.a:
|
||||
(cd readline; make)
|
||||
|
||||
dbg.tab.o: dbg.tab.c
|
||||
gcc $(CFLAGS) -DYYDEBUG=1 -c dbg.tab.c
|
||||
|
||||
lex.yy.o: lex.yy.c
|
||||
gcc $(CFLAGS) -I. -c lex.yy.c
|
||||
|
||||
|
||||
lex.yy.c: debug.l
|
||||
flex -I debug.l
|
||||
|
||||
dbg.tab.c dbg.tab.h: dbg.y
|
||||
bison -v -d dbg.y
|
||||
|
||||
dtest: dtest.o debugger.o
|
||||
gcc -o dtest dtest.o debugger.o
|
||||
|
||||
clean:
|
||||
rm -f *.o main dbg.tab.* lex.yy.* *.output *~ *# dtest
|
||||
(cd readline; make clean)
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
This is the core of the Wine debugger. Many pieces have been
|
||||
shamelessly stolen - the reverse assember was stolen from gdb more or
|
||||
less intact. It turns out that there are two variables that are set
|
||||
differently if you are reverse assembling 16 bit code, and on the
|
||||
whole it seems to work. There may be bugs for all I know.
|
||||
|
||||
As far as non-linux systems are concerned, I simply ripped off
|
||||
the linux configuration files from gdb. Other systems may be close
|
||||
enough for these to work properly, but some tweaking may be required.
|
||||
|
||||
I apologize for the non-portability of this, but I wrote the
|
||||
whole thing in about 4 hours, most of the time spent debugging a
|
||||
stupid mistake in the parser.
|
||||
|
||||
-Eric
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
This is a list of things that theoretically should be possible in some
|
||||
way or another. No commitment to actually do these, but these sound
|
||||
possible to me right now. In no particular order. If someone else
|
||||
wants to dig in, feel free.
|
||||
|
||||
1) Some kind of crude display capability. Not too hard, I guess.
|
||||
Just keep a list of addresses, counts and formats that we
|
||||
want displayed each time we enter the debugger.
|
||||
|
||||
2) Some kind of single step capability.
|
||||
I am not sure - I think you just set a flag
|
||||
in AFLAGS, and you get an interrupt back again.
|
||||
The signal type would proabably be different, however,
|
||||
but Wine could easily be patched to accept this one as well.
|
||||
The main problem with this is that gdb normally runs in a
|
||||
separate process so it is easy to single step second process.
|
||||
Here we are all part of the same process. Perhaps we could look
|
||||
ahead to the end of the instruction and set another breakpoint?
|
||||
|
||||
3) Some kind of breakpoint capability.
|
||||
Requires single step. When we restart, we
|
||||
remove the breakpoint, single step one instruction
|
||||
replace the breakpoint, and then continue.
|
||||
|
||||
4) Some kind of watchpoint capability. Pretty easy once we have a
|
||||
single step capability, but we end up running the program
|
||||
really slowly one instruction at a time.
|
||||
|
||||
5) Some kind of .wdbinit file.
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/* ANSI and traditional C compatability macros
|
||||
Copyright 1991 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ANSI and traditional C compatibility macros
|
||||
|
||||
ANSI C is assumed if __STDC__ is #defined.
|
||||
|
||||
Macro ANSI C definition Traditional C definition
|
||||
----- ---- - ---------- ----------- - ----------
|
||||
PTR `void *' `char *'
|
||||
LONG_DOUBLE `long double' `double'
|
||||
CONST `const' `'
|
||||
VOLATILE `volatile' `'
|
||||
SIGNED `signed' `'
|
||||
PTRCONST `void *const' `char *'
|
||||
|
||||
DEFUN(name, arglist, args)
|
||||
|
||||
Defines function NAME.
|
||||
|
||||
ARGLIST lists the arguments, separated by commas and enclosed in
|
||||
parentheses. ARGLIST becomes the argument list in traditional C.
|
||||
|
||||
ARGS list the arguments with their types. It becomes a prototype in
|
||||
ANSI C, and the type declarations in traditional C. Arguments should
|
||||
be separated with `AND'. For functions with a variable number of
|
||||
arguments, the last thing listed should be `DOTS'.
|
||||
|
||||
DEFUN_VOID(name)
|
||||
|
||||
Defines a function NAME, which takes no arguments.
|
||||
|
||||
EXFUN(name, prototype)
|
||||
|
||||
Is used in an external function declaration.
|
||||
In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
|
||||
parentheses). In traditional C it is `NAME()'.
|
||||
For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
|
||||
|
||||
For example:
|
||||
extern int EXFUN(printf, (CONST char *format DOTS));
|
||||
int DEFUN(fprintf, (stream, format),
|
||||
FILE *stream AND CONST char *format DOTS) { ... }
|
||||
void DEFUN_VOID(abort) { ... }
|
||||
*/
|
||||
|
||||
#ifndef _ANSIDECL_H
|
||||
|
||||
#define _ANSIDECL_H 1
|
||||
|
||||
|
||||
/* Every source file includes this file,
|
||||
so they will all get the switch for lint. */
|
||||
/* LINTLIBRARY */
|
||||
|
||||
|
||||
#ifdef __STDC__
|
||||
|
||||
#define PTR void *
|
||||
#define PTRCONST void *CONST
|
||||
#define LONG_DOUBLE long double
|
||||
|
||||
#define AND ,
|
||||
#define NOARGS void
|
||||
#define CONST const
|
||||
#define VOLATILE volatile
|
||||
#define SIGNED signed
|
||||
#define DOTS , ...
|
||||
|
||||
#define EXFUN(name, proto) name proto
|
||||
#define DEFUN(name, arglist, args) name(args)
|
||||
#define DEFUN_VOID(name) name(NOARGS)
|
||||
|
||||
#define PROTO(type, name, arglist) type name arglist
|
||||
|
||||
/* We could use the EXFUN macro to handle prototypes, but
|
||||
the name is misleading and the result is ugly. So just define a
|
||||
simple macro to handle the parameter lists, as in:
|
||||
|
||||
static int foo PARAMS ((int, char));
|
||||
|
||||
EXFUN would do it like this:
|
||||
|
||||
static int EXFUN (foo, (int, char));
|
||||
|
||||
but the function is not external... EXFUN should be considered
|
||||
obsolete, and new code written to use PARAMS. */
|
||||
|
||||
#define PARAMS(paramlist) paramlist
|
||||
|
||||
#else /* Not ANSI C. */
|
||||
|
||||
#define PTR char *
|
||||
#define PTRCONST PTR
|
||||
#define LONG_DOUBLE double
|
||||
|
||||
#define AND ;
|
||||
#define NOARGS
|
||||
#define CONST
|
||||
#define VOLATILE
|
||||
#define SIGNED
|
||||
#define DOTS
|
||||
|
||||
#define EXFUN(name, proto) name()
|
||||
#define DEFUN(name, arglist, args) name arglist args;
|
||||
#define DEFUN_VOID(name) name()
|
||||
#define PROTO(type, name, arglist) type name ()
|
||||
#define PARAMS(paramlist) ()
|
||||
|
||||
#endif /* ANSI C. */
|
||||
|
||||
#endif /* ansidecl.h */
|
|
@ -0,0 +1,151 @@
|
|||
|
||||
%{
|
||||
|
||||
/* Parser for command lines in the Wine debugger
|
||||
*
|
||||
* Version 1.0
|
||||
* Eric Youngdale
|
||||
* 9/93
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#define YYSTYPE int
|
||||
|
||||
#include "regpos.h"
|
||||
extern FILE * yyin;
|
||||
unsigned int * regval = NULL;
|
||||
unsigned int dbg_mask = 0;
|
||||
unsigned int dbg_mode = 0;
|
||||
|
||||
void issue_prompt();
|
||||
%}
|
||||
|
||||
|
||||
%token CONT
|
||||
%token QUIT
|
||||
%token HELP
|
||||
%token INFO
|
||||
%token STACK
|
||||
%token REG
|
||||
%token REGS
|
||||
%token NUM
|
||||
%token SET
|
||||
%token PRINT
|
||||
%token IDENTIFIER
|
||||
%token NO_SYMBOL
|
||||
%token SYMBOLFILE
|
||||
%token DEFINE
|
||||
|
||||
%%
|
||||
|
||||
input: /* empty */
|
||||
| input line { issue_prompt(); }
|
||||
|
||||
line: '\n'
|
||||
| infocmd '\n'
|
||||
| error '\n' {yyerrok; }
|
||||
| QUIT '\n' { exit(0); };
|
||||
| HELP '\n' { dbg_help(); };
|
||||
| CONT '\n' { return; };
|
||||
| SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); };
|
||||
| DEFINE IDENTIFIER expr '\n' { add_hash($2, $3); };
|
||||
| x_command
|
||||
| print_command
|
||||
| deposit_command
|
||||
|
||||
deposit_command:
|
||||
SET REG '=' expr '\n' { regval[$2] = $4; }
|
||||
| SET '*' expr '=' expr '\n' { *((unsigned int *) $3) = $5; }
|
||||
| SET symbol '=' expr '\n' { *((unsigned int *) $2) = $4; }
|
||||
|
||||
|
||||
x_command:
|
||||
'x' expr '\n' { examine_memory($2, 1, 'x'); };
|
||||
| 'x' '/' fmt expr '\n' { examine_memory($4, 1, $3); };
|
||||
| 'x' '/' NUM fmt expr '\n' { examine_memory($5, $3, $4); };
|
||||
|
||||
print_command:
|
||||
PRINT expr '\n' { examine_memory(((unsigned int) &$2 ), 1, 'x'); };
|
||||
|
||||
fmt: 'x' { $$ = 'x'; }
|
||||
| 'd' { $$ = 'd'; }
|
||||
| 'i' { $$ = 'i'; }
|
||||
| 'w' { $$ = 'w'; }
|
||||
| 's' { $$ = 's'; }
|
||||
| 'c' { $$ = 'c'; }
|
||||
| 'b' { $$ = 'b'; }
|
||||
|
||||
symbol: IDENTIFIER { $$ = find_hash($1);
|
||||
if($$ == 0xffffffff) {
|
||||
fprintf(stderr,"Symbol %s not found\n", $1);
|
||||
YYERROR;
|
||||
};
|
||||
};
|
||||
|
||||
expr: NUM { $$ = $1; }
|
||||
| REG { $$ = regval[$1]; }
|
||||
| symbol { $$ = *((unsigned int *) $1); }
|
||||
| expr '+' NUM { $$ = $1 + $3; }
|
||||
| expr '-' NUM { $$ = $1 - $3; };
|
||||
| '(' expr ')' { $$ = $2; };
|
||||
| '*' expr { $$ = *((unsigned int *) $2); };
|
||||
|
||||
infocmd: INFO REGS { info_reg(); }
|
||||
| INFO STACK { info_stack(); };
|
||||
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
issue_prompt(){
|
||||
#ifndef USE_READLINE
|
||||
fprintf(stderr,"Wine-dbg>");
|
||||
#endif
|
||||
}
|
||||
|
||||
static int loaded_symbols = 0;
|
||||
|
||||
void
|
||||
wine_debug(int * regs)
|
||||
{
|
||||
int i;
|
||||
#ifdef YYDEBUG
|
||||
yydebug = 0;
|
||||
#endif
|
||||
yyin = stdin;
|
||||
regval = regs;
|
||||
|
||||
/* This only works for linux - NetBSD will need something different here. */
|
||||
if((SC_CS & 7) != 7) {
|
||||
dbg_mask = 0xffffffff;
|
||||
dbg_mode = 32;
|
||||
} else {
|
||||
dbg_mask = 0xffff;
|
||||
dbg_mode = 16;
|
||||
};
|
||||
|
||||
/* This is intended to read the entry points from the Windows image, and
|
||||
insert them in the hash table. It does not work yet, so it is commented out. */
|
||||
#if 0
|
||||
if(!loaded_symbols){
|
||||
loaded_symbols++;
|
||||
load_entrypoints();
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Show where we crashed */
|
||||
examine_memory(SC_EIP(dbg_mask), 1, 'i');
|
||||
|
||||
issue_prompt();
|
||||
|
||||
yyparse();
|
||||
flush_symbols();
|
||||
fprintf(stderr,"Returning to Wine...\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
yyerror(char * s){
|
||||
fprintf(stderr,"%s\n", s);
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
|
||||
|
||||
/* Lexical scanner for command line parsing in the Wine debugger
|
||||
*
|
||||
* Version 1.0
|
||||
* Eric Youngdale
|
||||
* 9/93
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "dbg.tab.h"
|
||||
#include "regpos.h"
|
||||
|
||||
#ifdef USE_READLINE
|
||||
#undef YY_INPUT
|
||||
#define YY_INPUT(buf,result,max_size) \
|
||||
if ( (result = dbg_read((char *) buf, max_size )) < 0 ) \
|
||||
YY_FATAL_ERROR( "read() in flex scanner failed" );
|
||||
#endif
|
||||
|
||||
extern char * readline(char *);
|
||||
static char * make_symbol(char *);
|
||||
void flush_symbols();
|
||||
static int syntax_error;
|
||||
%}
|
||||
|
||||
DIGIT [0-9]
|
||||
HEXDIGIT [0-9a-fA-F]
|
||||
|
||||
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
|
||||
|
||||
%%
|
||||
|
||||
\n { syntax_error = 0; return '\n'; } /* Indicate end of command */
|
||||
|
||||
"+" { return '+'; }
|
||||
|
||||
"-" { return '-'; }
|
||||
|
||||
"/" { return '/'; }
|
||||
|
||||
"=" { return '='; }
|
||||
|
||||
"(" { return '('; }
|
||||
|
||||
")" { return ')'; }
|
||||
|
||||
"*" { return '*'; }
|
||||
|
||||
"?" { return HELP; }
|
||||
|
||||
"0x"+{HEXDIGIT}+ {
|
||||
sscanf(yytext, "%lx", &yylval);
|
||||
return NUM;
|
||||
}
|
||||
|
||||
{DIGIT}+ {
|
||||
sscanf(yytext, "%lx", &yylval);
|
||||
return NUM;
|
||||
}
|
||||
|
||||
$pc { yylval = RN_EIP; return REG;}
|
||||
$sp { yylval = RN_ESP; return REG;}
|
||||
$eip { yylval = RN_EIP; return REG;}
|
||||
$esp { yylval = RN_ESP; return REG;}
|
||||
$ebp { yylval = RN_EBP; return REG;}
|
||||
$eax { yylval = RN_EAX; return REG;}
|
||||
$ebx { yylval = RN_EBX; return REG;}
|
||||
$ecx { yylval = RN_ECX; return REG;}
|
||||
$edx { yylval = RN_EDX; return REG;}
|
||||
$esi { yylval = RN_ESI; return REG;}
|
||||
$edi { yylval = RN_EDI; return REG;}
|
||||
|
||||
info|inf|in { return INFO; }
|
||||
|
||||
quit|qui|qu { return QUIT; }
|
||||
|
||||
help|hel|he { return HELP; }
|
||||
|
||||
set|se { return SET; }
|
||||
|
||||
cont|con|co { return CONT; }
|
||||
|
||||
symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; }
|
||||
|
||||
define|defin|defi|def|de { return DEFINE; }
|
||||
print|prin|pri|pr { return PRINT; }
|
||||
|
||||
regs|reg|re { return REGS; }
|
||||
|
||||
stack|stac|sta|st { return STACK; }
|
||||
|
||||
x { return 'x'; }
|
||||
d { return 'd'; }
|
||||
i { return 'i'; }
|
||||
w { return 'w'; }
|
||||
b { return 'b'; }
|
||||
s { return 's'; }
|
||||
c { return 'c'; }
|
||||
|
||||
{IDENTIFIER} {yylval = (int) make_symbol(yytext);
|
||||
return IDENTIFIER;
|
||||
}
|
||||
|
||||
[ \t]+ /* Eat up whitespace */
|
||||
|
||||
. { if(syntax_error == 0) {
|
||||
syntax_error ++; fprintf(stderr, "Syntax Error\n"); }
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
#ifdef USE_READLINE
|
||||
#ifndef whitespace
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Used only with GNU readline */
|
||||
#include "readline/readline.h"
|
||||
#include "readline/chardefs.h"
|
||||
#endif
|
||||
|
||||
dbg_read(char * buf, int size){
|
||||
char * line;
|
||||
int len;
|
||||
|
||||
do{
|
||||
flush_symbols();
|
||||
line = readline ("Wine-dbg>");
|
||||
len = strlen(line);
|
||||
|
||||
if (!line)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
stripwhite (line);
|
||||
|
||||
if (*line)
|
||||
{
|
||||
add_history (line);
|
||||
if(size < len + 1){
|
||||
fprintf(stderr,"Fatal readline goof.\n");
|
||||
exit(0);
|
||||
};
|
||||
strcpy(buf, line);
|
||||
buf[len] = '\n';
|
||||
buf[len+1] = 0;
|
||||
free(line);
|
||||
return len + 1;
|
||||
}
|
||||
}
|
||||
|
||||
} while (1==1);
|
||||
}
|
||||
|
||||
/* Strip whitespace from the start and end of STRING. */
|
||||
stripwhite (string)
|
||||
char *string;
|
||||
{
|
||||
register int i = 0;
|
||||
|
||||
while (whitespace (string[i]))
|
||||
i++;
|
||||
|
||||
if (i)
|
||||
strcpy (string, string + i);
|
||||
|
||||
i = strlen (string) - 1;
|
||||
|
||||
while (i > 0 && whitespace (string[i]))
|
||||
i--;
|
||||
|
||||
string[++i] = '\0';
|
||||
}
|
||||
|
||||
static char *local_symbols[10];
|
||||
static int next_symbol;
|
||||
|
||||
char * make_symbol(char * symbol){
|
||||
return local_symbols[next_symbol++] = strdup(symbol);
|
||||
}
|
||||
|
||||
void
|
||||
flush_symbols(){
|
||||
while(--next_symbol>= 0) free(local_symbols[next_symbol]);
|
||||
next_symbol = 0;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,818 @@
|
|||
/* Basic, host-specific, and target-specific definitions for GDB.
|
||||
Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (DEFS_H)
|
||||
#define DEFS_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* First include ansidecl.h so we can use the various macro definitions
|
||||
here and in all subsequent file inclusions. */
|
||||
|
||||
#include "ansidecl.h"
|
||||
|
||||
/* An address in the program being debugged. Host byte order. */
|
||||
typedef unsigned int CORE_ADDR;
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/* The character C++ uses to build identifiers that must be unique from
|
||||
the program's identifiers (such as $this and $$vptr). */
|
||||
#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
|
||||
|
||||
#include <errno.h> /* System call error return status */
|
||||
|
||||
extern int quit_flag;
|
||||
extern int immediate_quit;
|
||||
|
||||
extern void
|
||||
quit PARAMS ((void));
|
||||
|
||||
#define QUIT { if (quit_flag) quit (); }
|
||||
|
||||
/* Command classes are top-level categories into which commands are broken
|
||||
down for "help" purposes.
|
||||
Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. class-pseudo is for commands
|
||||
which are not really commands nor help topics ("stop"). */
|
||||
|
||||
enum command_class
|
||||
{
|
||||
/* Special args to help_list */
|
||||
all_classes = -2, all_commands = -1,
|
||||
/* Classes of commands */
|
||||
no_class = -1, class_run = 0, class_vars, class_stack,
|
||||
class_files, class_support, class_info, class_breakpoint,
|
||||
class_alias, class_obscure, class_user, class_maintenance,
|
||||
class_pseudo
|
||||
};
|
||||
|
||||
/* the cleanup list records things that have to be undone
|
||||
if an error happens (descriptors to be closed, memory to be freed, etc.)
|
||||
Each link in the chain records a function to call and an
|
||||
argument to give it.
|
||||
|
||||
Use make_cleanup to add an element to the cleanup chain.
|
||||
Use do_cleanups to do all cleanup actions back to a given
|
||||
point in the chain. Use discard_cleanups to remove cleanups
|
||||
from the chain back to a given point, not doing them. */
|
||||
|
||||
struct cleanup
|
||||
{
|
||||
struct cleanup *next;
|
||||
void (*function) PARAMS ((PTR));
|
||||
PTR arg;
|
||||
};
|
||||
|
||||
/* From blockframe.c */
|
||||
|
||||
extern int
|
||||
inside_entry_func PARAMS ((CORE_ADDR));
|
||||
|
||||
extern int
|
||||
inside_entry_file PARAMS ((CORE_ADDR addr));
|
||||
|
||||
extern int
|
||||
inside_main_func PARAMS ((CORE_ADDR pc));
|
||||
|
||||
/* From cplus-dem.c */
|
||||
|
||||
extern char *
|
||||
cplus_demangle PARAMS ((const char *, int));
|
||||
|
||||
extern char *
|
||||
cplus_mangle_opname PARAMS ((char *, int));
|
||||
|
||||
/* From libmmalloc.a (memory mapped malloc library) */
|
||||
|
||||
extern PTR
|
||||
mmalloc_attach PARAMS ((int, PTR));
|
||||
|
||||
extern PTR
|
||||
mmalloc_detach PARAMS ((PTR));
|
||||
|
||||
extern PTR
|
||||
mmalloc PARAMS ((PTR, long));
|
||||
|
||||
extern PTR
|
||||
mrealloc PARAMS ((PTR, PTR, long));
|
||||
|
||||
extern void
|
||||
mfree PARAMS ((PTR, PTR));
|
||||
|
||||
extern int
|
||||
mmalloc_setkey PARAMS ((PTR, int, PTR));
|
||||
|
||||
extern PTR
|
||||
mmalloc_getkey PARAMS ((PTR, int));
|
||||
|
||||
/* From utils.c */
|
||||
|
||||
extern char *
|
||||
demangle_and_match PARAMS ((const char *, const char *, int));
|
||||
|
||||
extern int
|
||||
strcmp_iw PARAMS ((const char *, const char *));
|
||||
|
||||
extern char *
|
||||
safe_strerror PARAMS ((int));
|
||||
|
||||
extern char *
|
||||
safe_strsignal PARAMS ((int));
|
||||
|
||||
extern void
|
||||
init_malloc PARAMS ((PTR));
|
||||
|
||||
extern void
|
||||
request_quit PARAMS ((int));
|
||||
|
||||
extern void
|
||||
do_cleanups PARAMS ((struct cleanup *));
|
||||
|
||||
extern void
|
||||
discard_cleanups PARAMS ((struct cleanup *));
|
||||
|
||||
/* The bare make_cleanup function is one of those rare beasts that
|
||||
takes almost any type of function as the first arg and anything that
|
||||
will fit in a "void *" as the second arg.
|
||||
|
||||
Should be, once all calls and called-functions are cleaned up:
|
||||
extern struct cleanup *
|
||||
make_cleanup PARAMS ((void (*function) (PTR), PTR));
|
||||
|
||||
Until then, lint and/or various type-checking compiler options will
|
||||
complain about make_cleanup calls. It'd be wrong to just cast things,
|
||||
since the type actually passed when the function is called would be
|
||||
wrong. */
|
||||
|
||||
extern struct cleanup *
|
||||
make_cleanup ();
|
||||
|
||||
extern struct cleanup *
|
||||
save_cleanups PARAMS ((void));
|
||||
|
||||
extern void
|
||||
restore_cleanups PARAMS ((struct cleanup *));
|
||||
|
||||
extern void
|
||||
free_current_contents PARAMS ((char **));
|
||||
|
||||
extern void
|
||||
null_cleanup PARAMS ((char **));
|
||||
|
||||
extern int
|
||||
myread PARAMS ((int, char *, int));
|
||||
|
||||
extern int
|
||||
query ();
|
||||
|
||||
extern void
|
||||
wrap_here PARAMS ((char *));
|
||||
|
||||
extern void
|
||||
reinitialize_more_filter PARAMS ((void));
|
||||
|
||||
extern int
|
||||
print_insn PARAMS ((CORE_ADDR, CORE_ADDR, FILE *, int));
|
||||
|
||||
extern void
|
||||
fputs_filtered PARAMS ((const char *, FILE *));
|
||||
|
||||
extern void
|
||||
puts_filtered PARAMS ((char *));
|
||||
|
||||
extern void
|
||||
vfprintf_filtered ();
|
||||
|
||||
extern void
|
||||
fprintf_filtered ();
|
||||
|
||||
extern void
|
||||
fprintfi_filtered ();
|
||||
|
||||
extern void
|
||||
printf_filtered ();
|
||||
|
||||
extern void
|
||||
printfi_filtered ();
|
||||
|
||||
extern void
|
||||
print_spaces PARAMS ((int, FILE *));
|
||||
|
||||
extern void
|
||||
print_spaces_filtered PARAMS ((int, FILE *));
|
||||
|
||||
extern char *
|
||||
n_spaces PARAMS ((int));
|
||||
|
||||
extern void
|
||||
printchar PARAMS ((int, FILE *, int));
|
||||
|
||||
extern char *
|
||||
strdup_demangled PARAMS ((const char *));
|
||||
|
||||
extern void
|
||||
fprint_symbol PARAMS ((FILE *, char *));
|
||||
|
||||
extern void
|
||||
fputs_demangled PARAMS ((char *, FILE *, int));
|
||||
|
||||
extern void
|
||||
perror_with_name PARAMS ((char *));
|
||||
|
||||
extern void
|
||||
print_sys_errmsg PARAMS ((char *, int));
|
||||
|
||||
/* From regex.c */
|
||||
|
||||
extern char *
|
||||
re_comp PARAMS ((char *));
|
||||
|
||||
/* From symfile.c */
|
||||
|
||||
extern void
|
||||
symbol_file_command PARAMS ((char *, int));
|
||||
|
||||
/* From main.c */
|
||||
|
||||
extern char *
|
||||
skip_quoted PARAMS ((char *));
|
||||
|
||||
extern char *
|
||||
gdb_readline PARAMS ((char *));
|
||||
|
||||
extern char *
|
||||
command_line_input PARAMS ((char *, int));
|
||||
|
||||
extern void
|
||||
print_prompt PARAMS ((void));
|
||||
|
||||
extern int
|
||||
batch_mode PARAMS ((void));
|
||||
|
||||
extern int
|
||||
input_from_terminal_p PARAMS ((void));
|
||||
|
||||
extern int
|
||||
catch_errors PARAMS ((int (*) (char *), char *, char *));
|
||||
|
||||
/* From printcmd.c */
|
||||
|
||||
extern void
|
||||
set_next_address PARAMS ((CORE_ADDR));
|
||||
|
||||
extern void
|
||||
print_address_symbolic PARAMS ((CORE_ADDR, FILE *, int, char *));
|
||||
|
||||
extern void
|
||||
print_address PARAMS ((CORE_ADDR, FILE *));
|
||||
|
||||
/* From source.c */
|
||||
|
||||
extern int
|
||||
openp PARAMS ((char *, int, char *, int, int, char **));
|
||||
|
||||
extern void
|
||||
mod_path PARAMS ((char *, char **));
|
||||
|
||||
extern void
|
||||
directory_command PARAMS ((char *, int));
|
||||
|
||||
extern void
|
||||
init_source_path PARAMS ((void));
|
||||
|
||||
/* From findvar.c */
|
||||
|
||||
extern int
|
||||
read_relative_register_raw_bytes PARAMS ((int, char *));
|
||||
|
||||
/* From readline (but not in any readline .h files). */
|
||||
|
||||
extern char *
|
||||
tilde_expand PARAMS ((char *));
|
||||
|
||||
/* Structure for saved commands lines
|
||||
(for breakpoints, defined commands, etc). */
|
||||
|
||||
struct command_line
|
||||
{
|
||||
struct command_line *next;
|
||||
char *line;
|
||||
};
|
||||
|
||||
extern struct command_line *
|
||||
read_command_lines PARAMS ((void));
|
||||
|
||||
extern void
|
||||
free_command_lines PARAMS ((struct command_line **));
|
||||
|
||||
/* String containing the current directory (what getwd would return). */
|
||||
|
||||
extern char *current_directory;
|
||||
|
||||
/* Default radixes for input and output. Only some values supported. */
|
||||
extern unsigned input_radix;
|
||||
extern unsigned output_radix;
|
||||
|
||||
/* Baud rate specified for communication with serial target systems. */
|
||||
extern char *baud_rate;
|
||||
|
||||
/* Languages represented in the symbol table and elsewhere. */
|
||||
|
||||
enum language
|
||||
{
|
||||
language_unknown, /* Language not known */
|
||||
language_auto, /* Placeholder for automatic setting */
|
||||
language_c, /* C */
|
||||
language_cplus, /* C++ */
|
||||
language_m2 /* Modula-2 */
|
||||
};
|
||||
|
||||
/* Return a format string for printf that will print a number in the local
|
||||
(language-specific) hexadecimal format. Result is static and is
|
||||
overwritten by the next call. local_hex_format_custom takes printf
|
||||
options like "08" or "l" (to produce e.g. %08x or %lx). */
|
||||
|
||||
#define local_hex_format() (current_language->la_hex_format)
|
||||
|
||||
extern char *
|
||||
local_hex_format_custom PARAMS ((char *)); /* language.c */
|
||||
|
||||
/* Return a string that contains a number formatted in the local
|
||||
(language-specific) hexadecimal format. Result is static and is
|
||||
overwritten by the next call. local_hex_string_custom takes printf
|
||||
options like "08" or "l". */
|
||||
|
||||
extern char *
|
||||
local_hex_string PARAMS ((int)); /* language.c */
|
||||
|
||||
extern char *
|
||||
local_hex_string_custom PARAMS ((int, char *)); /* language.c */
|
||||
|
||||
|
||||
/* Host machine definition. This will be a symlink to one of the
|
||||
xm-*.h files, built by the `configure' script. */
|
||||
|
||||
#include "xm.h"
|
||||
|
||||
/* If the xm.h file did not define the mode string used to open the
|
||||
files, assume that binary files are opened the same way as text
|
||||
files */
|
||||
#ifndef FOPEN_RB
|
||||
#include "fopen-same.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allow things in gdb to be declared "const". If compiling ANSI, it
|
||||
* just works. If compiling with gcc but non-ansi, redefine to __const__.
|
||||
* If non-ansi, non-gcc, then eliminate "const" entirely, making those
|
||||
* objects be read-write rather than read-only.
|
||||
*/
|
||||
|
||||
#ifndef const
|
||||
#ifndef __STDC__
|
||||
# ifdef __GNUC__
|
||||
# define const __const__
|
||||
# else
|
||||
# define const /*nothing*/
|
||||
# endif /* GNUC */
|
||||
#endif /* STDC */
|
||||
#endif /* const */
|
||||
|
||||
#ifndef volatile
|
||||
#ifndef __STDC__
|
||||
# ifdef __GNUC__
|
||||
# define volatile __volatile__
|
||||
# else
|
||||
# define volatile /*nothing*/
|
||||
# endif /* GNUC */
|
||||
#endif /* STDC */
|
||||
#endif /* volatile */
|
||||
|
||||
/* Some compilers (many AT&T SVR4 compilers for instance), do not accept
|
||||
declarations of functions that never return (exit for instance) as
|
||||
"volatile void". For such compilers "NORETURN" can be defined away
|
||||
to keep them happy */
|
||||
|
||||
#ifndef NORETURN
|
||||
# ifdef __lucid
|
||||
# define NORETURN /*nothing*/
|
||||
# else
|
||||
# define NORETURN volatile
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
|
||||
|
||||
#if !defined (UINT_MAX)
|
||||
#define UINT_MAX 0xffffffff
|
||||
#endif
|
||||
|
||||
#if !defined (LONG_MAX)
|
||||
#define LONG_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#if !defined (INT_MAX)
|
||||
#define INT_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#if !defined (INT_MIN)
|
||||
/* Two's complement, 32 bit. */
|
||||
#define INT_MIN -0x80000000
|
||||
#endif
|
||||
|
||||
/* Number of bits in a char or unsigned char for the target machine.
|
||||
Just like CHAR_BIT in <limits.h> but describes the target machine. */
|
||||
#if !defined (TARGET_CHAR_BIT)
|
||||
#define TARGET_CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
/* Number of bits in a short or unsigned short for the target machine. */
|
||||
#if !defined (TARGET_SHORT_BIT)
|
||||
#define TARGET_SHORT_BIT (sizeof (short) * TARGET_CHAR_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in an int or unsigned int for the target machine. */
|
||||
#if !defined (TARGET_INT_BIT)
|
||||
#define TARGET_INT_BIT (sizeof (int) * TARGET_CHAR_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a long or unsigned long for the target machine. */
|
||||
#if !defined (TARGET_LONG_BIT)
|
||||
#define TARGET_LONG_BIT (sizeof (long) * TARGET_CHAR_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a long long or unsigned long long for the target machine. */
|
||||
#if !defined (TARGET_LONG_LONG_BIT)
|
||||
#define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a float for the target machine. */
|
||||
#if !defined (TARGET_FLOAT_BIT)
|
||||
#define TARGET_FLOAT_BIT (sizeof (float) * TARGET_CHAR_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a double for the target machine. */
|
||||
#if !defined (TARGET_DOUBLE_BIT)
|
||||
#define TARGET_DOUBLE_BIT (sizeof (double) * TARGET_CHAR_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a long double for the target machine. */
|
||||
#if !defined (TARGET_LONG_DOUBLE_BIT)
|
||||
#define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a "complex" for the target machine. */
|
||||
#if !defined (TARGET_COMPLEX_BIT)
|
||||
#define TARGET_COMPLEX_BIT (2 * TARGET_FLOAT_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a "double complex" for the target machine. */
|
||||
#if !defined (TARGET_DOUBLE_COMPLEX_BIT)
|
||||
#define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT)
|
||||
#endif
|
||||
|
||||
/* Number of bits in a pointer for the target machine */
|
||||
#if !defined (TARGET_PTR_BIT)
|
||||
#define TARGET_PTR_BIT TARGET_INT_BIT
|
||||
#endif
|
||||
|
||||
/* Convert a LONGEST to an int. This is used in contexts (e.g. number
|
||||
of arguments to a function, number in a value history, register
|
||||
number, etc.) where the value must not be larger than can fit
|
||||
in an int. */
|
||||
#if !defined (longest_to_int)
|
||||
#if defined (LONG_LONG)
|
||||
#define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \
|
||||
? (error ("Value out of range."),0) : (int) (x))
|
||||
#else /* No LONG_LONG. */
|
||||
/* Assume sizeof (int) == sizeof (long). */
|
||||
#define longest_to_int(x) ((int) (x))
|
||||
#endif /* No LONG_LONG. */
|
||||
#endif /* No longest_to_int. */
|
||||
|
||||
/* This should not be a typedef, because "unsigned LONGEST" needs
|
||||
to work. LONG_LONG is defined if the host has "long long". */
|
||||
|
||||
#ifndef LONGEST
|
||||
# ifdef LONG_LONG
|
||||
# define LONGEST long long
|
||||
# else
|
||||
# define LONGEST long
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Assorted functions we can declare, now that const and volatile are
|
||||
defined. */
|
||||
|
||||
extern char *
|
||||
savestring PARAMS ((const char *, int));
|
||||
|
||||
extern char *
|
||||
msavestring PARAMS ((void *, const char *, int));
|
||||
|
||||
extern char *
|
||||
strsave PARAMS ((const char *));
|
||||
|
||||
extern char *
|
||||
mstrsave PARAMS ((void *, const char *));
|
||||
|
||||
extern char *
|
||||
concat PARAMS ((char *, ...));
|
||||
|
||||
extern PTR
|
||||
xmalloc PARAMS ((long));
|
||||
|
||||
extern PTR
|
||||
xrealloc PARAMS ((PTR, long));
|
||||
|
||||
extern PTR
|
||||
xmmalloc PARAMS ((PTR, long));
|
||||
|
||||
extern PTR
|
||||
xmrealloc PARAMS ((PTR, PTR, long));
|
||||
|
||||
extern PTR
|
||||
mmalloc PARAMS ((PTR, long));
|
||||
|
||||
extern PTR
|
||||
mrealloc PARAMS ((PTR, PTR, long));
|
||||
|
||||
extern void
|
||||
mfree PARAMS ((PTR, PTR));
|
||||
|
||||
extern int
|
||||
mmcheck PARAMS ((PTR, void (*) (void)));
|
||||
|
||||
extern int
|
||||
mmtrace PARAMS ((void));
|
||||
|
||||
extern int
|
||||
parse_escape PARAMS ((char **));
|
||||
|
||||
extern const char * const reg_names[];
|
||||
|
||||
extern NORETURN void /* Does not return to the caller. */
|
||||
error ();
|
||||
|
||||
extern NORETURN void /* Does not return to the caller. */
|
||||
fatal ();
|
||||
|
||||
extern NORETURN void /* Not specified as volatile in ... */
|
||||
exit PARAMS ((int)); /* 4.10.4.3 */
|
||||
|
||||
extern NORETURN void /* Does not return to the caller. */
|
||||
nomem PARAMS ((long));
|
||||
|
||||
extern NORETURN void /* Does not return to the caller. */
|
||||
return_to_top_level PARAMS ((void));
|
||||
|
||||
extern void
|
||||
warning_setup PARAMS ((void));
|
||||
|
||||
extern void
|
||||
warning ();
|
||||
|
||||
/* Global functions from other, non-gdb GNU thingies (libiberty for
|
||||
instance) */
|
||||
|
||||
extern char *
|
||||
basename PARAMS ((char *));
|
||||
|
||||
extern char *
|
||||
getenv PARAMS ((const char *));
|
||||
|
||||
extern char **
|
||||
buildargv PARAMS ((char *));
|
||||
|
||||
extern void
|
||||
freeargv PARAMS ((char **));
|
||||
|
||||
extern char *
|
||||
strerrno PARAMS ((int));
|
||||
|
||||
extern char *
|
||||
strsigno PARAMS ((int));
|
||||
|
||||
extern int
|
||||
errno_max PARAMS ((void));
|
||||
|
||||
extern int
|
||||
signo_max PARAMS ((void));
|
||||
|
||||
extern int
|
||||
strtoerrno PARAMS ((char *));
|
||||
|
||||
extern int
|
||||
strtosigno PARAMS ((char *));
|
||||
|
||||
extern char *
|
||||
strsignal PARAMS ((int));
|
||||
|
||||
/* From other system libraries */
|
||||
|
||||
#ifndef PSIGNAL_IN_SIGNAL_H
|
||||
extern void
|
||||
psignal PARAMS ((unsigned, char *));
|
||||
#endif
|
||||
|
||||
/* For now, we can't include <stdlib.h> because it conflicts with
|
||||
"../include/getopt.h". (FIXME)
|
||||
|
||||
However, if a function is defined in the ANSI C standard and a prototype
|
||||
for that function is defined and visible in any header file in an ANSI
|
||||
conforming environment, then that prototype must match the definition in
|
||||
the ANSI standard. So we can just duplicate them here without conflict,
|
||||
since they must be the same in all conforming ANSI environments. If
|
||||
these cause problems, then the environment is not ANSI conformant. */
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
extern int
|
||||
fclose PARAMS ((FILE *stream)); /* 4.9.5.1 */
|
||||
|
||||
extern void
|
||||
perror PARAMS ((const char *)); /* 4.9.10.4 */
|
||||
|
||||
extern double
|
||||
atof PARAMS ((const char *nptr)); /* 4.10.1.1 */
|
||||
|
||||
extern int
|
||||
atoi PARAMS ((const char *)); /* 4.10.1.2 */
|
||||
|
||||
#ifndef MALLOC_INCOMPATIBLE
|
||||
|
||||
extern PTR
|
||||
malloc PARAMS ((size_t size)); /* 4.10.3.3 */
|
||||
|
||||
extern PTR
|
||||
realloc PARAMS ((void *ptr, size_t size)); /* 4.10.3.4 */
|
||||
|
||||
extern void
|
||||
free PARAMS ((void *)); /* 4.10.3.2 */
|
||||
|
||||
#endif /* MALLOC_INCOMPATIBLE */
|
||||
|
||||
extern void
|
||||
qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */
|
||||
size_t size,
|
||||
int (*comp)(const void *, const void *)));
|
||||
|
||||
#ifndef MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */
|
||||
extern PTR
|
||||
memcpy PARAMS ((void *, const void *, size_t)); /* 4.11.2.1 */
|
||||
#endif
|
||||
|
||||
extern int
|
||||
memcmp PARAMS ((const void *, const void *, size_t)); /* 4.11.4.1 */
|
||||
|
||||
extern char *
|
||||
strchr PARAMS ((const char *, int)); /* 4.11.5.2 */
|
||||
|
||||
extern char *
|
||||
strrchr PARAMS ((const char *, int)); /* 4.11.5.5 */
|
||||
|
||||
extern char *
|
||||
strstr PARAMS ((const char *, const char *)); /* 4.11.5.7 */
|
||||
|
||||
extern char *
|
||||
strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */
|
||||
|
||||
#ifndef MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */
|
||||
extern PTR
|
||||
memset PARAMS ((void *, int, size_t)); /* 4.11.6.1 */
|
||||
#endif
|
||||
|
||||
extern char *
|
||||
strerror PARAMS ((int)); /* 4.11.6.2 */
|
||||
|
||||
/* Various possibilities for alloca. */
|
||||
#ifndef alloca
|
||||
# ifdef __GNUC__
|
||||
# define alloca __builtin_alloca
|
||||
# else
|
||||
# ifdef sparc
|
||||
# include <alloca.h> /* NOTE: Doesn't declare alloca() */
|
||||
# endif
|
||||
# ifdef __STDC__
|
||||
extern void *alloca (size_t);
|
||||
# else /* __STDC__ */
|
||||
extern char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER must be defined to one of these. */
|
||||
|
||||
#if !defined (BIG_ENDIAN)
|
||||
#define BIG_ENDIAN 4321
|
||||
#endif
|
||||
|
||||
#if !defined (LITTLE_ENDIAN)
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
/* Target-system-dependent parameters for GDB.
|
||||
|
||||
The standard thing is to include defs.h. However, files that are
|
||||
specific to a particular target can define TM_FILE_OVERRIDE before
|
||||
including defs.h, then can include any particular tm-file they desire. */
|
||||
|
||||
/* Target machine definition. This will be a symlink to one of the
|
||||
tm-*.h files, built by the `configure' script. */
|
||||
|
||||
#ifndef TM_FILE_OVERRIDE
|
||||
#include "tm.h"
|
||||
#endif
|
||||
|
||||
/* The bit byte-order has to do just with numbering of bits in
|
||||
debugging symbols and such. Conceptually, it's quite separate
|
||||
from byte/word byte order. */
|
||||
|
||||
#if !defined (BITS_BIG_ENDIAN)
|
||||
#if TARGET_BYTE_ORDER == BIG_ENDIAN
|
||||
#define BITS_BIG_ENDIAN 1
|
||||
#endif /* Big endian. */
|
||||
|
||||
#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define BITS_BIG_ENDIAN 0
|
||||
#endif /* Little endian. */
|
||||
#endif /* BITS_BIG_ENDIAN not defined. */
|
||||
|
||||
/* Swap LEN bytes at BUFFER between target and host byte-order. */
|
||||
#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER
|
||||
#define SWAP_TARGET_AND_HOST(buffer,len)
|
||||
#else /* Target and host byte order differ. */
|
||||
#define SWAP_TARGET_AND_HOST(buffer,len) \
|
||||
{ \
|
||||
char tmp; \
|
||||
char *p = (char *)(buffer); \
|
||||
char *q = ((char *)(buffer)) + len - 1; \
|
||||
for (; p < q; p++, q--) \
|
||||
{ \
|
||||
tmp = *q; \
|
||||
*q = *p; \
|
||||
*p = tmp; \
|
||||
} \
|
||||
}
|
||||
#endif /* Target and host byte order differ. */
|
||||
|
||||
/* On some machines there are bits in addresses which are not really
|
||||
part of the address, but are used by the kernel, the hardware, etc.
|
||||
for special purposes. ADDR_BITS_REMOVE takes out any such bits
|
||||
so we get a "real" address such as one would find in a symbol
|
||||
table. ADDR_BITS_SET sets those bits the way the system wants
|
||||
them. */
|
||||
#if !defined (ADDR_BITS_REMOVE)
|
||||
#define ADDR_BITS_REMOVE(addr) (addr)
|
||||
#define ADDR_BITS_SET(addr) (addr)
|
||||
#endif /* No ADDR_BITS_REMOVE. */
|
||||
|
||||
/* From valops.c */
|
||||
|
||||
extern CORE_ADDR
|
||||
push_bytes PARAMS ((CORE_ADDR, char *, int));
|
||||
|
||||
/* In some modules, we don't have a definition of REGISTER_TYPE yet, so we
|
||||
must avoid prototyping this function for now. FIXME. Should be:
|
||||
extern CORE_ADDR
|
||||
push_word PARAMS ((CORE_ADDR, REGISTER_TYPE));
|
||||
*/
|
||||
extern CORE_ADDR
|
||||
push_word ();
|
||||
|
||||
/* Some parts of gdb might be considered optional, in the sense that they
|
||||
are not essential for being able to build a working, usable debugger
|
||||
for a specific environment. For example, the maintenance commands
|
||||
are there for the benefit of gdb maintainers. As another example,
|
||||
some environments really don't need gdb's that are able to read N
|
||||
different object file formats. In order to make it possible (but
|
||||
not necessarily recommended) to build "stripped down" versions of
|
||||
gdb, the following defines control selective compilation of those
|
||||
parts of gdb which can be safely left out when necessary. Note that
|
||||
the default is to include everything. */
|
||||
|
||||
#ifndef MAINTENANCE_CMDS
|
||||
#define MAINTENANCE_CMDS 1
|
||||
#endif
|
||||
|
||||
#endif /* !defined (DEFS_H) */
|
|
@ -0,0 +1,96 @@
|
|||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern void wine_debug(unsigned int*);
|
||||
|
||||
|
||||
#ifdef linux
|
||||
#include <linux/sched.h>
|
||||
#include <asm/system.h>
|
||||
#endif
|
||||
|
||||
struct sigaction segv_act;
|
||||
|
||||
#ifdef linux
|
||||
|
||||
struct sigcontext_struct {
|
||||
unsigned short sc_gs, __gsh;
|
||||
unsigned short sc_fs, __fsh;
|
||||
unsigned short sc_es, __esh;
|
||||
unsigned short sc_ds, __dsh;
|
||||
unsigned long sc_edi;
|
||||
unsigned long sc_esi;
|
||||
unsigned long sc_ebp;
|
||||
unsigned long sc_esp;
|
||||
unsigned long sc_ebx;
|
||||
unsigned long sc_edx;
|
||||
unsigned long sc_ecx;
|
||||
unsigned long sc_eax;
|
||||
unsigned long sc_trapno;
|
||||
unsigned long sc_err;
|
||||
unsigned long sc_eip;
|
||||
unsigned short sc_cs, __csh;
|
||||
unsigned long sc_eflags;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned short sc_ss, __ssh;
|
||||
unsigned long i387;
|
||||
unsigned long oldmask;
|
||||
unsigned long cr2;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
static void win_fault(int signal, struct sigcontext_struct context){
|
||||
struct sigcontext_struct *scp = &context;
|
||||
#else
|
||||
static void win_fault(int signal, int code, struct sigcontext *scp){
|
||||
#endif
|
||||
|
||||
wine_debug((unsigned int *) scp); /* Enter our debugger */
|
||||
}
|
||||
|
||||
char realtext[] = "This is what should really be printed\n";
|
||||
|
||||
int
|
||||
main(){
|
||||
char * pnt;
|
||||
#ifdef linux
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
/* Point to the top of the stack, minus 4 just in case, and make
|
||||
it aligned */
|
||||
sigaction(SIGSEGV, &segv_act, NULL);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct sigstack ss;
|
||||
sigset_t sig_mask;
|
||||
|
||||
ss.ss_sp = (char *) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
|
||||
ss.ss_onstack = 0;
|
||||
if (sigstack(&ss, NULL) < 0) {
|
||||
perror("sigstack");
|
||||
exit(1);
|
||||
}
|
||||
sigemptyset(&sig_mask);
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
segv_act.sa_flags = SA_ONSTACK;
|
||||
segv_act.sa_mask = sig_mask;
|
||||
if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
|
||||
perror("sigaction");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
fprintf(stderr,"%x\n", realtext);
|
||||
|
||||
/* Now force a segmentation fault */
|
||||
pnt = (char *) 0xc0000000;
|
||||
|
||||
fprintf(stderr,"%s", pnt);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
unsigned int * wine_files = NULL;
|
||||
|
||||
GetEntryPointFromOrdinal(int wpnt, int ordinal) {}
|
|
@ -0,0 +1,27 @@
|
|||
/* Macros for the 'type' part of an fopen, freopen or fdopen.
|
||||
|
||||
<Read|Write>[Update]<Binary file|text file>
|
||||
|
||||
This version is for "same" systems, where text and binary files are
|
||||
the same. An example is Unix. Many Unix systems could also add a
|
||||
"b" to the string, indicating binary files, but some reject this
|
||||
(and thereby don't conform to ANSI C, but what else is new?).
|
||||
|
||||
This file is designed for inclusion by host-dependent .h files. No
|
||||
user application should include it directly, since that would make
|
||||
the application unable to be configured for both "same" and "binary"
|
||||
variant systems. */
|
||||
|
||||
#define FOPEN_RB "r"
|
||||
#define FOPEN_WB "w"
|
||||
#define FOPEN_AB "a"
|
||||
#define FOPEN_RUB "r+"
|
||||
#define FOPEN_WUB "w+"
|
||||
#define FOPEN_AUB "a+"
|
||||
|
||||
#define FOPEN_RT "r"
|
||||
#define FOPEN_WT "w"
|
||||
#define FOPEN_AT "a"
|
||||
#define FOPEN_RUT "r+"
|
||||
#define FOPEN_WUT "w+"
|
||||
#define FOPEN_AUT "a+"
|
|
@ -0,0 +1,119 @@
|
|||
/* Machine independent variables that describe the core file under GDB.
|
||||
Copyright 1986, 1987, 1989, 1990, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Interface routines for core, executable, etc. */
|
||||
|
||||
#if !defined (GDBCORE_H)
|
||||
#define GDBCORE_H 1
|
||||
|
||||
#include "bfd.h" /* Binary File Description */
|
||||
|
||||
/* Return the name of the executable file as a string.
|
||||
ERR nonzero means get error if there is none specified;
|
||||
otherwise return 0 in that case. */
|
||||
|
||||
extern char *
|
||||
get_exec_file PARAMS ((int err));
|
||||
|
||||
/* Nonzero if there is a core file. */
|
||||
|
||||
extern int
|
||||
have_core_file_p PARAMS ((void));
|
||||
|
||||
/* Read "memory data" from whatever target or inferior we have.
|
||||
Returns zero if successful, errno value if not. EIO is used
|
||||
for address out of bounds. If breakpoints are inserted, returns
|
||||
shadow contents, not the breakpoints themselves. From breakpoint.c. */
|
||||
|
||||
extern int
|
||||
read_memory_nobpt PARAMS ((CORE_ADDR memaddr, char *myaddr, unsigned len));
|
||||
|
||||
/* Report a memory error with error(). */
|
||||
|
||||
extern void
|
||||
memory_error PARAMS ((int status, CORE_ADDR memaddr));
|
||||
|
||||
/* Like target_read_memory, but report an error if can't read. */
|
||||
|
||||
extern void
|
||||
read_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
|
||||
|
||||
/* Read an integer from debugged memory, given address and number of bytes. */
|
||||
|
||||
extern long
|
||||
read_memory_integer PARAMS ((CORE_ADDR memaddr, int len));
|
||||
|
||||
/* If this is prototyped, need to deal with void* vs. char*. */
|
||||
|
||||
extern void
|
||||
write_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
|
||||
|
||||
/* Hook for `exec_file_command' command to call. */
|
||||
|
||||
extern void (*exec_file_display_hook) PARAMS ((char *filename));
|
||||
|
||||
extern void
|
||||
specify_exec_file_hook PARAMS ((void (*hook) (char *filename)));
|
||||
|
||||
/* Binary File Diddlers for the exec and core files */
|
||||
extern bfd *core_bfd;
|
||||
extern bfd *exec_bfd;
|
||||
|
||||
/* Whether to open exec and core files read-only or read-write. */
|
||||
|
||||
extern int write_files;
|
||||
|
||||
extern void
|
||||
core_file_command PARAMS ((char *filename, int from_tty));
|
||||
|
||||
extern void
|
||||
exec_file_command PARAMS ((char *filename, int from_tty));
|
||||
|
||||
extern void
|
||||
validate_files PARAMS ((void));
|
||||
|
||||
extern unsigned int
|
||||
register_addr PARAMS ((int regno, int blockend));
|
||||
|
||||
extern int
|
||||
xfer_core_file PARAMS ((CORE_ADDR memaddr, char *myaddr, int len));
|
||||
|
||||
extern void
|
||||
fetch_core_registers PARAMS ((char *core_reg_sect, unsigned core_reg_size,
|
||||
int which, unsigned int reg_addr));
|
||||
|
||||
extern void
|
||||
registers_fetched PARAMS ((void));
|
||||
|
||||
#if !defined (KERNEL_U_ADDR)
|
||||
extern CORE_ADDR kernel_u_addr;
|
||||
#define KERNEL_U_ADDR kernel_u_addr
|
||||
#endif
|
||||
|
||||
/* The target vector for core files */
|
||||
extern struct target_ops core_ops;
|
||||
|
||||
/* target vector functions called directly from elsewhere */
|
||||
void
|
||||
core_open PARAMS ((char *, int));
|
||||
|
||||
void
|
||||
core_detach PARAMS ((char *, int));
|
||||
|
||||
#endif /* !defined (GDBCORE_H) */
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* File hash.c - generate hash tables for Wine debugger symbols
|
||||
*
|
||||
* Copyright (C) 1993, Eric Youngdale.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <neexe.h>
|
||||
#include <segmem.h>
|
||||
#include <prototypes.h>
|
||||
#include <wine.h>
|
||||
|
||||
struct name_hash{
|
||||
struct name_hash * next;
|
||||
unsigned int * address;
|
||||
char * name;
|
||||
};
|
||||
|
||||
#define NR_NAME_HASH 128
|
||||
|
||||
static struct name_hash * name_hash_table[NR_NAME_HASH] = {0,};
|
||||
|
||||
static unsigned int name_hash(const char * name){
|
||||
unsigned int hash = 0;
|
||||
const char * p;
|
||||
|
||||
p = name;
|
||||
|
||||
while (*p) hash = (hash << 15) + (hash << 3) + (hash >> 3) + *p++;
|
||||
return hash % NR_NAME_HASH;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void add_hash(char * name, unsigned int * address){
|
||||
struct name_hash * new;
|
||||
int hash;
|
||||
|
||||
new = (struct name_hash *) malloc(sizeof(struct name_hash));
|
||||
new->address = address;
|
||||
new->name = strdup(name);
|
||||
new->next = NULL;
|
||||
hash = name_hash(name);
|
||||
|
||||
/* Now insert into the hash table */
|
||||
new->next = name_hash_table[hash];
|
||||
name_hash_table[hash] = new;
|
||||
}
|
||||
|
||||
unsigned int * find_hash(char * name){
|
||||
char buffer[256];
|
||||
struct name_hash * nh;
|
||||
|
||||
for(nh = name_hash_table[name_hash(name)]; nh; nh = nh->next)
|
||||
if(strcmp(nh->name, name) == 0) return nh->address;
|
||||
|
||||
if(name[0] != '_'){
|
||||
buffer[0] = '_';
|
||||
strcpy(buffer+1, name);
|
||||
for(nh = name_hash_table[name_hash(buffer)]; nh; nh = nh->next)
|
||||
if(strcmp(nh->name, buffer) == 0) return nh->address;
|
||||
};
|
||||
|
||||
|
||||
return (unsigned int *) 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
static char name_buffer[256];
|
||||
|
||||
char * find_nearest_symbol(unsigned int * address){
|
||||
struct name_hash * nearest;
|
||||
struct name_hash start;
|
||||
struct name_hash * nh;
|
||||
int i;
|
||||
|
||||
nearest = &start;
|
||||
start.address = (unsigned int *) 0;
|
||||
|
||||
for(i=0; i<NR_NAME_HASH; i++) {
|
||||
for(nh = name_hash_table[i]; nh; nh = nh->next)
|
||||
if(nh->address <= address && nh->address > nearest->address)
|
||||
nearest = nh;
|
||||
};
|
||||
if((unsigned int) nearest->address == 0) return NULL;
|
||||
|
||||
sprintf(name_buffer, "%s+0x%x", nearest->name, ((unsigned int) address) -
|
||||
((unsigned int) nearest->address));
|
||||
return name_buffer;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
read_symboltable(char * filename){
|
||||
FILE * symbolfile;
|
||||
unsigned int addr;
|
||||
int nargs;
|
||||
char type;
|
||||
char * cpnt;
|
||||
char buffer[256];
|
||||
char name[256];
|
||||
|
||||
symbolfile = fopen(filename, "r");
|
||||
if(!symbolfile) {
|
||||
fprintf(stderr,"Unable to open symbol table %s\n", filename);
|
||||
return;
|
||||
};
|
||||
|
||||
fprintf(stderr,"Reading symbols from file %s\n", filename);
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
fgets(buffer, sizeof(buffer), symbolfile);
|
||||
if (feof(symbolfile)) break;
|
||||
|
||||
/* Strip any text after a # sign (i.e. comments) */
|
||||
cpnt = buffer;
|
||||
while(*cpnt){
|
||||
if(*cpnt == '#') {*cpnt = 0; break; };
|
||||
cpnt++;
|
||||
};
|
||||
|
||||
/* Quietly ignore any lines that have just whitespace */
|
||||
cpnt = buffer;
|
||||
while(*cpnt){
|
||||
if(*cpnt != ' ' && *cpnt != '\t') break;
|
||||
cpnt++;
|
||||
};
|
||||
if (!(*cpnt) || *cpnt == '\n') {
|
||||
continue;
|
||||
};
|
||||
|
||||
nargs = sscanf(buffer, "%x %c %s", &addr, &type, name);
|
||||
add_hash(name, (unsigned int *) addr);
|
||||
};
|
||||
fclose(symbolfile);
|
||||
}
|
||||
|
||||
|
||||
/* Load the entry points from the dynamic linking into the hash tables.
|
||||
* This does not work yet - something needs to be added before it scans the
|
||||
* tables correctly
|
||||
*/
|
||||
|
||||
void
|
||||
load_entrypoints(){
|
||||
char buffer[256];
|
||||
char * cpnt;
|
||||
int j, ordinal, len;
|
||||
unsigned int address;
|
||||
|
||||
struct w_files * wpnt;
|
||||
for(wpnt = wine_files; wpnt; wpnt = wpnt->next){
|
||||
cpnt = wpnt->nrname_table;
|
||||
while(1==1){
|
||||
if( ((int) cpnt) - ((int)wpnt->nrname_table) >
|
||||
wpnt->ne_header->nrname_tab_length) break;
|
||||
len = *cpnt++;
|
||||
strncpy(buffer, cpnt, len);
|
||||
buffer[len] = 0;
|
||||
ordinal = *((unsigned short *) (cpnt + len));
|
||||
j = GetEntryPointFromOrdinal(wpnt, ordinal);
|
||||
address = j & 0xffff;
|
||||
j = j >> 16;
|
||||
address |= (wpnt->selector_table[j].selector) << 16;
|
||||
fprintf(stderr,"%s -> %x\n", buffer, address);
|
||||
add_hash(buffer, (unsigned int *) address);
|
||||
cpnt += len + 2;
|
||||
};
|
||||
};
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
* Wine debugger utility routines
|
||||
* Eric Youngdale
|
||||
* 9/93
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "regpos.h"
|
||||
|
||||
extern int * regval;
|
||||
extern unsigned int dbg_mask;
|
||||
extern unsigned int dbg_mode;
|
||||
|
||||
extern int print_insn(char * memaddr, char * realaddr, FILE * stream, int addrlen);
|
||||
|
||||
/* THese three helper functions eliminate the need for patching the
|
||||
module from gdb for disassembly of code */
|
||||
|
||||
void read_memory(char * memaddr, char * buffer, int len){
|
||||
memcpy(buffer, memaddr, len);
|
||||
}
|
||||
|
||||
void fputs_filtered(char * buffer, FILE * outfile){
|
||||
fputs(buffer, outfile);
|
||||
}
|
||||
|
||||
void print_address(unsigned int addr, FILE * outfile){
|
||||
char * name;
|
||||
name = find_nearest_symbol(addr);
|
||||
if(name)
|
||||
fprintf(outfile,"0x%8.8x(%s)", addr, name);
|
||||
else
|
||||
fprintf(outfile,"0x%8.8x", addr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void info_reg(){
|
||||
fprintf(stderr,"Register dump:\n");
|
||||
/* First get the segment registers out of the way */
|
||||
fprintf(stderr," CS:%4.4x SS:%4.4x DS:%4.4x ES:%4.4x GS:%4.4x FS:%4.4x\n",
|
||||
SC_CS, SC_SS, SC_DS, SC_ES, SC_GS, SC_FS);
|
||||
|
||||
/* Now dump the main registers */
|
||||
fprintf(stderr," EIP:%8.8x ESP:%8.8x EBP:%8.8x EFLAGS:%8.8x\n",
|
||||
SC_EIP(dbg_mask), SC_ESP(dbg_mask), SC_EBP(dbg_mask), SC_EFLAGS);
|
||||
|
||||
/* And dump the regular registers */
|
||||
|
||||
fprintf(stderr," EAX:%8.8x EBX:%8.8x ECX:%8.8x EDX:%8.8x\n",
|
||||
SC_EAX(dbg_mask), SC_EBX(dbg_mask), SC_ECX(dbg_mask), SC_EDX(dbg_mask));
|
||||
|
||||
/* Finally dump these main registers */
|
||||
fprintf(stderr," EDI:%8.8x ESI:%8.8x\n",
|
||||
SC_EDI(dbg_mask), SC_ESI(dbg_mask));
|
||||
|
||||
}
|
||||
|
||||
void info_stack(){
|
||||
unsigned int * dump;
|
||||
int i;
|
||||
|
||||
|
||||
fprintf(stderr,"Stack dump:\n");
|
||||
dump = (int*) SC_EIP(dbg_mask);
|
||||
for(i=0; i<22; i++)
|
||||
{
|
||||
fprintf(stderr," %8.8x", *dump++);
|
||||
if ((i % 8) == 7)
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
|
||||
|
||||
void examine_memory(int addr, int count, char format){
|
||||
char * pnt;
|
||||
unsigned int * dump;
|
||||
unsigned short int * wdump;
|
||||
int i;
|
||||
|
||||
if((addr & 0xffff0000) == 0 && dbg_mode == 16)
|
||||
addr |= (format == 'i' ? SC_CS : SC_DS) << 16;
|
||||
|
||||
|
||||
if(format != 'i' && count > 1) {
|
||||
print_address(addr, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
|
||||
|
||||
switch(format){
|
||||
case 's':
|
||||
pnt = (char *) addr;
|
||||
if (count == 1) count = 256;
|
||||
while(*pnt && count) {
|
||||
fputc( *pnt++, stderr);
|
||||
count--;
|
||||
};
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
|
||||
case 'i':
|
||||
for(i=0; i<count; i++) {
|
||||
print_address(addr, stderr);
|
||||
fprintf(stderr,": ");
|
||||
addr += print_insn((char *) addr, (char *) addr, stderr, dbg_mode);
|
||||
fprintf(stderr,"\n");
|
||||
};
|
||||
return;
|
||||
case 'x':
|
||||
dump = (unsigned int *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %8.8x", *dump++);
|
||||
if ((i % 8) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
|
||||
case 'd':
|
||||
dump = (unsigned int *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %d", *dump++);
|
||||
if ((i % 8) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
|
||||
case 'w':
|
||||
wdump = (unsigned short int *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %d", *wdump++);
|
||||
if ((i % 10) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
|
||||
case 'c':
|
||||
pnt = (char *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
if(*pnt < 0x20) {
|
||||
fprintf(stderr," ");
|
||||
pnt++;
|
||||
} else
|
||||
fprintf(stderr," %c", *pnt++);
|
||||
if ((i % 32) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
|
||||
case 'b':
|
||||
pnt = (char *) addr;
|
||||
for(i=0; i<count; i++)
|
||||
{
|
||||
fprintf(stderr," %d", *pnt++);
|
||||
if ((i % 32) == 7) {
|
||||
fprintf(stderr,"\n");
|
||||
print_address((unsigned int) dump, stderr);
|
||||
fprintf(stderr,": ");
|
||||
};
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
return;
|
||||
};
|
||||
|
||||
/* The rest are fairly straightforward */
|
||||
|
||||
fprintf(stderr,"examine mem: %x %d %c\n", addr, count, format);
|
||||
}
|
||||
|
||||
char * helptext[] = {
|
||||
"The commands accepted by the Wine debugger are a small subset",
|
||||
"of the commands that gdb would accept. The commands currently",
|
||||
"are:\n",
|
||||
" info reg",
|
||||
" info stack",
|
||||
" help",
|
||||
" quit",
|
||||
" print <expr>",
|
||||
" symbolfile <filename>",
|
||||
" define <identifier> <expr>",
|
||||
" x <expr>",
|
||||
" cont",
|
||||
" set <reg> = <expr>",
|
||||
" set *<expr> = <expr>",
|
||||
"",
|
||||
"The 'x' command accepts repeat counts and formats (including 'i') in the",
|
||||
"same way that gdb does.",
|
||||
"",
|
||||
" The following are examples of legal expressions:",
|
||||
" $eax $eax+0x3 0x1000 ($eip + 256) *$eax *($esp + 3)",
|
||||
" Also, a nm format symbol table can be read from a file using the",
|
||||
" symbolfile command. Symbols can also be defined individually with",
|
||||
" the define command.",
|
||||
"",
|
||||
"The disassembly code seems to work most of the time, but it does get",
|
||||
"a little confused at times. The 16 bit mode probably has not been used",
|
||||
"much so there are probably bugs. I snagged the file from the gdb-4.7",
|
||||
"source tree, which is what was on my latest cdrom. I should check to see",
|
||||
"if newer versions of gdb have anything substanitally different for the",
|
||||
"disassembler.",
|
||||
"",
|
||||
NULL};
|
||||
|
||||
void dbg_help(){
|
||||
int i;
|
||||
i = 0;
|
||||
while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
## $Revision: 1.2 $
|
||||
##
|
||||
## OS-9 makefile for editline library.
|
||||
##
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
RFILES = editline.r complete.r sysos9.r
|
||||
|
||||
%.r: %.c
|
||||
cc68 -r -Dstrchr=index -Dstrrchr=rindex -DNEED_STRDUP -DSYS_OS9 $*.c
|
||||
|
||||
testit: testit.r editline.lib
|
||||
cc68 -f=testit testit.r -l=editline.lib
|
||||
|
||||
$(RFILES): $(RFILES:%.r=%.c)
|
||||
|
||||
editline.lib: $(RFILES)
|
||||
cat $(RFILES) >$@
|
|
@ -0,0 +1,66 @@
|
|||
## $Revision: 1.3 $
|
||||
##
|
||||
## Unix makefile for editline library.
|
||||
##
|
||||
|
||||
## Set your options:
|
||||
## -DANSI_ARROWS ANSI arrows keys work like emacs.
|
||||
## -DHAVE_STDLIB Have <stdlib.h>.
|
||||
## -DHAVE_TCGETATTR Have tcgetattr(), tcsetattr().
|
||||
## -DHIDE Make static functions static (non debug).
|
||||
## -DHIST_SIZE=n History size.
|
||||
## -DNEED_STRDUP Don't have strdup().
|
||||
## -DUNIQUE_HISTORY Don't save command if same as last one.
|
||||
## -DUSE_DIRENT Use <dirent.h>, not <sys/dir.h>?
|
||||
## -DUSE_TERMCAP Use the termcap library for terminal size
|
||||
## see LDFLAGS, below, if you set this.
|
||||
## -DNEED_PERROR Don't have perror() (used in testit)
|
||||
DEFS = -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX
|
||||
|
||||
## Set your C compiler:
|
||||
WARN = -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings \
|
||||
-Wunused -Wcomment -Wswitch
|
||||
CC = gcc -ansi $(WARN)
|
||||
#CC = cc
|
||||
CFLAGS = $(DEFS) -O -g
|
||||
|
||||
## If you have -DUSE_TERMCAP, set this as appropriate:
|
||||
#LDFLAGS = -ltermlib
|
||||
#LDFLAGS = -ltermcap
|
||||
|
||||
## Set ranlib as appropriate:
|
||||
RANLIB = ranlib
|
||||
#RANLIB = echo
|
||||
|
||||
## End of configuration.
|
||||
|
||||
SOURCES = editline.c complete.c sysunix.c
|
||||
OBJECTS = editline.o complete.o sysunix.o
|
||||
SHARFILES = README Makefile editline.3 editline.h unix.h editline.c \
|
||||
complete.c sysunix.c testit.c \
|
||||
Make.os9 os9.h sysos9.c
|
||||
|
||||
all: libedit.a
|
||||
|
||||
testit: testit.c libedit.a
|
||||
$(CC) $(CFLAGS) -o testit testit.c libedit.a $(LDFLAGS)
|
||||
|
||||
shar: $(SHARFILES)
|
||||
shar $(SHARFILES) >shar
|
||||
|
||||
clean:
|
||||
rm -f *.[oa] testit foo core tags lint lint.all a.out shar
|
||||
|
||||
lint: testit
|
||||
lint -a -b -u -x $(DEFS) $(SOURCES) testit.c >lint.all
|
||||
sed -e '/warning: function prototype not in scope/d' \
|
||||
-e '/warning: old style argument declaration/'d \
|
||||
-e '/mix of old and new style function declaration/'d \
|
||||
<lint.all >lint
|
||||
|
||||
libedit.a: $(OBJECTS)
|
||||
@rm -f $@
|
||||
ar r $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(OBJECTS): editline.h
|
|
@ -0,0 +1,45 @@
|
|||
$Revision: 1.5 $
|
||||
|
||||
This is a line-editing library. It can be linked into almost any
|
||||
program to provide command-line editing and recall.
|
||||
|
||||
It is call-compatible with the FSF readline library, but it is a
|
||||
fraction of the size (and offers fewer features). It does not use
|
||||
standard I/O. It is distributed under a "C News-like" copyright.
|
||||
|
||||
Configuration is done in the Makefile. Type "make testit" to get
|
||||
a small slow shell for testing.
|
||||
|
||||
An earlier version was distributed with Byron's rc. Principal
|
||||
changes over that version include:
|
||||
Faster.
|
||||
Is eight-bit clean (thanks to brendan@cs.widener.edu)
|
||||
Written in K&R C, but ANSI compliant (gcc all warnings)
|
||||
Propagates EOF properly; rc trip test now passes
|
||||
Doesn't need or use or provide memmove.
|
||||
More robust
|
||||
Calling sequence changed to be compatible with readline.
|
||||
Test program, new manpage, better configuration
|
||||
More system-independant; includes Unix and OS-9 support.
|
||||
|
||||
Enjoy,
|
||||
Rich $alz
|
||||
<rsalz@osf.org>
|
||||
|
||||
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
|
||||
|
||||
This software is not subject to any license of the American Telephone
|
||||
and Telegraph Company or of the Regents of the University of California.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose on
|
||||
any computer system, and to alter it and redistribute it freely, subject
|
||||
to the following restrictions:
|
||||
1. The authors are not responsible for the consequences of use of this
|
||||
software, no matter how awful, even if they arise from flaws in it.
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. Since few users ever read sources,
|
||||
credits must appear in the documentation.
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software. Since few users
|
||||
ever read sources, credits must appear in the documentation.
|
||||
4. This notice may not be removed or altered.
|
|
@ -0,0 +1,222 @@
|
|||
/* $Revision: 1.3 $
|
||||
**
|
||||
** History and file completion functions for editline library.
|
||||
*/
|
||||
#include "editline.h"
|
||||
|
||||
|
||||
#if defined(NEED_STRDUP)
|
||||
/*
|
||||
** Return an allocated copy of a string.
|
||||
*/
|
||||
char *
|
||||
strdup(p)
|
||||
char *p;
|
||||
{
|
||||
char *new;
|
||||
|
||||
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
||||
(void)strcpy(new, p);
|
||||
return new;
|
||||
}
|
||||
#endif /* defined(NEED_STRDUP) */
|
||||
|
||||
/*
|
||||
** strcmp-like sorting predicate for qsort.
|
||||
*/
|
||||
STATIC int
|
||||
compare(p1, p2)
|
||||
CONST void *p1;
|
||||
CONST void *p2;
|
||||
{
|
||||
CONST char **v1;
|
||||
CONST char **v2;
|
||||
|
||||
v1 = (CONST char **)p1;
|
||||
v2 = (CONST char **)p2;
|
||||
return strcmp(*v1, *v2);
|
||||
}
|
||||
|
||||
/*
|
||||
** Fill in *avp with an array of names that match file, up to its length.
|
||||
** Ignore . and .. .
|
||||
*/
|
||||
STATIC int
|
||||
FindMatches(dir, file, avp)
|
||||
char *dir;
|
||||
char *file;
|
||||
char ***avp;
|
||||
{
|
||||
char **av;
|
||||
char **new;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
DIRENTRY *ep;
|
||||
SIZE_T ac;
|
||||
SIZE_T len;
|
||||
|
||||
if ((dp = opendir(dir)) == NULL)
|
||||
return 0;
|
||||
|
||||
av = NULL;
|
||||
ac = 0;
|
||||
len = strlen(file);
|
||||
while ((ep = readdir(dp)) != NULL) {
|
||||
p = ep->d_name;
|
||||
if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
|
||||
continue;
|
||||
if (len && strncmp(p, file, len) != 0)
|
||||
continue;
|
||||
|
||||
if ((ac % MEM_INC) == 0) {
|
||||
if ((new = NEW(char*, ac + MEM_INC)) == NULL)
|
||||
break;
|
||||
if (ac) {
|
||||
COPYFROMTO(new, av, ac * sizeof (char **));
|
||||
DISPOSE(av);
|
||||
}
|
||||
*avp = av = new;
|
||||
}
|
||||
|
||||
if ((av[ac] = strdup(p)) == NULL) {
|
||||
if (ac == 0)
|
||||
DISPOSE(av);
|
||||
break;
|
||||
}
|
||||
ac++;
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
(void)closedir(dp);
|
||||
if (ac)
|
||||
qsort(av, ac, sizeof (char **), compare);
|
||||
return ac;
|
||||
}
|
||||
|
||||
/*
|
||||
** Split a pathname into allocated directory and trailing filename parts.
|
||||
*/
|
||||
STATIC int
|
||||
SplitPath(path, dirpart, filepart)
|
||||
char *path;
|
||||
char **dirpart;
|
||||
char **filepart;
|
||||
{
|
||||
static char DOT[] = ".";
|
||||
char *dpart;
|
||||
char *fpart;
|
||||
|
||||
if ((fpart = strrchr(path, '/')) == NULL) {
|
||||
if ((dpart = strdup(DOT)) == NULL)
|
||||
return -1;
|
||||
if ((fpart = strdup(path)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((dpart = strdup(path)) == NULL)
|
||||
return -1;
|
||||
dpart[fpart - path] = '\0';
|
||||
if ((fpart = strdup(++fpart)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*dirpart = dpart;
|
||||
*filepart = fpart;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Attempt to complete the pathname, returning an allocated copy.
|
||||
** Fill in *unique if we completed it, or set it to 0 if ambiguous.
|
||||
*/
|
||||
char *
|
||||
rl_complete(pathname, unique)
|
||||
char *pathname;
|
||||
int *unique;
|
||||
{
|
||||
char **av;
|
||||
char *dir;
|
||||
char *file;
|
||||
char *new;
|
||||
char *p;
|
||||
SIZE_T ac;
|
||||
SIZE_T end;
|
||||
SIZE_T i;
|
||||
SIZE_T j;
|
||||
SIZE_T len;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return NULL;
|
||||
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = NULL;
|
||||
len = strlen(file);
|
||||
if (ac == 1) {
|
||||
/* Exactly one match -- finish it off. */
|
||||
*unique = 1;
|
||||
j = strlen(av[0]) - len + 2;
|
||||
if ((p = NEW(char, j + 1)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
if ((new = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) {
|
||||
(void)strcpy(new, dir);
|
||||
(void)strcat(new, "/");
|
||||
(void)strcat(new, av[0]);
|
||||
rl_add_slash(new, p);
|
||||
DISPOSE(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*unique = 0;
|
||||
if (len) {
|
||||
/* Find largest matching substring. */
|
||||
for (i = len, end = strlen(av[0]); i < end; i++)
|
||||
for (j = 1; j < ac; j++)
|
||||
if (av[0][i] != av[j][i])
|
||||
goto breakout;
|
||||
breakout:
|
||||
if (i > len) {
|
||||
j = i - len + 1;
|
||||
if ((p = NEW(char, j)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
p[j - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
for (i = 0; i < ac; i++)
|
||||
DISPOSE(av[i]);
|
||||
DISPOSE(av);
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return all possible completions.
|
||||
*/
|
||||
int
|
||||
rl_list_possib(pathname, avp)
|
||||
char *pathname;
|
||||
char ***avp;
|
||||
{
|
||||
char *dir;
|
||||
char *file;
|
||||
int ac;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return 0;
|
||||
ac = FindMatches(dir, file, avp);
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
return ac;
|
||||
}
|
|
@ -0,0 +1,175 @@
|
|||
.\" $Revision: 1.1 $
|
||||
.TH EDITLINE 3
|
||||
.SH NAME
|
||||
editline \- command-line editing library with history
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B "char *"
|
||||
.B "readline(prompt)"
|
||||
.B " char *prompt;"
|
||||
|
||||
.B "void"
|
||||
.B "add_history(line)"
|
||||
.B " char *line;"
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.I Editline
|
||||
is a library that provides an line-editing interface with text recall.
|
||||
It is intended to be compatible with the
|
||||
.I readline
|
||||
library provided by the Free Software Foundation, but much smaller.
|
||||
The bulk of this manual page describes the user interface.
|
||||
.PP
|
||||
The
|
||||
.I readline
|
||||
routine returns a line of text with the trailing newline removed.
|
||||
The data is returned in a buffer allocated with
|
||||
.IR malloc (3),
|
||||
so the space should be released with
|
||||
.IR free (3)
|
||||
when the calling program is done with it.
|
||||
Before accepting input from the user, the specified
|
||||
.I prompt
|
||||
is displayed on the terminal.
|
||||
.PP
|
||||
The
|
||||
.I add_history
|
||||
routine makes a copy of the specified
|
||||
.I line
|
||||
and adds it to the internal history list.
|
||||
.SS "User Interface"
|
||||
A program that uses this library provides a simple emacs-like editing
|
||||
interface to its users.
|
||||
A line may be edited before it is sent to the calling program by typing either
|
||||
control characters or escape sequences.
|
||||
A control character, shown as a caret followed by a letter, is typed by
|
||||
holding down the ``control'' key while the letter is typed.
|
||||
For example, ``^A'' is a control-A.
|
||||
An escape sequence is entered by typing the ``escape'' key followed by one or
|
||||
more characters.
|
||||
The escape key is abbreviated as ``ESC.''
|
||||
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
|
||||
is not the same as ``ESC\ f''.
|
||||
.PP
|
||||
An editing command may be typed anywhere on the line, not just at the
|
||||
beginning.
|
||||
In addition, a return may also be typed anywhere on the line, not just at
|
||||
the end.
|
||||
.PP
|
||||
Most editing commands may be given a repeat count,
|
||||
.IR n ,
|
||||
where
|
||||
.I n
|
||||
is a number.
|
||||
To enter a repeat count, type the escape key, the number, and then
|
||||
the command to execute.
|
||||
For example, ``ESC\ 4\ ^f'' moves forward four characters.
|
||||
If a command may be given a repeat count then the text ``[n]'' is given at the
|
||||
end of its description.
|
||||
.PP
|
||||
The following control characters are accepted:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
^A Move to the beginning of the line
|
||||
^B Move left (backwards) [n]
|
||||
^D Delete character [n]
|
||||
^E Move to end of line
|
||||
^F Move right (forwards) [n]
|
||||
^G Ring the bell
|
||||
^H Delete character before cursor (backspace key) [n]
|
||||
^I Complete filename (tab key); see below
|
||||
^J Done with line (return key)
|
||||
^K Kill to end of line (or column [n])
|
||||
^L Redisplay line
|
||||
^M Done with line (alternate return key)
|
||||
^N Get next line from history [n]
|
||||
^P Get previous line from history [n]
|
||||
^R Search backward (forward if [n]) through history for text;
|
||||
\& must start line if text begins with an uparrow
|
||||
^T Transpose characters
|
||||
^V Insert next character, even if it is an edit command
|
||||
^W Wipe to the mark
|
||||
^X^X Exchange current location and mark
|
||||
^Y Yank back last killed text
|
||||
^[ Start an escape sequence (escape key)
|
||||
^]c Move forward to next character ``c''
|
||||
^? Delete character before cursor (delete key) [n]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The following escape sequences are provided.
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'ESC DEL 'u
|
||||
ESC\ ^H Delete previous word (backspace key) [n]
|
||||
ESC\ DEL Delete previous word (delete key) [n]
|
||||
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
|
||||
ESC\ \. Get the last (or [n]'th) word from previous line
|
||||
ESC\ \? Show possible completions; see below
|
||||
ESC\ < Move to start of history
|
||||
ESC\ > Move to end of history
|
||||
ESC\ b Move backward a word [n]
|
||||
ESC\ d Delete word under cursor [n]
|
||||
ESC\ f Move forward a word [n]
|
||||
ESC\ l Make word lowercase [n]
|
||||
ESC\ u Make word uppercase [n]
|
||||
ESC\ y Yank back last killed text
|
||||
ESC\ v Show library version
|
||||
ESC\ w Make area up to mark yankable
|
||||
ESC\ nn Set repeat count to the number nn
|
||||
ESC\ C Read from environment variable ``_C_'', where C is
|
||||
\& an uppercase letter
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library has a small macro facility.
|
||||
If you type the escape key followed by an uppercase letter,
|
||||
.IR C ,
|
||||
then the contents of the environment variable
|
||||
.I _C_
|
||||
are read in as if you had typed them at the keyboard.
|
||||
For example, if the variable
|
||||
.I _L_
|
||||
contains the following:
|
||||
.RS
|
||||
^A^Kecho '^V^[[H^V^[[2J'^M
|
||||
.RE
|
||||
Then typing ``ESC L'' will move to the beginning of the line, kill the
|
||||
entire line, enter the echo command needed to clear the terminal (if your
|
||||
terminal is like a VT-100), and send the line back to the shell.
|
||||
.PP
|
||||
The
|
||||
.I editline
|
||||
library also does filename completion.
|
||||
Suppose the root directory has the following files in it:
|
||||
.RS
|
||||
.nf
|
||||
.ta \w'core 'u
|
||||
bin vmunix
|
||||
core vmunix.old
|
||||
.fi
|
||||
.RE
|
||||
If you type ``rm\ /v'' and then the tab key.
|
||||
.I Editline
|
||||
will then finish off as much of the name as possible by adding ``munix''.
|
||||
Because the name is not unique, it will then beep.
|
||||
If you type the escape key and a question mark, it will display the
|
||||
two choices.
|
||||
If you then type a period and a tab, the library will finish off the filename
|
||||
for you:
|
||||
.RS
|
||||
.nf
|
||||
.RI "rm /v[TAB]" munix .TAB old
|
||||
.fi
|
||||
.RE
|
||||
The tab key is shown by ``[TAB]'' and the automatically-entered text
|
||||
is shown in italics.
|
||||
.SH "BUGS AND LIMITATIONS"
|
||||
Cannot handle lines more than 80 columns.
|
||||
.SH AUTHORS
|
||||
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
|
||||
and Rich $alz <rsalz@osf.org>.
|
||||
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
|
|
@ -0,0 +1,76 @@
|
|||
/* $Revision: 1.3 $
|
||||
**
|
||||
** Internal header file for editline library.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#if defined(HAVE_STDLIB)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif /* defined(HAVE_STDLIB) */
|
||||
#if defined(SYS_UNIX)
|
||||
#include "unix.h"
|
||||
#endif /* defined(SYS_UNIX) */
|
||||
#if defined(SYS_OS9)
|
||||
#include "os9.h"
|
||||
#endif /* defined(SYS_OS9) */
|
||||
|
||||
#if !defined(SIZE_T)
|
||||
#define SIZE_T unsigned int
|
||||
#endif /* !defined(SIZE_T) */
|
||||
|
||||
typedef unsigned char CHAR;
|
||||
|
||||
#if defined(HIDE)
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC /* NULL */
|
||||
#endif /* !defined(HIDE) */
|
||||
|
||||
#if !defined(CONST)
|
||||
#if defined(__STDC__)
|
||||
#define CONST const
|
||||
#else
|
||||
#define CONST
|
||||
#endif /* defined(__STDC__) */
|
||||
#endif /* !defined(CONST) */
|
||||
|
||||
|
||||
#define MEM_INC 64
|
||||
#define SCREEN_INC 256
|
||||
|
||||
#define DISPOSE(p) free((char *)(p))
|
||||
#define NEW(T, c) \
|
||||
((T *)malloc((unsigned int)(sizeof (T) * (c))))
|
||||
#define RENEW(p, T, c) \
|
||||
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
|
||||
#define COPYFROMTO(new, p, len) \
|
||||
(void)memcpy((char *)(new), (char *)(p), (int)(len))
|
||||
|
||||
|
||||
/*
|
||||
** Variables and routines internal to this package.
|
||||
*/
|
||||
extern int rl_eof;
|
||||
extern int rl_erase;
|
||||
extern int rl_intr;
|
||||
extern int rl_kill;
|
||||
extern int rl_quit;
|
||||
extern char *rl_complete();
|
||||
extern int rl_list_possib();
|
||||
extern void rl_ttyset();
|
||||
extern void rl_add_slash();
|
||||
|
||||
#if !defined(HAVE_STDLIB)
|
||||
extern char *getenv();
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern char *memcpy();
|
||||
extern char *strcat();
|
||||
extern char *strchr();
|
||||
extern char *strrchr();
|
||||
extern char *strcpy();
|
||||
extern char *strdup();
|
||||
extern int strcmp();
|
||||
extern int strlen();
|
||||
extern int strncmp();
|
||||
#endif /* !defined(HAVE_STDLIB) */
|
|
@ -0,0 +1,10 @@
|
|||
/* $Revision: 1.1 $
|
||||
**
|
||||
** Editline system header file for OS-9 (on 68k).
|
||||
*/
|
||||
|
||||
#define CRLF "\r\l"
|
||||
#define FORWARD extern
|
||||
|
||||
#include <dir.h>
|
||||
typedef struct direct DIRENTRY;
|
|
@ -0,0 +1,46 @@
|
|||
/* $Revision: 1.1 $
|
||||
**
|
||||
** OS-9 system-dependant routines for editline library.
|
||||
*/
|
||||
#include "editline.h"
|
||||
#include <sgstat.h>
|
||||
#include <modes.h>
|
||||
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
{
|
||||
static struct sgbuf old;
|
||||
struct sgbuf new;
|
||||
|
||||
|
||||
if (Reset == 0) {
|
||||
_gs_opt(0, &old);
|
||||
_gs_opt(0, &new);
|
||||
new.sg_backsp = 0; new.sg_delete = 0; new.sg_echo = 0;
|
||||
new.sg_alf = 0; new.sg_nulls = 0; new.sg_pause = 0;
|
||||
new.sg_page = 0; new.sg_bspch = 0; new.sg_dlnch = 0;
|
||||
new.sg_eorch = 0; new.sg_eofch = 0; new.sg_rlnch = 0;
|
||||
new.sg_dulnch = 0; new.sg_psch = 0; new.sg_kbich = 0;
|
||||
new.sg_kbach = 0; new.sg_bsech = 0; new.sg_bellch = 0;
|
||||
new.sg_xon = 0; new.sg_xoff = 0; new.sg_tabcr = 0;
|
||||
new.sg_tabsiz = 0;
|
||||
_ss_opt(0, &new);
|
||||
rl_erase = old.sg_bspch;
|
||||
rl_kill = old.sg_dlnch;
|
||||
rl_eof = old.sg_eofch;
|
||||
rl_intr = old.sg_kbich;
|
||||
rl_quit = -1;
|
||||
}
|
||||
else
|
||||
_ss_opt(0, &old);
|
||||
}
|
||||
|
||||
void
|
||||
rl_add_slash(path, p)
|
||||
char *path;
|
||||
char *p;
|
||||
{
|
||||
(void)strcat(p, access(path, S_IREAD | S_IFDIR) ? " " : "/");
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/* $Revision: 1.1 $
|
||||
**
|
||||
** Unix system-dependant routines for editline library.
|
||||
*/
|
||||
#include "editline.h"
|
||||
|
||||
#if defined(HAVE_TCGETATTR)
|
||||
#include <termios.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
{
|
||||
static struct termios old;
|
||||
struct termios new;
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)tcgetattr(0, &old);
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
|
||||
new = old;
|
||||
new.c_cc[VINTR] = -1;
|
||||
new.c_cc[VQUIT] = -1;
|
||||
new.c_lflag &= ~(ECHO | ICANON);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
(void)tcsetattr(0, TCSANOW, &new);
|
||||
}
|
||||
else
|
||||
(void)tcsetattr(0, TCSANOW, &old);
|
||||
}
|
||||
|
||||
#else
|
||||
#include <sgtty.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
{
|
||||
static struct sgttyb old_sgttyb;
|
||||
static struct tchars old_tchars;
|
||||
struct sgttyb new_sgttyb;
|
||||
struct tchars new_tchars;
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)ioctl(0, TIOCGETP, &old_sgttyb);
|
||||
rl_erase = old_sgttyb.sg_erase;
|
||||
rl_kill = old_sgttyb.sg_kill;
|
||||
|
||||
(void)ioctl(0, TIOCGETC, &old_tchars);
|
||||
rl_eof = old_tchars.t_eofc;
|
||||
rl_intr = old_tchars.t_intrc;
|
||||
rl_quit = old_tchars.t_quitc;
|
||||
|
||||
new_sgttyb = old_sgttyb;
|
||||
new_sgttyb.sg_flags &= ~ECHO;
|
||||
new_sgttyb.sg_flags |= RAW;
|
||||
#if defined(PASS8)
|
||||
new_sgttyb.sg_flags |= PASS8;
|
||||
#endif /* defined(PASS8) */
|
||||
(void)ioctl(0, TIOCSETP, &new_sgttyb);
|
||||
|
||||
new_tchars = old_tchars;
|
||||
new_tchars.t_intrc = -1;
|
||||
new_tchars.t_quitc = -1;
|
||||
(void)ioctl(0, TIOCSETC, &new_tchars);
|
||||
}
|
||||
else {
|
||||
(void)ioctl(0, TIOCSETP, &old_sgttyb);
|
||||
(void)ioctl(0, TIOCSETC, &old_tchars);
|
||||
}
|
||||
}
|
||||
#endif /* defined(HAVE_TCGETATTR) */
|
||||
|
||||
void
|
||||
rl_add_slash(path, p)
|
||||
char *path;
|
||||
char *p;
|
||||
{
|
||||
struct stat Sb;
|
||||
|
||||
if (stat(path, &Sb) >= 0)
|
||||
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/* $Revision: 1.2 $
|
||||
**
|
||||
** A "micro-shell" to test editline library.
|
||||
** If given any arguments, commands aren't executed.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#if defined(HAVE_STDLIB)
|
||||
#include <stdlib.h>
|
||||
#endif /* defined(HAVE_STDLIB) */
|
||||
|
||||
const char version_string[] = "4.321";
|
||||
|
||||
|
||||
extern char *readline();
|
||||
extern void add_history();
|
||||
|
||||
#if !defined(HAVE_STDLIB)
|
||||
extern int chdir();
|
||||
extern int free();
|
||||
extern int strncmp();
|
||||
extern int system();
|
||||
extern void exit();
|
||||
#endif /* !defined(HAVE_STDLIB) */
|
||||
|
||||
|
||||
#if defined(NEED_PERROR)
|
||||
void
|
||||
perror(s)
|
||||
char *s;
|
||||
{
|
||||
extern int errno;
|
||||
|
||||
(voidf)printf(stderr, "%s: error %d\n", s, errno);
|
||||
}
|
||||
#endif /* defined(NEED_PERROR) */
|
||||
|
||||
|
||||
/* ARGSUSED1 */
|
||||
int
|
||||
main(ac, av)
|
||||
int ac;
|
||||
char *av[];
|
||||
{
|
||||
char *p;
|
||||
int doit;
|
||||
|
||||
doit = ac == 1;
|
||||
while ((p = readline("testit> ")) != NULL) {
|
||||
(void)printf("\t\t\t|%s|\n", p);
|
||||
if (doit)
|
||||
if (strncmp(p, "cd ", 3) == 0) {
|
||||
if (chdir(&p[3]) < 0)
|
||||
perror(&p[3]);
|
||||
}
|
||||
else if (system(p) != 0)
|
||||
perror(p);
|
||||
add_history(p);
|
||||
free(p);
|
||||
}
|
||||
exit(0);
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/* $Revision: 1.1 $
|
||||
**
|
||||
** Editline system header file for Unix.
|
||||
*/
|
||||
|
||||
#define CRLF "\r\n"
|
||||
#define FORWARD STATIC
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(USE_DIRENT)
|
||||
#include <dirent.h>
|
||||
typedef struct dirent DIRENTRY;
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
typedef struct direct DIRENTRY;
|
||||
#endif /* defined(USE_DIRENT) */
|
||||
|
||||
#if !defined(S_ISDIR)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif /* !defined(S_ISDIR) */
|
|
@ -0,0 +1,6 @@
|
|||
const char version_string[] = "1.234";
|
||||
|
||||
|
||||
static char foobar[]="foobar";
|
||||
|
||||
const char * foo_string = foobar;
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
#ifdef linux
|
||||
/* Register numbers */
|
||||
#define RN_GS 0
|
||||
#define RN_FS 1
|
||||
#define RN_ES 2
|
||||
#define RN_DS 3
|
||||
#define RN_EDI 4
|
||||
#define RN_ESI 5
|
||||
#define RN_EBP 6
|
||||
#define RN_ESP 7
|
||||
#define RN_EBX 8
|
||||
#define RN_EDX 9
|
||||
#define RN_ECX 10
|
||||
#define RN_EAX 11
|
||||
#define RN_TRAPNO 12
|
||||
#define RN_ERR 13
|
||||
#define RN_EIP 14
|
||||
#define RN_CS 15
|
||||
#define RN_EFLAGS 16
|
||||
#define RN_ESP_AT_SIGNAL 17
|
||||
#define RN_SS 18
|
||||
#define RN_I387 19
|
||||
#define RN_OLDMASK 20
|
||||
#define RN_CR2 21
|
||||
#endif
|
||||
|
||||
|
||||
#define SC_GS regval[RN_GS]
|
||||
#define SC_FS regval[RN_FS]
|
||||
#define SC_ES regval[RN_ES]
|
||||
#define SC_DS regval[RN_DS]
|
||||
#define SC_EDI(dbg_mask) (regval[RN_EDI] & dbg_mask)
|
||||
#define SC_ESI(dbg_mask) (regval[RN_ESI] & dbg_mask)
|
||||
#define SC_EBP(dbg_mask) (regval[RN_EBP] & dbg_mask)
|
||||
#define SC_ESP(dbg_mask) (regval[RN_ESP] & dbg_mask)
|
||||
#define SC_EBX(dbg_mask) (regval[RN_EBX] & dbg_mask)
|
||||
#define SC_EDX(dbg_mask) (regval[RN_EDX] & dbg_mask)
|
||||
#define SC_ECX(dbg_mask) (regval[RN_ECX] & dbg_mask)
|
||||
#define SC_EAX(dbg_mask) (regval[RN_EAX] & dbg_mask)
|
||||
#define SC_TRAPNO regval[RN_TRAPNO]
|
||||
#define SC_ERR regval[RN_ERR]
|
||||
#define SC_EIP(dbg_mask) (regval[RN_EIP] & dbg_mask)
|
||||
#define SC_CS regval[RN_CS]
|
||||
#define SC_EFLAGS regval[RN_EFLAGS]
|
||||
#define ESP_AT_SIGNAL regval[RN_ESP_AT_SIGNAL]
|
||||
#define SC_SS regval[RN_SS]
|
||||
#define I387 regval[RN_I387]
|
||||
#define OLDMASK regval[RN_OLDMASK]
|
||||
#define CR2 regval[RN_CR2]
|
||||
|
|
@ -0,0 +1,324 @@
|
|||
/* Macro definitions for i386, Unix System V.
|
||||
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (TM_I386V_H)
|
||||
#define TM_I386V_H 1
|
||||
|
||||
/*
|
||||
* Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu)
|
||||
* July 1988
|
||||
*/
|
||||
|
||||
#define TARGET_BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* define this if you don't have the extension to coff that allows
|
||||
* file names to appear in the string table
|
||||
* (aux.x_file.x_foff)
|
||||
*/
|
||||
#define COFF_NO_LONG_FILE_NAMES
|
||||
|
||||
/* turn this on when rest of gdb is ready */
|
||||
#define IEEE_FLOAT
|
||||
|
||||
/* Define this if the C compiler puts an underscore at the front
|
||||
of external names before giving them to the linker. */
|
||||
|
||||
/* #define NAMES_HAVE_UNDERSCORE */
|
||||
|
||||
/* number of traps that happen between exec'ing the shell
|
||||
* to run an inferior, and when we finally get to
|
||||
* the inferior code. This is 2 on most implementations.
|
||||
*/
|
||||
#ifndef START_INFERIOR_TRAPS_EXPECTED
|
||||
#define START_INFERIOR_TRAPS_EXPECTED 4
|
||||
#endif
|
||||
|
||||
/* Offset from address of function to start of its code.
|
||||
Zero on most machines. */
|
||||
|
||||
#define FUNCTION_START_OFFSET 0
|
||||
|
||||
/* Advance PC across any function entry prologue instructions
|
||||
to reach some "real" code. */
|
||||
|
||||
#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));}
|
||||
|
||||
extern int
|
||||
i386_skip_prologue PARAMS ((int));
|
||||
|
||||
/* Immediately after a function call, return the saved pc.
|
||||
Can't always go through the frames for this because on some machines
|
||||
the new frame is not set up until the new function executes
|
||||
some instructions. */
|
||||
|
||||
#define SAVED_PC_AFTER_CALL(frame) \
|
||||
(read_memory_integer (read_register (SP_REGNUM), 4))
|
||||
|
||||
/* Address of end of stack space. */
|
||||
|
||||
#define STACK_END_ADDR 0x80000000
|
||||
|
||||
/* Stack grows downward. */
|
||||
|
||||
#define INNER_THAN <
|
||||
|
||||
/* Sequence of bytes for breakpoint instruction. */
|
||||
|
||||
#define BREAKPOINT {0xcc}
|
||||
|
||||
/* Amount PC must be decremented by after a breakpoint.
|
||||
This is often the number of bytes in BREAKPOINT
|
||||
but not always. */
|
||||
|
||||
#ifndef DECR_PC_AFTER_BREAK
|
||||
#define DECR_PC_AFTER_BREAK 1
|
||||
#endif
|
||||
|
||||
/* Nonzero if instruction at PC is a return instruction. */
|
||||
|
||||
#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0xc3)
|
||||
|
||||
/* Return 1 if P points to an invalid floating point value.
|
||||
LEN is the length in bytes -- not relevant on the 386. */
|
||||
|
||||
#define INVALID_FLOAT(p, len) (0)
|
||||
|
||||
/* Say how long (ordinary) registers are. */
|
||||
|
||||
#define REGISTER_TYPE long
|
||||
|
||||
/* Number of machine registers */
|
||||
|
||||
#define NUM_REGS 16
|
||||
|
||||
/* Initializer for an array of names of registers.
|
||||
There should be NUM_REGS strings in this initializer. */
|
||||
|
||||
/* the order of the first 8 registers must match the compiler's
|
||||
* numbering scheme (which is the same as the 386 scheme)
|
||||
* also, this table must match regmap in i386-pinsn.c.
|
||||
*/
|
||||
#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
|
||||
"esp", "ebp", "esi", "edi", \
|
||||
"eip", "ps", "cs", "ss", \
|
||||
"ds", "es", "fs", "gs", \
|
||||
}
|
||||
|
||||
/* Register numbers of various important registers.
|
||||
Note that some of these values are "real" register numbers,
|
||||
and correspond to the general registers of the machine,
|
||||
and some are "phony" register numbers which are too large
|
||||
to be actual register numbers as far as the user is concerned
|
||||
but do serve to get the desired values when passed to read_register. */
|
||||
|
||||
#define FP_REGNUM 5 /* Contains address of executing stack frame */
|
||||
#define SP_REGNUM 4 /* Contains address of top of stack */
|
||||
|
||||
#define PC_REGNUM 8
|
||||
#define PS_REGNUM 9
|
||||
|
||||
/* Total amount of space needed to store our copies of the machine's
|
||||
register state, the array `registers'. */
|
||||
#define REGISTER_BYTES (NUM_REGS * 4)
|
||||
|
||||
/* Index within `registers' of the first byte of the space for
|
||||
register N. */
|
||||
|
||||
#define REGISTER_BYTE(N) ((N)*4)
|
||||
|
||||
/* Number of bytes of storage in the actual machine representation
|
||||
for register N. */
|
||||
|
||||
#define REGISTER_RAW_SIZE(N) (4)
|
||||
|
||||
/* Number of bytes of storage in the program's representation
|
||||
for register N. */
|
||||
|
||||
#define REGISTER_VIRTUAL_SIZE(N) (4)
|
||||
|
||||
/* Largest value REGISTER_RAW_SIZE can have. */
|
||||
|
||||
#define MAX_REGISTER_RAW_SIZE 4
|
||||
|
||||
/* Largest value REGISTER_VIRTUAL_SIZE can have. */
|
||||
|
||||
#define MAX_REGISTER_VIRTUAL_SIZE 4
|
||||
|
||||
/* Nonzero if register N requires conversion
|
||||
from raw format to virtual format. */
|
||||
|
||||
#define REGISTER_CONVERTIBLE(N) (0)
|
||||
|
||||
/* Convert data from raw format for register REGNUM
|
||||
to virtual format for register REGNUM. */
|
||||
|
||||
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
|
||||
{memcpy ((TO), (FROM), 4);}
|
||||
|
||||
/* Convert data from virtual format for register REGNUM
|
||||
to raw format for register REGNUM. */
|
||||
|
||||
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
|
||||
{memcpy ((TO), (FROM), 4);}
|
||||
|
||||
/* Return the GDB type object for the "standard" data type
|
||||
of data in register N. */
|
||||
/* Perhaps si and di should go here, but potentially they could be
|
||||
used for things other than address. */
|
||||
#define REGISTER_VIRTUAL_TYPE(N) \
|
||||
((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \
|
||||
lookup_pointer_type (builtin_type_void) : builtin_type_int)
|
||||
|
||||
/* Store the address of the place in which to copy the structure the
|
||||
subroutine will return. This is called from call_function. */
|
||||
|
||||
#define STORE_STRUCT_RETURN(ADDR, SP) \
|
||||
{ (SP) -= sizeof (ADDR); \
|
||||
write_memory ((SP), (char *) &(ADDR), sizeof (ADDR)); }
|
||||
|
||||
/* Extract from an array REGBUF containing the (raw) register state
|
||||
a function return value of type TYPE, and copy that, in virtual format,
|
||||
into VALBUF. */
|
||||
|
||||
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
|
||||
memcpy ((VALBUF), (REGBUF), TYPE_LENGTH (TYPE))
|
||||
|
||||
/* Write into appropriate registers a function return value
|
||||
of type TYPE, given in virtual format. */
|
||||
|
||||
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
|
||||
write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
|
||||
|
||||
/* Extract from an array REGBUF containing the (raw) register state
|
||||
the address in which a function should return its structure value,
|
||||
as a CORE_ADDR (or an expression that can be used as one). */
|
||||
|
||||
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
|
||||
|
||||
|
||||
/* Describe the pointer in each stack frame to the previous stack frame
|
||||
(its caller). */
|
||||
|
||||
/* FRAME_CHAIN takes a frame's nominal address
|
||||
and produces the frame's chain-pointer. */
|
||||
|
||||
#define FRAME_CHAIN(thisframe) \
|
||||
(!inside_entry_file ((thisframe)->pc) ? \
|
||||
read_memory_integer ((thisframe)->frame, 4) :\
|
||||
0)
|
||||
|
||||
/* Define other aspects of the stack frame. */
|
||||
|
||||
/* A macro that tells us whether the function invocation represented
|
||||
by FI does not have a frame on the stack associated with it. If it
|
||||
does not, FRAMELESS is set to 1, else 0. */
|
||||
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
|
||||
(FRAMELESS) = frameless_look_for_prologue(FI)
|
||||
|
||||
#define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
|
||||
|
||||
#define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
|
||||
|
||||
#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
|
||||
|
||||
/* Return number of args passed to a frame.
|
||||
Can return -1, meaning no way to tell. */
|
||||
|
||||
#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi)
|
||||
|
||||
#ifdef __STDC__ /* Forward decl's for prototypes */
|
||||
struct frame_info;
|
||||
struct frame_saved_regs;
|
||||
#endif
|
||||
|
||||
extern int
|
||||
i386_frame_num_args PARAMS ((struct frame_info *));
|
||||
|
||||
/* Return number of bytes at start of arglist that are not really args. */
|
||||
|
||||
#define FRAME_ARGS_SKIP 8
|
||||
|
||||
/* Put here the code to store, into a struct frame_saved_regs,
|
||||
the addresses of the saved registers of frame described by FRAME_INFO.
|
||||
This includes special registers such as pc and fp saved in special
|
||||
ways in the stack frame. sp is even more special:
|
||||
the address we return for it IS the sp for the next frame. */
|
||||
|
||||
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
|
||||
{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); }
|
||||
|
||||
extern void
|
||||
i386_frame_find_saved_regs PARAMS ((struct frame_info *,
|
||||
struct frame_saved_regs *));
|
||||
|
||||
|
||||
/* Things needed for making the inferior call functions. */
|
||||
|
||||
/* Push an empty stack frame, to record the current PC, etc. */
|
||||
|
||||
#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); }
|
||||
|
||||
extern void
|
||||
i386_push_dummy_frame PARAMS ((void));
|
||||
|
||||
/* Discard from the stack the innermost frame, restoring all registers. */
|
||||
|
||||
#define POP_FRAME { i386_pop_frame (); }
|
||||
|
||||
extern void
|
||||
i386_pop_frame PARAMS ((void));
|
||||
|
||||
/* this is
|
||||
* call 11223344 (32 bit relative)
|
||||
* int3
|
||||
*/
|
||||
|
||||
#define CALL_DUMMY { 0x223344e8, 0xcc11 }
|
||||
|
||||
#define CALL_DUMMY_LENGTH 8
|
||||
|
||||
#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
|
||||
|
||||
/* Insert the specified number of args and function address
|
||||
into a call sequence of the above form stored at DUMMYNAME. */
|
||||
|
||||
#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
|
||||
{ \
|
||||
int from, to, delta, loc; \
|
||||
loc = (int)(read_register (SP_REGNUM) - CALL_DUMMY_LENGTH); \
|
||||
from = loc + 5; \
|
||||
to = (int)(fun); \
|
||||
delta = to - from; \
|
||||
*((char *)(dummyname) + 1) = (delta & 0xff); \
|
||||
*((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \
|
||||
*((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \
|
||||
*((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \
|
||||
}
|
||||
|
||||
extern void
|
||||
print_387_control_word PARAMS ((unsigned int));
|
||||
|
||||
extern void
|
||||
print_387_status_word PARAMS ((unsigned int));
|
||||
|
||||
/* Offset from SP to first arg on stack at first instruction of a function */
|
||||
|
||||
#define SP_ARG0 (1 * 4)
|
||||
|
||||
#endif /* !defined (TM_I386V_H) */
|
|
@ -0,0 +1,27 @@
|
|||
/* Macro definitions for linux.
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
This file is part of GDB.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (TM_LINUX_H)
|
||||
#define TM_LINUX_H 1
|
||||
/* number of traps that happen between exec'ing the shell
|
||||
* to run an inferior, and when we finally get to
|
||||
* the inferior code. This is 2 on most implementations.
|
||||
*/
|
||||
#define START_INFERIOR_TRAPS_EXPECTED 2
|
||||
#include "tm-i386v.h"
|
||||
/* Define this if the C compiler puts an underscore at the front
|
||||
of external names before giving them to the linker. */
|
||||
#define NAMES_HAVE_UNDERSCORE
|
||||
#endif /* !defined (TM_LINUX_H) */
|
|
@ -0,0 +1,45 @@
|
|||
/* Host support for i386.
|
||||
Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
/* I'm running gdb 3.4 under 386/ix 2.0.2, which is a derivative of AT&T's
|
||||
Sys V/386 3.2.
|
||||
|
||||
On some machines, gdb crashes when it's starting up while calling the
|
||||
vendor's termio tgetent() routine. It always works when run under
|
||||
itself (actually, under 3.2, it's not an infinitely recursive bug.)
|
||||
After some poking around, it appears that depending on the environment
|
||||
size, or whether you're running YP, or the phase of the moon or something,
|
||||
the stack is not always long-aligned when main() is called, and tgetent()
|
||||
takes strong offense at that. On some machines this bug never appears, but
|
||||
on those where it does, it occurs quite reliably. */
|
||||
#define ALIGN_STACK_ON_STARTUP
|
||||
|
||||
/* define USG if you are using sys5 /usr/include's */
|
||||
#define USG
|
||||
|
||||
#define HAVE_TERMIO
|
||||
|
||||
/* This is the amount to subtract from u.u_ar0
|
||||
to get the offset in the core file of the register values. */
|
||||
|
||||
#define KERNEL_U_ADDR 0xe0000000
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/* Native support for linux, for GDB, the GNU debugger.
|
||||
Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "xm-i386v.h"
|
||||
|
||||
/* This is the amount to subtract from u.u_ar0
|
||||
to get the offset in the core file of the register values. */
|
||||
#undef KERNEL_U_ADDR
|
||||
#define KERNEL_U_ADDR 0x0
|
||||
#define PSIGNAL_IN_SIGNAL_H
|
|
@ -135,17 +135,22 @@ void FreeProcInstance(FARPROC func)
|
|||
LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
|
||||
WORD wParam, LONG lParam )
|
||||
{
|
||||
if ((unsigned int)func & 0xffff0000)
|
||||
if (Is16bitAddress(func))
|
||||
{
|
||||
PushOn16( CALLBACK_SIZE_WORD, hwnd );
|
||||
PushOn16( CALLBACK_SIZE_WORD, message );
|
||||
PushOn16( CALLBACK_SIZE_WORD, wParam );
|
||||
PushOn16( CALLBACK_SIZE_LONG, lParam );
|
||||
|
||||
printf("%8.8x(%4.4x, %4.4x, %4.4x, %8.8x)\n", func, hwnd, message, wParam, lParam);
|
||||
|
||||
return CallTo16((unsigned int) func,
|
||||
FindDataSegmentForCode((unsigned long) func));
|
||||
}
|
||||
else
|
||||
return WIDGETS_Call32WndProc( func, hwnd, message, wParam, lParam );
|
||||
{
|
||||
return (*func)(hwnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
@ -153,9 +158,16 @@ LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message,
|
|||
*/
|
||||
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));
|
||||
if (Is16bitAddress(func))
|
||||
{
|
||||
PushOn16( CALLBACK_SIZE_WORD, xPos );
|
||||
PushOn16( CALLBACK_SIZE_WORD, yPos );
|
||||
PushOn16( CALLBACK_SIZE_LONG, lParam );
|
||||
CallTo16((unsigned int) func,
|
||||
FindDataSegmentForCode((unsigned long) func));
|
||||
}
|
||||
else
|
||||
{
|
||||
(*func)(xPos, yPos, lParam);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,19 @@ length 415
|
|||
50 pascal GetProcAddress(word ptr) GetProcAddress(1 2)
|
||||
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
|
||||
52 pascal FreeProcInstance(ptr) FreeProcInstance(1)
|
||||
59 pascal WriteProfileString(ptr ptr ptr) WriteProfileString(1 2 3)
|
||||
60 pascal FindResource(word ptr ptr) FindResource(1 2 3)
|
||||
61 pascal LoadResource(word word) LoadResource(1 2)
|
||||
62 pascal LockResource(word) LockResource(1)
|
||||
63 pascal FreeResource(word) FreeResource(1)
|
||||
74 pascal OpenFile(ptr ptr word) KERNEL_OpenFile(1 2 3)
|
||||
81 pascal _lclose(word) KERNEL__lclose(1)
|
||||
82 pascal _lread(word ptr word) KERNEL__lread(1 2 3)
|
||||
85 pascal _lopen(ptr word) KERNEL__lopen(1 2)
|
||||
86 pascal _lwrite(word ptr word) KERNEL__lwrite(1 2 3)
|
||||
88 pascal lstrcpy(ptr ptr) lstrcpy(1 2)
|
||||
89 pascal lstrcat(ptr ptr) lstrcat(1 2)
|
||||
90 pascal lstrlen(ptr) lstrcpy(1)
|
||||
91 register InitTask(word word word word word
|
||||
word word word word word)
|
||||
KERNEL_InitTask()
|
||||
|
@ -51,6 +59,8 @@ length 415
|
|||
GetPrivateProfileInt(1 2 3 4)
|
||||
128 pascal GetPrivateProfileString(ptr ptr ptr ptr s_word ptr)
|
||||
GetPrivateProfileString(1 2 3 4 5 6)
|
||||
129 pascal WritePrivateProfileString(ptr ptr ptr ptr)
|
||||
WritePrivateProfileString(1 2 3 4)
|
||||
131 pascal GetDOSEnvironment() GetDOSEnvironment()
|
||||
132 return GetWinFlags 0 0x413
|
||||
154 return GlobalNotify 4 0
|
||||
|
@ -66,3 +76,4 @@ length 415
|
|||
57 pascal GetProfileInt(ptr ptr word) GetProfileInt(1 2 3)
|
||||
58 pascal GetProfileString(ptr ptr ptr ptr word) GetProfileString(1 2 3 4 5)
|
||||
199 pascal SetHandleCount(word) SetHandleCount(1)
|
||||
353 pascal lstrcpyn(ptr ptr word) lstrcpyn(1 2 3)
|
||||
|
|
|
@ -107,11 +107,6 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
|
|||
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++)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: win87em.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
|
||||
# $Id: sound.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
|
||||
#
|
||||
name sound
|
||||
id 7
|
||||
|
|
|
@ -17,11 +17,14 @@ length 540
|
|||
19 pascal ReleaseCapture() ReleaseCapture()
|
||||
31 pascal IsIconic(word) IsIconic(1)
|
||||
33 pascal GetClientRect(word ptr) GetClientRect(1 2)
|
||||
36 pascal GetWindowText(word ptr word) GetWindowText(1 2 3)
|
||||
38 pascal GetWindowTextLength(word) GetWindowTextLength(1)
|
||||
39 pascal BeginPaint(word ptr) BeginPaint(1 2)
|
||||
40 pascal EndPaint(word ptr) EndPaint(1 2)
|
||||
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)
|
||||
46 pascal GetParent(word) GetParent(1)
|
||||
53 pascal DestroyWindow(word) DestroyWindow(1)
|
||||
57 pascal RegisterClass(ptr) RegisterClass(1)
|
||||
66 pascal GetDC(word) GetDC(1)
|
||||
|
@ -37,6 +40,7 @@ length 540
|
|||
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)
|
||||
83 pascal FrameRect(word ptr word) FrameRect(1 2 3)
|
||||
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)
|
||||
|
@ -60,6 +64,10 @@ length 540
|
|||
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)
|
||||
133 pascal GetWindowWord(word s_word) GetWindowWord(1 2)
|
||||
134 pascal SetWindowWord(word s_word word) SetWindowWord(1 2 3)
|
||||
135 pascal GetWindowLong(word s_word) GetWindowLong(1 2)
|
||||
136 pascal SetWindowLong(word s_word long) SetWindowLong(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)
|
||||
|
@ -69,12 +77,32 @@ length 540
|
|||
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)
|
||||
177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2)
|
||||
179 pascal GetSystemMetrics(word) GetSystemMetrics(1)
|
||||
180 pascal GetSysColor(word) GetSysColor(1)
|
||||
181 pascal SetSysColors(word ptr ptr) SetSysColors(1 2 3)
|
||||
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
|
||||
431 pascal AnsiUpper(ptr) AnsiUpper(1)
|
||||
432 pascal AnsiLower(ptr) AnsiLower(1)
|
||||
433 pascal IsCharAlpha(byte) IsCharAlpha(1)
|
||||
434 pascal IsCharAlphanumeric(byte) IsCharAlphanumeric(1)
|
||||
435 pascal IsCharUpper(byte) IsCharUpper(1)
|
||||
436 pascal IsCharLower(byte) IsCharLower(1)
|
||||
437 pascal AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2)
|
||||
438 pascal AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2)
|
||||
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
|
||||
472 pascal AnsiNext(ptr) AnsiNext(1 )
|
||||
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
|
||||
|
||||
|
||||
|
||||
|
||||
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)
|
||||
286 pascal GetDesktopWindow() GetDesktopWindow()
|
||||
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)
|
||||
|
@ -83,5 +111,4 @@ length 540
|
|||
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)
|
||||
177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2)
|
||||
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
|
||||
|
|
|
@ -17,7 +17,7 @@ typedef struct tagCLASS
|
|||
HCLASS hNext; /* Next class */
|
||||
WORD wMagic; /* Magic number (must be CLASS_MAGIC) */
|
||||
ATOM atomName; /* Name of the class */
|
||||
HANDLE hDCE; /* Class DC Entry (if CS_CLASSDC) */
|
||||
HDC hdc; /* Class DC (if CS_CLASSDC) */
|
||||
WORD cWindows; /* Count of existing windows of this class */
|
||||
WNDCLASS wc __attribute__ ((packed)); /* Class information */
|
||||
WORD wExtra[1]; /* Class extra bytes */
|
||||
|
|
|
@ -32,4 +32,11 @@ struct segment_descriptor_s
|
|||
#define GLOBAL_FLAGS_EXECUTEONLY 0x00020000
|
||||
#define GLOBAL_FLAGS_READONLY 0x00020000
|
||||
|
||||
#define FIRST_SELECTOR 8
|
||||
|
||||
static __inline__ int Is16bitAddress(void *address)
|
||||
{
|
||||
return ((int) address >= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
|
||||
}
|
||||
|
||||
#endif /* SEGMEM_H */
|
||||
|
|
|
@ -32,9 +32,11 @@ typedef struct tagWND
|
|||
HWND hwndLastActive; /* Last active popup hwnd */
|
||||
FARPROC lpfnWndProc; /* Window procedure */
|
||||
DWORD dwStyle; /* Window style (from CreateWindow) */
|
||||
HANDLE hDCE; /* Window DC Entry (if CS_OWNDC) */
|
||||
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
|
||||
HDC hdc; /* Window DC (if CS_OWNDC) */
|
||||
HMENU hmenuSystem; /* System menu */
|
||||
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
|
||||
HANDLE hText; /* Handle of window text */
|
||||
WORD flags; /* Misc. flags */
|
||||
Widget shellWidget; /* For top-level windows */
|
||||
Widget winWidget; /* For all windows */
|
||||
|
@ -47,10 +49,9 @@ typedef struct tagWND
|
|||
#define WIN_ERASE_UPDATERGN 1 /* Update region needs erasing */
|
||||
|
||||
|
||||
/* The caller must GlobalUnlock the pointer returned
|
||||
* by this function (except when NULL).
|
||||
*/
|
||||
/* Window functions */
|
||||
WND * WIN_FindWndPtr( HWND hwnd );
|
||||
HWND WIN_FindWinToRepaint( HWND hwnd );
|
||||
|
||||
|
||||
#endif /* WIN_H */
|
||||
|
|
|
@ -105,7 +105,7 @@ typedef struct {
|
|||
#define GCW_STYLE (-26)
|
||||
#define GCW_ATOM (-32)
|
||||
|
||||
|
||||
/* Windows */
|
||||
|
||||
typedef struct {
|
||||
void * lpCreateParams;
|
||||
|
@ -122,6 +122,17 @@ typedef struct {
|
|||
DWORD dwExStyle __attribute__ ((packed));
|
||||
} CREATESTRUCT, *LPCREATESTRUCT;
|
||||
|
||||
/* Offsets for GetWindowLong() and GetWindowWord() */
|
||||
#define GWL_EXSTYLE (-20)
|
||||
#define GWL_STYLE (-16)
|
||||
#define GWW_ID (-12)
|
||||
#define GWW_HWNDPARENT (-8)
|
||||
#define GWW_HINSTANCE (-6)
|
||||
#define GWL_WNDPROC (-4)
|
||||
#define DWL_MSGRESULT 0
|
||||
#define DWL_DLGPROC 4
|
||||
#define DWL_USER 8
|
||||
|
||||
|
||||
typedef struct { short x, y; } POINT;
|
||||
typedef POINT *PPOINT;
|
||||
|
@ -134,6 +145,7 @@ typedef struct
|
|||
short cy;
|
||||
} SIZE, *LPSIZE;
|
||||
|
||||
#define MAKEPOINT(l) (*((POINT *)&(l)))
|
||||
|
||||
typedef struct tagMSG
|
||||
{
|
||||
|
@ -1452,7 +1464,7 @@ Fc(void,InvalidateRgn,HWND,a,HRGN,b,BOOL,c)
|
|||
Fc(void,OemToAnsiBuff,LPSTR,a,LPSTR,b,int,c)
|
||||
Fc(void,OffsetRect,LPRECT,a,short,b,short,c)
|
||||
Fc(void,SetDlgItemText,HWND,a,int,b,LPSTR,c)
|
||||
Fc(void,SetSysColors,int,a,LPINT,b,LONG*,c)
|
||||
Fc(void,SetSysColors,int,a,LPINT,b,COLORREF*,c)
|
||||
Fc(void,ShowScrollBar,HWND,a,WORD,b,BOOL,c)
|
||||
Fc(void,SwitchStackTo,WORD,a,WORD,b,WORD,c)
|
||||
Fd(BOOL,AppendMenu,HMENU,a,WORD,b,WORD,c,LPSTR,d)
|
||||
|
|
|
@ -15,8 +15,12 @@ struct w_files{
|
|||
char * lookup_table;
|
||||
char * nrname_table;
|
||||
char * rname_table;
|
||||
unsigned short hinstance;
|
||||
};
|
||||
|
||||
extern struct w_files * wine_files;
|
||||
|
||||
extern char *GetFilenameFromInstance(unsigned short instance);
|
||||
extern struct w_files *GetFileInfo(unsigned short instance);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,12 +3,47 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include "prototypes.h"
|
||||
#include "neexe.h"
|
||||
#include "windows.h"
|
||||
#include "gdi.h"
|
||||
#include "wine.h"
|
||||
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static int ResourceFd = -1;
|
||||
static HANDLE ResourceInst = 0;
|
||||
static struct w_files *ResourceFileInfo = NULL;
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* OpenResourceFile
|
||||
*/
|
||||
int
|
||||
OpenResourceFile(HANDLE instance)
|
||||
{
|
||||
struct w_files *w;
|
||||
|
||||
if (ResourceInst == instance)
|
||||
return ResourceFd;
|
||||
|
||||
w = GetFileInfo(instance);
|
||||
if (w == NULL)
|
||||
return -1;
|
||||
|
||||
if (ResourceFd >= 0)
|
||||
close(ResourceFd);
|
||||
|
||||
ResourceInst = instance;
|
||||
ResourceFileInfo = w;
|
||||
ResourceFd = open(w->filename, O_RDONLY);
|
||||
|
||||
return ResourceFd;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* ConvertCoreBitmap
|
||||
|
@ -88,17 +123,19 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
|||
struct resource_nameinfo_s nameinfo;
|
||||
unsigned short size_shift;
|
||||
int i;
|
||||
off_t rtoff;
|
||||
|
||||
/*
|
||||
* Move to beginning of resource table.
|
||||
*/
|
||||
lseek(CurrentNEFile, (CurrentMZHeader->ne_offset +
|
||||
CurrentNEHeader->resource_tab_offset), SEEK_SET);
|
||||
rtoff = (ResourceFileInfo->mz_header->ne_offset +
|
||||
ResourceFileInfo->ne_header->resource_tab_offset);
|
||||
lseek(ResourceFd, rtoff, SEEK_SET);
|
||||
|
||||
/*
|
||||
* Read block size.
|
||||
*/
|
||||
if (read(CurrentNEFile, &size_shift, sizeof(size_shift)) !=
|
||||
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
||||
sizeof(size_shift))
|
||||
{
|
||||
return -1;
|
||||
|
@ -110,7 +147,7 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
|||
typeinfo.type_id = 0xffff;
|
||||
while (typeinfo.type_id != 0)
|
||||
{
|
||||
if (read(CurrentNEFile, &typeinfo, sizeof(typeinfo)) !=
|
||||
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
||||
sizeof(typeinfo))
|
||||
{
|
||||
return -1;
|
||||
|
@ -119,7 +156,7 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
|||
{
|
||||
for (i = 0; i < typeinfo.count; i++)
|
||||
{
|
||||
if (read(CurrentNEFile, &nameinfo, sizeof(nameinfo)) !=
|
||||
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
||||
sizeof(nameinfo))
|
||||
{
|
||||
return -1;
|
||||
|
@ -159,17 +196,19 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
unsigned char nbytes;
|
||||
char name[256];
|
||||
int i;
|
||||
off_t rtoff;
|
||||
|
||||
/*
|
||||
* Move to beginning of resource table.
|
||||
*/
|
||||
lseek(CurrentNEFile, (CurrentMZHeader->ne_offset +
|
||||
CurrentNEHeader->resource_tab_offset), SEEK_SET);
|
||||
rtoff = (ResourceFileInfo->mz_header->ne_offset +
|
||||
ResourceFileInfo->ne_header->resource_tab_offset);
|
||||
lseek(ResourceFd, rtoff, SEEK_SET);
|
||||
|
||||
/*
|
||||
* Read block size.
|
||||
*/
|
||||
if (read(CurrentNEFile, &size_shift, sizeof(size_shift)) !=
|
||||
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
||||
sizeof(size_shift))
|
||||
{
|
||||
return -1;
|
||||
|
@ -181,7 +220,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
typeinfo.type_id = 0xffff;
|
||||
while (typeinfo.type_id != 0)
|
||||
{
|
||||
if (read(CurrentNEFile, &typeinfo, sizeof(typeinfo)) !=
|
||||
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
||||
sizeof(typeinfo))
|
||||
{
|
||||
return -1;
|
||||
|
@ -190,7 +229,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
{
|
||||
for (i = 0; i < typeinfo.count; i++)
|
||||
{
|
||||
if (read(CurrentNEFile, &nameinfo, sizeof(nameinfo)) !=
|
||||
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
||||
sizeof(nameinfo))
|
||||
{
|
||||
return -1;
|
||||
|
@ -199,14 +238,12 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
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);
|
||||
old_pos = lseek(ResourceFd, 0, SEEK_CUR);
|
||||
new_pos = rtoff + nameinfo.id;
|
||||
lseek(ResourceFd, new_pos, SEEK_SET);
|
||||
read(ResourceFd, &nbytes, 1);
|
||||
read(ResourceFd, name, nbytes);
|
||||
lseek(ResourceFd, old_pos, SEEK_SET);
|
||||
name[nbytes] = '\0';
|
||||
|
||||
if (strcasecmp(name, resource_name) == 0)
|
||||
|
@ -221,53 +258,6 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
|||
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
|
||||
*/
|
||||
|
@ -297,6 +287,43 @@ LoadAccelerators(HANDLE instance, LPSTR lpTableName)
|
|||
fprintf(stderr,"LoadAccelerators: (%d),%d\n",instance,lpTableName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* FindResource [KERNEL.60]
|
||||
*/
|
||||
HANDLE FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name)
|
||||
{
|
||||
fprintf(stderr,"FindResource: (%d),%d\n",instance, resource_name, type_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* LoadResource [KERNEL.61]
|
||||
*/
|
||||
HANDLE LoadResource(HANDLE instance, HANDLE hResInfo)
|
||||
{
|
||||
fprintf(stderr,"LoadResource: (%d),%d\n",instance, hResInfo);
|
||||
return ;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* LockResource [KERNEL.62]
|
||||
*/
|
||||
LPSTR LockResource(HANDLE hResData)
|
||||
{
|
||||
fprintf(stderr,"LockResource: %d\n", hResData);
|
||||
return ;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* FreeResource [KERNEL.63]
|
||||
*/
|
||||
BOOL FreeResource(HANDLE hResData)
|
||||
{
|
||||
fprintf(stderr,"FreeResource: %d\n", hResData);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* RSC_LoadResource
|
||||
|
@ -317,10 +344,13 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
else if (OpenResourceFile(instance) < 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Get resource by ordinal
|
||||
*/
|
||||
else if (((int) rsc_name & 0xffff0000) == 0)
|
||||
if (((int) rsc_name & 0xffff0000) == 0)
|
||||
{
|
||||
size_shift = FindResourceByNumber(&nameinfo, type,
|
||||
(int) rsc_name | 0x8000);
|
||||
|
@ -338,7 +368,7 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
|||
/*
|
||||
* Read resource.
|
||||
*/
|
||||
lseek(CurrentNEFile, ((int) nameinfo.offset << size_shift), SEEK_SET);
|
||||
lseek(ResourceFd, ((int) nameinfo.offset << size_shift), SEEK_SET);
|
||||
|
||||
image_size = nameinfo.length << size_shift;
|
||||
if (image_size_ret != NULL)
|
||||
|
@ -346,7 +376,7 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
|||
|
||||
hmem = GlobalAlloc(GMEM_MOVEABLE, image_size);
|
||||
image = GlobalLock(hmem);
|
||||
if (image == NULL || read(CurrentNEFile, image, image_size) != image_size)
|
||||
if (image == NULL || read(ResourceFd, image, image_size) != image_size)
|
||||
{
|
||||
GlobalFree(hmem);
|
||||
return 0;
|
||||
|
@ -356,6 +386,46 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
|||
return hmem;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* LoadString
|
||||
*/
|
||||
int
|
||||
LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
|
||||
{
|
||||
HANDLE hmem;
|
||||
int rsc_size;
|
||||
unsigned char *p;
|
||||
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
|
||||
|
||||
hmem = RSC_LoadResource(instance, (char *) (resource_id >> 4),
|
||||
NE_RSCTYPE_STRING, &rsc_size);
|
||||
if (hmem == 0)
|
||||
return 0;
|
||||
|
||||
p = GlobalLock(hmem);
|
||||
string_num = resource_id & 0x000f;
|
||||
for (i = 0; i < resource_id; i++)
|
||||
p += *p;
|
||||
|
||||
i = MIN(buflen - 1, *p);
|
||||
memcpy(buffer, p + 1, i);
|
||||
buffer[i] = '\0';
|
||||
|
||||
GlobalFree(hmem);
|
||||
|
||||
#ifdef DEBUG_RESOURCE
|
||||
printf(" '%s'\n", buffer);
|
||||
#endif
|
||||
return i;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* RSC_LoadMenu
|
||||
*/
|
||||
|
@ -403,3 +473,5 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
|
|||
ReleaseDC( 0, hdc );
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ unsigned short PSPSelector;
|
|||
unsigned char ran_out = 0;
|
||||
unsigned short SelectorOwners[MAX_SELECTORS];
|
||||
|
||||
static int next_unused_selector = 8;
|
||||
static int next_unused_selector = FIRST_SELECTOR;
|
||||
extern void KERNEL_Ordinal_102();
|
||||
extern void UNIXLIB_Ordinal_0();
|
||||
|
||||
|
|
150
loader/signal.c
|
@ -6,9 +6,15 @@
|
|||
#include <syscall.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#ifdef linux
|
||||
#include <linux/sched.h>
|
||||
#include <asm/system.h>
|
||||
#endif
|
||||
|
||||
char * cstack[4096];
|
||||
struct sigaction segv_act;
|
||||
|
||||
#ifdef linux
|
||||
extern void ___sig_restore();
|
||||
extern void ___masksig_restore();
|
||||
|
||||
|
@ -26,33 +32,36 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
|
|||
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 short sc_gs, __gsh;
|
||||
unsigned short sc_fs, __fsh;
|
||||
unsigned short sc_es, __esh;
|
||||
unsigned short sc_ds, __dsh;
|
||||
unsigned long sc_edi;
|
||||
unsigned long sc_esi;
|
||||
unsigned long sc_ebp;
|
||||
unsigned long sc_esp;
|
||||
unsigned long sc_ebx;
|
||||
unsigned long sc_edx;
|
||||
unsigned long sc_ecx;
|
||||
unsigned long sc_eax;
|
||||
unsigned long sc_trapno;
|
||||
unsigned long sc_err;
|
||||
unsigned long sc_eip;
|
||||
unsigned short sc_cs, __csh;
|
||||
unsigned long sc_eflags;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned short ss, __ssh;
|
||||
unsigned short sc_ss, __ssh;
|
||||
unsigned long i387;
|
||||
unsigned long oldmask;
|
||||
unsigned long cr2;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define sigcontext_struct sigcontext
|
||||
#define HZ 100
|
||||
#endif
|
||||
|
||||
static void
|
||||
GetTimeDate(int time_flag, struct sigcontext_struct * context)
|
||||
|
@ -64,15 +73,15 @@ GetTimeDate(int time_flag, struct sigcontext_struct * context)
|
|||
now = localtime(<ime);
|
||||
if (time_flag)
|
||||
{
|
||||
context->ecx = (now->tm_hour << 8) | now->tm_min;
|
||||
context->edx = now->tm_sec << 8;
|
||||
context->sc_ecx = (now->tm_hour << 8) | now->tm_min;
|
||||
context->sc_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;
|
||||
context->sc_ecx = now->tm_year + 1900;
|
||||
context->sc_edx = ((now->tm_mon + 1) << 8) | now->tm_mday;
|
||||
context->sc_eax &= 0xff00;
|
||||
context->sc_eax |= now->tm_wday;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,12 +91,12 @@ GetTimeDate(int time_flag, struct sigcontext_struct * context)
|
|||
|
||||
static int
|
||||
do_int21(struct sigcontext_struct * context){
|
||||
fprintf(stderr,"Doing int21 %x ", (context->eax >> 8) & 0xff);
|
||||
switch((context->eax >> 8) & 0xff){
|
||||
fprintf(stderr,"Doing int21 %x ", (context->sc_eax >> 8) & 0xff);
|
||||
switch((context->sc_eax >> 8) & 0xff){
|
||||
case 0x30:
|
||||
context->eax = 0x0303; /* Hey folks, this is DOS V3.3! */
|
||||
context->ebx = 0;
|
||||
context->ecx = 0;
|
||||
context->sc_eax = 0x0303; /* Hey folks, this is DOS V3.3! */
|
||||
context->sc_ebx = 0;
|
||||
context->sc_ecx = 0;
|
||||
break;
|
||||
|
||||
/* Ignore any attempt to set a segment vector */
|
||||
|
@ -96,8 +105,8 @@ do_int21(struct sigcontext_struct * context){
|
|||
|
||||
case 0x35: /* Return a NULL segment selector - this will bomb
|
||||
if anyone ever tries to use it */
|
||||
context->es = 0;
|
||||
context->ebx = 0;
|
||||
context->sc_es = 0;
|
||||
context->sc_ebx = 0;
|
||||
break;
|
||||
|
||||
case 0x2a:
|
||||
|
@ -109,11 +118,11 @@ do_int21(struct sigcontext_struct * context){
|
|||
/* Function does not return */
|
||||
|
||||
case 0x4c:
|
||||
exit(context->eax & 0xff);
|
||||
exit(context->sc_eax & 0xff);
|
||||
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unable to handle int 0x21 %x\n", context->eax);
|
||||
fprintf(stderr,"Unable to handle int 0x21 %x\n", context->sc_eax);
|
||||
return 1;
|
||||
};
|
||||
return 1;
|
||||
|
@ -124,41 +133,53 @@ do_int1A(struct sigcontext_struct * context){
|
|||
time_t ltime;
|
||||
int ticks;
|
||||
|
||||
switch((context->eax >> 8) & 0xff){
|
||||
switch((context->sc_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 */
|
||||
context->sc_ecx = ticks >> 16;
|
||||
context->sc_edx = ticks & 0x0000FFFF;
|
||||
context->sc_eax = 0; /* No midnight rollover */
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Unable to handle int 0x1A %x\n", context->eax);
|
||||
fprintf(stderr,"Unable to handle int 0x1A %x\n", context->sc_eax);
|
||||
return 1;
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void win_segfault(int signal, struct sigcontext_struct context){
|
||||
#ifdef linux
|
||||
static void win_fault(int signal, struct sigcontext_struct context){
|
||||
struct sigcontext_struct *scp = &context;
|
||||
#else
|
||||
static void win_fault(int signal, int code, struct sigcontext *scp){
|
||||
#endif
|
||||
unsigned char * instr;
|
||||
unsigned char intno;
|
||||
unsigned int * dump;
|
||||
int i;
|
||||
|
||||
/* First take care of a few preliminaries */
|
||||
#ifdef linux
|
||||
if(signal != SIGSEGV) exit(1);
|
||||
if((context.cs & 7) != 7){
|
||||
if((scp->sc_cs & 7) != 7){
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
/* set_es(0x27); set_ds(0x27); */
|
||||
if(signal != SIGBUS) exit(1);
|
||||
if(scp->sc_cs == 0x1f){
|
||||
#endif
|
||||
fprintf(stderr,
|
||||
"Segmentation fault in Wine program (%x:%x)."
|
||||
" Please debug\n",
|
||||
context.cs, context.eip);
|
||||
scp->sc_cs, scp->sc_eip);
|
||||
goto oops;
|
||||
};
|
||||
|
||||
/* Now take a look at the actual instruction where the program
|
||||
bombed */
|
||||
instr = (char *) ((context.cs << 16) | (context.eip & 0xffff));
|
||||
instr = (char *) ((scp->sc_cs << 16) | (scp->sc_eip & 0xffff));
|
||||
|
||||
if(*instr != 0xcd) {
|
||||
fprintf(stderr,
|
||||
|
@ -175,10 +196,10 @@ static void win_segfault(int signal, struct sigcontext_struct context){
|
|||
intno = *instr;
|
||||
switch(intno){
|
||||
case 0x21:
|
||||
if(!do_int21(&context)) goto oops;
|
||||
if(!do_int21(scp)) goto oops;
|
||||
break;
|
||||
case 0x1A:
|
||||
if(!do_int1A(&context)) goto oops;
|
||||
if(!do_int1A(scp)) goto oops;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,"Unexpected Windows interrupt %x\n", intno);
|
||||
|
@ -187,13 +208,16 @@ static void win_segfault(int signal, struct sigcontext_struct context){
|
|||
|
||||
/* OK, done handling the interrupt */
|
||||
|
||||
context.eip += 2; /* Bypass the int instruction */
|
||||
scp->sc_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;
|
||||
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
|
||||
#ifdef linux
|
||||
wine_debug(scp); /* Enter our debugger */
|
||||
#else
|
||||
fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp);
|
||||
dump = (int*) scp;
|
||||
for(i=0; i<22; i++)
|
||||
{
|
||||
fprintf(stderr," %8.8x", *dump++);
|
||||
|
@ -202,15 +226,37 @@ static void win_segfault(int signal, struct sigcontext_struct context){
|
|||
}
|
||||
fprintf(stderr,"\n");
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
init_wine_signals(){
|
||||
segv_act.sa_handler = (__sighandler_t) win_segfault;
|
||||
#ifdef linux
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
/* 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);
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
struct sigstack ss;
|
||||
sigset_t sig_mask;
|
||||
|
||||
ss.ss_sp = (char *) (((unsigned int)(cstack + sizeof(cstack) - 4)) & ~3);
|
||||
ss.ss_onstack = 0;
|
||||
if (sigstack(&ss, NULL) < 0) {
|
||||
perror("sigstack");
|
||||
exit(1);
|
||||
}
|
||||
sigemptyset(&sig_mask);
|
||||
segv_act.sa_handler = (__sighandler_t) win_fault;
|
||||
segv_act.sa_flags = SA_ONSTACK;
|
||||
segv_act.sa_mask = sig_mask;
|
||||
if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
|
||||
perror("sigaction");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,38 @@ myerror(const char *s)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetFilenameFromInstance
|
||||
*/
|
||||
char *
|
||||
GetFilenameFromInstance(unsigned short instance)
|
||||
{
|
||||
register struct w_files *w = wine_files;
|
||||
|
||||
/* Load one NE format executable into memory */
|
||||
while (w && w->hinstance != instance)
|
||||
w = w->next;
|
||||
|
||||
if (w)
|
||||
return w->filename;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct w_files *
|
||||
GetFileInfo(unsigned short instance)
|
||||
{
|
||||
register struct w_files *w = wine_files;
|
||||
|
||||
while (w && w->hinstance != instance)
|
||||
w = w->next;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* LoadImage
|
||||
* Load one NE format executable into memory
|
||||
*/
|
||||
LoadImage(char * filename, char * modulename)
|
||||
{
|
||||
unsigned int read_size;
|
||||
|
@ -143,6 +173,9 @@ LoadImage(char * filename, char * modulename)
|
|||
if (read(wpnt->fd, wpnt->seg_table, read_size) != read_size)
|
||||
myerror("Unable to read segment table header from file");
|
||||
wpnt->selector_table = CreateSelectors(wpnt);
|
||||
wpnt->hinstance
|
||||
= wpnt->
|
||||
selector_table[wine_files->ne_header->auto_data_seg-1].selector;
|
||||
|
||||
/* Get the lookup table. This is used for looking up the addresses
|
||||
of functions that are exported */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||
|
||||
OBJS=dos.o kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
|
||||
keyboard.o profile.o
|
||||
keyboard.o profile.o lstr.o
|
||||
|
||||
default: misc.o
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define OPEN_MAX 256
|
||||
|
||||
/***************************************************************************
|
||||
This structure stores the infomation needed for a single DOS drive
|
||||
***************************************************************************/
|
||||
|
|
|
@ -11,6 +11,8 @@ int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef BOGUS_ANSI_OEM
|
||||
|
||||
int AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr)
|
||||
{
|
||||
printf("AnsiToOem (%s)\n",lpAnsiStr);
|
||||
|
@ -25,6 +27,8 @@ BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DWORD OemKeyScan(WORD wOemChar)
|
||||
{
|
||||
printf("*OemKeyScan (%d)\n",wOemChar);
|
||||
|
@ -84,6 +88,8 @@ int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BOGUS_ANSI_OEM
|
||||
|
||||
void AnsiToOemBuff(LPSTR lpAnsiStr, LPSTR lpOemStr, int nLength)
|
||||
{
|
||||
printf("AnsiToOemBuff(%s,<ptr>,%d)\n",lpAnsiStr,nLength);
|
||||
|
@ -96,6 +102,7 @@ void OemToAnsiBuff(LPSTR lpOemStr, LPSTR lpAnsiStr, int nLength)
|
|||
strncpy(lpAnsiStr,lpOemStr,nLength); /* should translate... */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,213 @@
|
|||
static char Copyright[] = "Copyright Yngvi Sigurjonsson (yngvi@hafro.is), 1993";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "regfunc.h"
|
||||
#include "windows.h"
|
||||
|
||||
|
||||
#define LPCSTR LPSTR /* I think this should be const char **/
|
||||
typedef unsigned short UINT;
|
||||
|
||||
/* Funny to divide them between user and kernel. */
|
||||
|
||||
/* KERNEL.89 */
|
||||
LPSTR lstrcat(LPSTR target,LPCSTR source)
|
||||
{
|
||||
fprintf(stderr,"lstrcat(%s,%s)\n",target,source);
|
||||
return strcat(target,source);
|
||||
}
|
||||
|
||||
/* USER.430 */
|
||||
int lstrcmp(LPCSTR str1,LPCSTR str2)
|
||||
{
|
||||
return strcmp(str1,str2);
|
||||
}
|
||||
|
||||
/* USER.471 */
|
||||
int lstrcmpi(LPCSTR str1,LPCSTR str2)
|
||||
{
|
||||
int i;
|
||||
i=0;
|
||||
while((toupper(str1[i])==toupper(str2[i]))&&(str1[i]!=0))
|
||||
i++;
|
||||
return toupper(str1[i])-toupper(str2[i]);
|
||||
}
|
||||
|
||||
/* KERNEL.88 */
|
||||
LPSTR lstrcpy(LPSTR target,LPCSTR source)
|
||||
{
|
||||
return strcpy(target,source);
|
||||
}
|
||||
|
||||
/* KERNEL.353 */
|
||||
LPSTR lstrcpyn(LPSTR target,LPCSTR source,int n)
|
||||
{
|
||||
return strncpy(target,source,n);
|
||||
}
|
||||
|
||||
/* KERNEL.90 */
|
||||
int lstrlen(LPCSTR str)
|
||||
{
|
||||
strlen(str);
|
||||
}
|
||||
|
||||
/* AnsiUpper USER.431 */
|
||||
char FAR* AnsiUpper(char FAR* strOrChar)
|
||||
{
|
||||
/* I am not sure if the locale stuff works with toupper, but then again
|
||||
I am not sure if the Linux libc locale stuffs works at all */
|
||||
if((int)strOrChar<256)
|
||||
return (char FAR*) toupper((int)strOrChar);
|
||||
else {
|
||||
int i;
|
||||
for(i=0;(i<65536)&&strOrChar[i];i++)
|
||||
strOrChar[i]=toupper(strOrChar[i]);
|
||||
return strOrChar;
|
||||
}
|
||||
}
|
||||
|
||||
/* AnsiLower USER.432 */
|
||||
char FAR* AnsiLower(char FAR* strOrChar)
|
||||
{
|
||||
/* I am not sure if the locale stuff works with tolower, but then again
|
||||
I am not sure if the Linux libc locale stuffs works at all */
|
||||
if((int)strOrChar<256)
|
||||
return (char FAR*)tolower((int)strOrChar);
|
||||
else {
|
||||
int i;
|
||||
for(i=0;(i<65536)&&strOrChar[i];i++)
|
||||
strOrChar[i]=tolower(strOrChar[i]);
|
||||
return strOrChar;
|
||||
}
|
||||
}
|
||||
|
||||
/* AnsiUpperBuff USER.437 */
|
||||
UINT AnsiUpperBuff(LPSTR str,UINT len)
|
||||
{
|
||||
int i;
|
||||
len=(len==0)?65536:len;
|
||||
|
||||
for(i=0;i<len;i++)
|
||||
str[i]=toupper(str[i]);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* AnsiLowerBuff USER.438 */
|
||||
UINT AnsiLowerBuff(LPSTR str,UINT len)
|
||||
{
|
||||
int i;
|
||||
len=(len==0)?65536:len;
|
||||
i=0;
|
||||
|
||||
for(i=0;i<len;i++)
|
||||
str[i]=tolower(str[i]);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/* AnsiNext USER.472 */
|
||||
LPSTR AnsiNext(LPCSTR current)
|
||||
{
|
||||
return (*current)?current+1:current;
|
||||
}
|
||||
|
||||
/* AnsiPrev USER.473 */
|
||||
char FAR* AnsiPrev(/*const*/ char FAR* start,char FAR* current)
|
||||
{
|
||||
return (current==start)?start:current-1;
|
||||
}
|
||||
|
||||
/* IsCharAlpha USER 433 */
|
||||
BOOL IsCharAlpha(char ch)
|
||||
{
|
||||
return isalpha(ch); /* This is probably not right for NLS */
|
||||
}
|
||||
/* IsCharAlphanumeric USER 434 */
|
||||
BOOL IsCharAlphanumeric(char ch)
|
||||
{
|
||||
return (ch<'0')?0:(ch<'9');
|
||||
}
|
||||
|
||||
/* IsCharUpper USER 435 */
|
||||
BOOL IsCharUpper(char ch)
|
||||
{
|
||||
return isupper(ch);
|
||||
}
|
||||
|
||||
/* IsCharUpper USER 436 */
|
||||
BOOL IsCharLower(char ch)
|
||||
{
|
||||
return islower(ch);
|
||||
}
|
||||
|
||||
static char Oem2Ansi[256];
|
||||
static char Ansi2Oem[256];
|
||||
|
||||
void InitOemAnsiTranslations()
|
||||
{
|
||||
static int inited=0; /* should called called in some init function*/
|
||||
int transfile,i;
|
||||
if(inited) return;
|
||||
if(transfile=open("oem2ansi.trl",O_RDONLY)){
|
||||
read(transfile,Oem2Ansi,256);
|
||||
close(transfile);
|
||||
}
|
||||
else { /* sets up passive translations if it does not find the file */
|
||||
for(i=0;i<256;i++) /* Needs some fixing */
|
||||
Oem2Ansi[i]=i;
|
||||
}
|
||||
if(transfile=open("ansi2oem.trl",O_RDONLY)){
|
||||
read(transfile,Ansi2Oem,256);
|
||||
close(transfile);
|
||||
}
|
||||
else { /* sets up passive translations if it does not find the file */
|
||||
for(i=0;i<256;i++) /* Needs some fixing */
|
||||
Ansi2Oem[i]=i;
|
||||
}
|
||||
inited=1;
|
||||
}
|
||||
|
||||
/* AnsiToOem Keyboard.5 */
|
||||
int AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr) /* why is this int ??? */
|
||||
{
|
||||
InitOemAnsiTranslations(); /* should called called in some init function*/
|
||||
while(*lpAnsiStr){
|
||||
*lpOemStr++=Ansi2Oem[*lpAnsiStr++];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* OemToAnsi Keyboard.6 */
|
||||
BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr) /* why is this BOOL ???? */
|
||||
{
|
||||
InitOemAnsiTranslations(); /* should called called in some init function*/
|
||||
while(*lpOemStr){
|
||||
*lpAnsiStr++=Oem2Ansi[*lpOemStr++];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* AnsiToOemBuff Keyboard.134 */
|
||||
void AnsiToOemBuff(LPSTR lpAnsiStr, LPSTR lpOemStr, int nLength)
|
||||
{
|
||||
int i;
|
||||
InitOemAnsiTranslations(); /* should called called in some init function*/
|
||||
for(i=0;i<nLength;i++)
|
||||
lpOemStr[i]=Ansi2Oem[lpAnsiStr[i]];
|
||||
}
|
||||
|
||||
/* OemToAnsi Keyboard.135 */
|
||||
void OemToAnsiBuff(LPSTR lpOemStr, LPSTR lpAnsiStr, int nLength)
|
||||
{
|
||||
int i;
|
||||
InitOemAnsiTranslations(); /* should called called in some init function*/
|
||||
for(i=0;i<nLength;i++)
|
||||
lpAnsiStr[i]=Oem2Ansi[lpOemStr[i]];
|
||||
}
|
332
misc/profile.c
|
@ -1,40 +1,322 @@
|
|||
static char RCSId[] = "$Id: profile.c,v 1.1 1993/09/13 16:42:32 scott Exp $";
|
||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||
/*
|
||||
* Initialization-File Functions.
|
||||
*
|
||||
* Copyright (c) 1993 Miguel de Icaza
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prototypes.h"
|
||||
static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "windows.h"
|
||||
|
||||
#define INIFILE "win.ini"
|
||||
#define STRSIZE 255
|
||||
#define xmalloc(x) malloc(x)
|
||||
#define overflow (next == &CharBuffer [STRSIZE-1])
|
||||
|
||||
WORD GetPrivateProfileInt( LPSTR section, LPSTR entry,
|
||||
short defval, LPSTR filename )
|
||||
enum { FirstBrace, OnSecHeader, IgnoreToEOL, KeyDef, KeyValue };
|
||||
|
||||
typedef struct TKeys {
|
||||
char *KeyName;
|
||||
char *Value;
|
||||
struct TKeys *link;
|
||||
} TKeys;
|
||||
|
||||
typedef struct TSecHeader {
|
||||
char *AppName;
|
||||
TKeys *Keys;
|
||||
struct TSecHeader *link;
|
||||
} TSecHeader;
|
||||
|
||||
typedef struct TProfile {
|
||||
char *FileName;
|
||||
TSecHeader *Section;
|
||||
struct TProfile *link;
|
||||
} TProfile;
|
||||
|
||||
TProfile *Current = 0;
|
||||
TProfile *Base = 0;
|
||||
|
||||
static TSecHeader *is_loaded (char *FileName)
|
||||
{
|
||||
printf( "GetPrivateProfileInt: %s %s %d %s\n", section, entry, defval, filename );
|
||||
return defval;
|
||||
TProfile *p = Base;
|
||||
|
||||
while (p){
|
||||
if (!strcasecmp (FileName, p->FileName)){
|
||||
Current = p;
|
||||
return p->Section;
|
||||
}
|
||||
p = p->link;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
short GetPrivateProfileString( LPSTR section, LPSTR entry, LPSTR defval,
|
||||
LPSTR buffer, short count, LPSTR filename )
|
||||
static TSecHeader *load (char *file)
|
||||
{
|
||||
printf( "GetPrivateProfileString: %s %s %s %d %s\n", section, entry, defval, count, filename );
|
||||
strncpy( buffer, defval, count );
|
||||
buffer[count-1] = 0;
|
||||
return strlen(buffer);
|
||||
FILE *f;
|
||||
int state;
|
||||
TSecHeader *SecHeader = 0;
|
||||
char CharBuffer [STRSIZE];
|
||||
char *next;
|
||||
char c;
|
||||
|
||||
if ((f = fopen (file, "r"))==NULL)
|
||||
return NULL;
|
||||
|
||||
state = FirstBrace;
|
||||
while ((c = getc (f)) != EOF){
|
||||
if (c == '\r') /* Ignore Carriage Return */
|
||||
continue;
|
||||
|
||||
switch (state){
|
||||
|
||||
case OnSecHeader:
|
||||
if (c == ']' || overflow){
|
||||
*next = '\0';
|
||||
next = CharBuffer;
|
||||
SecHeader->AppName = strdup (CharBuffer);
|
||||
state = IgnoreToEOL;
|
||||
} else
|
||||
*next++ = c;
|
||||
break;
|
||||
|
||||
case IgnoreToEOL:
|
||||
if (c == '\n'){
|
||||
state = KeyDef;
|
||||
next = CharBuffer;
|
||||
}
|
||||
break;
|
||||
|
||||
case FirstBrace:
|
||||
case KeyDef:
|
||||
if (c == '['){
|
||||
TSecHeader *temp;
|
||||
|
||||
temp = SecHeader;
|
||||
SecHeader = (TSecHeader *) xmalloc (sizeof (TSecHeader));
|
||||
SecHeader->link = temp;
|
||||
SecHeader->Keys = 0;
|
||||
state = OnSecHeader;
|
||||
next = CharBuffer;
|
||||
break;
|
||||
}
|
||||
if (state == FirstBrace) /* On first pass, don't allow dangling keys */
|
||||
break;
|
||||
|
||||
if (c == ' ' || c == '\t')
|
||||
break;
|
||||
|
||||
if (c == '\n' || overflow) /* Abort Definition */
|
||||
next = CharBuffer;
|
||||
|
||||
if (c == '=' || overflow){
|
||||
TKeys *temp;
|
||||
|
||||
temp = SecHeader->Keys;
|
||||
*next = '\0';
|
||||
SecHeader->Keys = (TKeys *) xmalloc (sizeof (TKeys));
|
||||
SecHeader->Keys->link = temp;
|
||||
SecHeader->Keys->KeyName = strdup (CharBuffer);
|
||||
state = KeyValue;
|
||||
next = CharBuffer;
|
||||
} else
|
||||
*next++ = c;
|
||||
break;
|
||||
|
||||
case KeyValue:
|
||||
if (overflow || c == '\n'){
|
||||
*next = '\0';
|
||||
SecHeader->Keys->Value = strdup (CharBuffer);
|
||||
state = c == '\n' ? KeyDef : IgnoreToEOL;
|
||||
next = CharBuffer;
|
||||
#ifdef DEBUG
|
||||
printf ("[%s] (%s)=%s\n", SecHeader->AppName,
|
||||
SecHeader->Keys->KeyName, SecHeader->Keys->Value);
|
||||
#endif
|
||||
} else
|
||||
*next++ = c;
|
||||
break;
|
||||
|
||||
} /* switch */
|
||||
|
||||
} /* while ((c = getc (f)) != EOF) */
|
||||
return SecHeader;
|
||||
}
|
||||
|
||||
|
||||
WORD GetProfileInt( LPSTR lpAppName, LPSTR lpKeyName, int nDefault)
|
||||
static new_key (TSecHeader *section, char *KeyName, char *Value)
|
||||
{
|
||||
printf("GetProfileInt: %s %s %d\n",lpAppName,lpKeyName,nDefault);
|
||||
return nDefault;
|
||||
TKeys *key;
|
||||
|
||||
key = (TKeys *) xmalloc (sizeof (TKeys));
|
||||
key->KeyName = strdup (KeyName);
|
||||
key->Value = strdup (Value);
|
||||
key->link = section->Keys;
|
||||
section->Keys = key;
|
||||
}
|
||||
|
||||
int GetProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault,
|
||||
LPSTR lpReturnedString, int nSize)
|
||||
{
|
||||
printf( "GetProfileString: %s %s %s %d \n", lpAppName,lpKeyName,
|
||||
lpDefault, nSize );
|
||||
strncpy( lpReturnedString,lpDefault,nSize );
|
||||
lpReturnedString[nSize-1] = 0;
|
||||
return strlen(lpReturnedString);
|
||||
static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
|
||||
LPSTR Default, LPSTR ReturnedString, short Size,
|
||||
LPSTR FileName)
|
||||
|
||||
{
|
||||
TProfile *New;
|
||||
TSecHeader *section;
|
||||
TKeys *key;
|
||||
|
||||
if (!(section = is_loaded (FileName))){
|
||||
New = (TProfile *) xmalloc (sizeof (TProfile));
|
||||
New->link = Base;
|
||||
New->FileName = strdup (FileName);
|
||||
New->Section = load (FileName);
|
||||
Base = New;
|
||||
section = New->Section;
|
||||
Current = New;
|
||||
}
|
||||
|
||||
/* Start search */
|
||||
for (; section; section = section->link){
|
||||
if (strcasecmp (section->AppName, AppName))
|
||||
continue;
|
||||
for (key = section->Keys; key; key = key->link){
|
||||
if (strcasecmp (key->KeyName, KeyName))
|
||||
continue;
|
||||
if (set){
|
||||
free (key->Value);
|
||||
key->Value = strdup (Default);
|
||||
return 1;
|
||||
}
|
||||
ReturnedString [Size-1] = 0;
|
||||
strncpy (ReturnedString, key->Value, Size-1);
|
||||
return 1;
|
||||
}
|
||||
/* If Getting the information, then don't write the information
|
||||
to the INI file, need to run a couple of tests with windog */
|
||||
/* No key found */
|
||||
if (set)
|
||||
new_key (section, KeyName, Default);
|
||||
else {
|
||||
ReturnedString [Size-1] = 0;
|
||||
strncpy (ReturnedString, Default, Size-1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Non existent section */
|
||||
if (set){
|
||||
section = (TSecHeader *) xmalloc (sizeof (TSecHeader));
|
||||
section->AppName = strdup (AppName);
|
||||
section->Keys = 0;
|
||||
new_key (section, KeyName, Default);
|
||||
section->link = Current->Section;
|
||||
Current->Section = section;
|
||||
} else {
|
||||
ReturnedString [Size-1] = 0;
|
||||
strncpy (ReturnedString, Default, Size-1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
short GetPrivateProfileString (LPSTR AppName, LPSTR KeyName,
|
||||
LPSTR Default, LPSTR ReturnedString,
|
||||
short Size, LPSTR FileName)
|
||||
{
|
||||
return (GetSetProfile (0, AppName, KeyName, Default, ReturnedString, Size, FileName));
|
||||
}
|
||||
|
||||
int GetProfileString (LPSTR AppName, LPSTR KeyName, LPSTR Default,
|
||||
LPSTR ReturnedString, int Size)
|
||||
{
|
||||
return GetPrivateProfileString (AppName, KeyName, Default,
|
||||
ReturnedString, Size, INIFILE);
|
||||
}
|
||||
|
||||
WORD GetPrivateProfileInt (LPSTR AppName, LPSTR KeyName, short Default,
|
||||
LPSTR File)
|
||||
{
|
||||
static char IntBuf [5];
|
||||
static char buf [5];
|
||||
|
||||
sprintf (buf, "%d", Default);
|
||||
|
||||
/* Check the exact semantic with the SDK */
|
||||
GetPrivateProfileString (AppName, KeyName, buf, IntBuf, 5, File);
|
||||
if (!strcasecmp (IntBuf, "true"))
|
||||
return 1;
|
||||
if (!strcasecmp (IntBuf, "yes"))
|
||||
return 1;
|
||||
return atoi (IntBuf);
|
||||
}
|
||||
|
||||
WORD GetProfileInt (LPSTR AppName, LPSTR KeyName, int Default)
|
||||
{
|
||||
return GetPrivateProfileInt (AppName, KeyName, Default, INIFILE);
|
||||
}
|
||||
|
||||
BOOL WritePrivateProfileString (LPSTR AppName, LPSTR KeyName, LPSTR String,
|
||||
LPSTR FileName)
|
||||
{
|
||||
return GetSetProfile (1, AppName, KeyName, String, "", 0, FileName);
|
||||
}
|
||||
|
||||
BOOL WriteProfileString (LPSTR AppName, LPSTR KeyName, LPSTR String)
|
||||
{
|
||||
return (WritePrivateProfileString (AppName, KeyName, String, INIFILE));
|
||||
}
|
||||
|
||||
static void dump_keys (FILE *profile, TKeys *p)
|
||||
{
|
||||
if (!p)
|
||||
return;
|
||||
dump_keys (profile, p->link);
|
||||
fprintf (profile, "%s=%s\r\n", p->KeyName, p->Value);
|
||||
}
|
||||
|
||||
static void dump_sections (FILE *profile, TSecHeader *p)
|
||||
{
|
||||
if (!p)
|
||||
return;
|
||||
dump_sections (profile, p->link);
|
||||
fprintf (profile, "\r\n[%s]\r\n", p->AppName);
|
||||
dump_keys (profile, p->Keys);
|
||||
}
|
||||
|
||||
static void dump_profile (TProfile *p)
|
||||
{
|
||||
FILE *profile;
|
||||
|
||||
if (!p)
|
||||
return;
|
||||
dump_profile (p->link);
|
||||
if ((profile = fopen (p->FileName, "w")) != NULL){
|
||||
dump_sections (profile, p->Section);
|
||||
fclose (profile);
|
||||
}
|
||||
}
|
||||
|
||||
void sync_profiles ()
|
||||
{
|
||||
dump_profile (Base);
|
||||
}
|
||||
|
||||
#ifdef DUMBTEST
|
||||
main ()
|
||||
{
|
||||
char r [100], app [100], key [100], valor [100];
|
||||
|
||||
while (1){
|
||||
printf ("Dame, Aplicacion, llave\n");
|
||||
gets (app);
|
||||
if (!app [0]){
|
||||
sync_profiles ();
|
||||
return;
|
||||
}
|
||||
gets (key);
|
||||
gets (valor);
|
||||
GetProfileString (app, key, "1No_Encontrado", r, sizeof (r));
|
||||
printf ("(%d)\n", GetProfileInt (app, key, 5));
|
||||
printf ("%s\n", r);
|
||||
WriteProfileString (app, key, valor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -78,6 +78,8 @@ void OffsetRect( LPRECT rect, short x, short y )
|
|||
*/
|
||||
void InflateRect( LPRECT rect, short x, short y )
|
||||
{
|
||||
rect->left -= x;
|
||||
rect->top -= y;
|
||||
rect->right += x;
|
||||
rect->bottom += y;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,9 @@ USER_InitApp(int hInstance)
|
|||
{
|
||||
/* GDI initialisation */
|
||||
if (!GDI_Init()) return 0;
|
||||
|
||||
/* Initialize system colors */
|
||||
SYSCOLOR_Init();
|
||||
|
||||
/* Create USER heap */
|
||||
if (!USER_HeapInit()) return 0;
|
||||
|
|
42
misc/xt.c
|
@ -19,6 +19,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
#include "win.h"
|
||||
#include "class.h"
|
||||
#include "gdi.h"
|
||||
#include "user.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define HZ 100
|
||||
|
@ -56,6 +57,8 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
|||
{
|
||||
WND * wndPtr;
|
||||
CLASS * classPtr;
|
||||
LPSTR textPtr;
|
||||
int len;
|
||||
|
||||
#ifdef DEBUG_MESSAGE
|
||||
printf( "DefWindowProc: %d %d %d %08x\n", hwnd, msg, wParam, lParam );
|
||||
|
@ -89,6 +92,41 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
|||
GlobalUnlock( hwnd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_GETTEXT:
|
||||
{
|
||||
if (wParam)
|
||||
{
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if (wndPtr->hText)
|
||||
{
|
||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||
if ((int)wParam > (len = strlen(textPtr)))
|
||||
{
|
||||
strcpy((LPSTR)lParam, textPtr);
|
||||
GlobalUnlock(hwnd);
|
||||
return (DWORD)len;
|
||||
}
|
||||
}
|
||||
((LPSTR)lParam)[0] = NULL;
|
||||
}
|
||||
GlobalUnlock(hwnd);
|
||||
return (0L);
|
||||
}
|
||||
|
||||
case WM_GETTEXTLENGTH:
|
||||
{
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if (wndPtr->hText)
|
||||
{
|
||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||
len = strlen(textPtr);
|
||||
GlobalUnlock(hwnd);
|
||||
return (DWORD)len;
|
||||
}
|
||||
GlobalUnlock(hwnd);
|
||||
return (0L);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -108,7 +146,7 @@ int MessageBox( HWND hwnd, LPSTR str, LPSTR title, WORD type )
|
|||
|
||||
void MessageBeep( WORD i )
|
||||
{
|
||||
printf( "MessageBeep: %d\n", i );
|
||||
XBell(XT_display, 100);
|
||||
}
|
||||
|
||||
WORD RegisterWindowMessage( LPSTR str )
|
||||
|
@ -123,7 +161,7 @@ WORD RegisterWindowMessage( LPSTR str )
|
|||
DWORD GetTickCount()
|
||||
{
|
||||
struct tms dummy;
|
||||
return times(&dummy) / (1000 / HZ);
|
||||
return (times(&dummy) * 1000) / HZ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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
|
||||
text.o dcvalues.o clipping.o bitblt.o linedda.o color.o
|
||||
|
||||
default: objects.o
|
||||
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Color functions
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
*/
|
||||
|
||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
extern Display * XT_display;
|
||||
extern Screen * XT_screen;
|
||||
|
||||
|
||||
/*
|
||||
* We try to use a private color map if possible, because Windows programs
|
||||
* assume that palette(0) == Black and palette(max-1) == White.
|
||||
*/
|
||||
|
||||
Colormap COLOR_WinColormap = 0;
|
||||
|
||||
|
||||
/* System colors */
|
||||
|
||||
static const char * SysColors[] =
|
||||
{
|
||||
/* Low pixel values (0..7) */
|
||||
|
||||
"black", "red4", "green4", "yellow4",
|
||||
"blue4", "magenta4", "cyan4", "gray50",
|
||||
|
||||
/* High pixel values (max-7..max) */
|
||||
|
||||
"gray75", "red", "green", "yellow",
|
||||
"blue", "magenta", "cyan", "white"
|
||||
};
|
||||
|
||||
#define NB_SYS_COLORS (sizeof(SysColors) / sizeof(SysColors[0]))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* COLOR_FillDefaultMap
|
||||
*
|
||||
* Try to allocate colors from default screen map (used when we
|
||||
* don't want to or can't use a private map).
|
||||
*/
|
||||
static int COLOR_FillDefaultMap()
|
||||
{
|
||||
XColor color;
|
||||
int i, total = 0;
|
||||
|
||||
for (i = 0; i < NB_SYS_COLORS; i++)
|
||||
{
|
||||
if (XParseColor( XT_display, DefaultColormapOfScreen( XT_screen ),
|
||||
SysColors[i], &color ))
|
||||
{
|
||||
if (XAllocColor( XT_display, DefaultColormapOfScreen( XT_screen ),
|
||||
&color ))
|
||||
total++;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* COLOR_BuildMap
|
||||
*
|
||||
* Fill the private colormap.
|
||||
*/
|
||||
static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
|
||||
{
|
||||
XColor color;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NB_SYS_COLORS; i++)
|
||||
{
|
||||
if (!XParseColor( XT_display, map, SysColors[i], &color ))
|
||||
color.red = color.green = color.blue = color.flags = 0;
|
||||
if (i < NB_SYS_COLORS/2) color.pixel = i;
|
||||
else color.pixel = (1 << depth) - NB_SYS_COLORS + i;
|
||||
if (color.pixel < size) XStoreColor( XT_display, map, &color );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* COLOR_Init
|
||||
*/
|
||||
BOOL COLOR_Init()
|
||||
{
|
||||
Visual * visual = DefaultVisual( XT_display, DefaultScreen(XT_display) );
|
||||
|
||||
switch(visual->class)
|
||||
{
|
||||
case GrayScale:
|
||||
case PseudoColor:
|
||||
case DirectColor:
|
||||
|
||||
#ifdef USE_PRIVATE_MAP
|
||||
COLOR_WinColormap = XCreateColormap( XT_display,
|
||||
DefaultRootWindow(XT_display),
|
||||
visual, AllocAll );
|
||||
if (COLOR_WinColormap)
|
||||
COLOR_BuildMap(COLOR_WinColormap,
|
||||
DefaultDepth(XT_display, DefaultScreen(XT_display)),
|
||||
visual->map_entries );
|
||||
else COLOR_FillDefaultMap();
|
||||
break;
|
||||
#endif /* USE_PRIVATE_MAP */
|
||||
|
||||
case StaticGray:
|
||||
case StaticColor:
|
||||
case TrueColor:
|
||||
COLOR_FillDefaultMap();
|
||||
COLOR_WinColormap = CopyFromParent;
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
|
@ -150,13 +150,14 @@ BOOL GDI_Init()
|
|||
|
||||
/* Create GDI heap */
|
||||
|
||||
s = GetNextSegment( 0, 0x10000 );
|
||||
s = (struct segment_descriptor_s *)GetNextSegment( 0, 0x10000 );
|
||||
if (s == NULL) return FALSE;
|
||||
HEAP_Init( &GDI_Heap, s->base_addr, GDI_HEAP_SIZE );
|
||||
free(s);
|
||||
|
||||
/* Create default palette */
|
||||
|
||||
COLOR_Init();
|
||||
PALETTE_Init();
|
||||
StockObjects[DEFAULT_PALETTE] = PALETTE_systemPalette;
|
||||
|
||||
|
|
|
@ -21,65 +21,42 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|||
extern Display * XT_display;
|
||||
extern Screen * XT_screen;
|
||||
|
||||
|
||||
#define NB_RESERVED_COLORS 17
|
||||
static char * ReservedColors[NB_RESERVED_COLORS] =
|
||||
{
|
||||
"black",
|
||||
"gray25",
|
||||
"gray50",
|
||||
"gray75",
|
||||
"white",
|
||||
"red1",
|
||||
"red4",
|
||||
"green1",
|
||||
"green4",
|
||||
"blue1",
|
||||
"blue4",
|
||||
"cyan1",
|
||||
"cyan4",
|
||||
"magenta1",
|
||||
"magenta4",
|
||||
"yellow1",
|
||||
"yellow4"
|
||||
};
|
||||
extern Colormap COLOR_WinColormap;
|
||||
|
||||
GDIOBJHDR * PALETTE_systemPalette;
|
||||
|
||||
static int SysColorPixels[NB_RESERVED_COLORS];
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* PALETTE_Init
|
||||
*/
|
||||
BOOL PALETTE_Init()
|
||||
{
|
||||
int i, size, pixel;
|
||||
XColor serverColor, exactColor;
|
||||
int i, size;
|
||||
XColor color;
|
||||
Colormap map;
|
||||
HPALETTE hpalette;
|
||||
LOGPALETTE * palPtr;
|
||||
|
||||
size = DefaultVisual(XT_display,DefaultScreen(XT_display))->map_entries;
|
||||
size = DefaultVisual( XT_display, DefaultScreen(XT_display) )->map_entries;
|
||||
palPtr = malloc( sizeof(LOGPALETTE) + (size-1)*sizeof(PALETTEENTRY) );
|
||||
if (!palPtr) return FALSE;
|
||||
palPtr->palVersion = 0x300;
|
||||
palPtr->palNumEntries = size;
|
||||
memset( palPtr->palPalEntry, 0xff, size*sizeof(PALETTEENTRY) );
|
||||
|
||||
for (i = 0; i < NB_RESERVED_COLORS; i++)
|
||||
|
||||
if ((map = COLOR_WinColormap) == CopyFromParent)
|
||||
map = DefaultColormapOfScreen( XT_screen );
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (XAllocNamedColor( XT_display,
|
||||
DefaultColormapOfScreen( XT_screen ),
|
||||
ReservedColors[i],
|
||||
&serverColor, &exactColor ))
|
||||
{
|
||||
pixel = serverColor.pixel;
|
||||
palPtr->palPalEntry[pixel].peRed = serverColor.red >> 8;
|
||||
palPtr->palPalEntry[pixel].peGreen = serverColor.green >> 8;
|
||||
palPtr->palPalEntry[pixel].peBlue = serverColor.blue >> 8;
|
||||
palPtr->palPalEntry[pixel].peFlags = 0;
|
||||
}
|
||||
color.pixel = i;
|
||||
XQueryColor( XT_display, map, &color );
|
||||
palPtr->palPalEntry[i].peRed = color.red >> 8;
|
||||
palPtr->palPalEntry[i].peGreen = color.green >> 8;
|
||||
palPtr->palPalEntry[i].peBlue = color.blue >> 8;
|
||||
palPtr->palPalEntry[i].peFlags = 0;
|
||||
}
|
||||
|
||||
hpalette = CreatePalette( palPtr );
|
||||
PALETTE_systemPalette = (GDIOBJHDR *) GDI_HEAP_ADDR( hpalette );
|
||||
free( palPtr );
|
||||
|
@ -158,10 +135,18 @@ WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color )
|
|||
|
||||
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
|
||||
if (!palPtr) return 0;
|
||||
|
||||
if (COLOR_WinColormap && (hpalette == STOCK_DEFAULT_PALETTE))
|
||||
{
|
||||
if ((color & 0xffffff) == 0) return 0; /* Entry 0 is black */
|
||||
if ((color & 0xffffff) == 0xffffff) /* Max entry is white */
|
||||
return palPtr->logpalette.palNumEntries - 1;
|
||||
}
|
||||
|
||||
r = GetRValue(color);
|
||||
g = GetGValue(color);
|
||||
b = GetBValue(color);
|
||||
|
||||
entry = palPtr->logpalette.palPalEntry;
|
||||
for (i = 0, minDist = MAXINT; i < palPtr->logpalette.palNumEntries; i++)
|
||||
{
|
||||
|
|
|
@ -539,17 +539,20 @@ int CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, short mode )
|
|||
case RGN_AND:
|
||||
res = IntersectRect( ®ion->box, &src1Obj->region.box,
|
||||
&src2Obj->region.box );
|
||||
region->type = COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_OR:
|
||||
case RGN_XOR:
|
||||
res = UnionRect( ®ion->box, &src1Obj->region.box,
|
||||
&src2Obj->region.box );
|
||||
region->type = COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_DIFF:
|
||||
res = SubtractRect( ®ion->box, &src1Obj->region.box,
|
||||
&src2Obj->region.box );
|
||||
region->type = COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_COPY:
|
||||
|
@ -582,7 +585,7 @@ int CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, short mode )
|
|||
REGION_CopyIntersection( region, &src1Obj->region );
|
||||
XSetFunction( XT_display, regionGC, GXand );
|
||||
REGION_CopyIntersection( region, &src2Obj->region );
|
||||
return COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_OR:
|
||||
case RGN_XOR:
|
||||
|
@ -592,7 +595,7 @@ int CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, short mode )
|
|||
XSetFunction( XT_display, regionGC, (mode == RGN_OR) ? GXor : GXxor);
|
||||
REGION_CopyIntersection( region, &src1Obj->region );
|
||||
REGION_CopyIntersection( region, &src2Obj->region );
|
||||
return COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_DIFF:
|
||||
XSetFunction( XT_display, regionGC, GXclear );
|
||||
|
@ -602,13 +605,13 @@ int CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, short mode )
|
|||
REGION_CopyIntersection( region, &src1Obj->region );
|
||||
XSetFunction( XT_display, regionGC, GXandInverted );
|
||||
REGION_CopyIntersection( region, &src2Obj->region );
|
||||
return COMPLEXREGION;
|
||||
break;
|
||||
|
||||
case RGN_COPY:
|
||||
XSetFunction( XT_display, regionGC, GXcopy );
|
||||
XCopyArea( XT_display, src1Obj->region.pixmap, region->pixmap,
|
||||
regionGC, 0, 0, width, height, 0, 0 );
|
||||
return region->type;
|
||||
break;
|
||||
}
|
||||
return ERROR;
|
||||
return region->type;
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
|
@ -0,0 +1,292 @@
|
|||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 1, February 1989
|
||||
|
||||
Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The license agreements of most software companies try to keep users
|
||||
at the mercy of those companies. By contrast, our General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. The
|
||||
General Public License applies to the Free Software Foundation's
|
||||
software and to any other program whose authors commit to using it.
|
||||
You can use it for your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Specifically, the General Public License is designed to make
|
||||
sure that you have the freedom to give away or sell copies of free
|
||||
software, that you receive source code or can get it if you want it,
|
||||
that you can change the software or use pieces of it in new free
|
||||
programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of a such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must tell them their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any program or other work which
|
||||
contains a notice placed by the copyright holder saying it may be
|
||||
distributed under the terms of this General Public License. The
|
||||
"Program", below, refers to any such program or work, and a "work based
|
||||
on the Program" means either the Program or any work containing the
|
||||
Program or a portion of it, either verbatim or with modifications. Each
|
||||
licensee is addressed as "you".
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and
|
||||
disclaimer of warranty; keep intact all the notices that refer to this
|
||||
General Public License and to the absence of any warranty; and give any
|
||||
other recipients of the Program a copy of this General Public License
|
||||
along with the Program. You may charge a fee for the physical act of
|
||||
transferring a copy.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of
|
||||
it, and copy and distribute such modifications under the terms of Paragraph
|
||||
1 above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish, that
|
||||
in whole or in part contains the Program or any part thereof, either
|
||||
with or without modifications, to be licensed at no charge to all
|
||||
third parties under the terms of this General Public License (except
|
||||
that you may choose to grant warranty protection to some or all
|
||||
third parties, at your option).
|
||||
|
||||
c) If the modified program normally reads commands interactively when
|
||||
run, you must cause it, when started running for such interactive use
|
||||
in the simplest and most usual way, to print or display an
|
||||
announcement including an appropriate copyright notice and a notice
|
||||
that there is no warranty (or else, saying that you provide a
|
||||
warranty) and that users may redistribute the program under these
|
||||
conditions, and telling the user how to view a copy of this General
|
||||
Public License.
|
||||
|
||||
d) You may charge a fee for the physical act of transferring a
|
||||
copy, and you may at your option offer warranty protection in
|
||||
exchange for a fee.
|
||||
|
||||
Mere aggregation of another independent work with the Program (or its
|
||||
derivative) on a volume of a storage or distribution medium does not bring
|
||||
the other work under the scope of these terms.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3. You may copy and distribute the Program (or a portion or derivative of
|
||||
it, under Paragraph 2) in object code or executable form under the terms of
|
||||
Paragraphs 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three
|
||||
years, to give any third party free (except for a nominal charge
|
||||
for the cost of distribution) a complete machine-readable copy of the
|
||||
corresponding source code, to be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the
|
||||
corresponding source code may be obtained. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form alone.)
|
||||
|
||||
Source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable file, complete source code means
|
||||
all the source code for all modules it contains; but, as a special
|
||||
exception, it need not include source code for modules which are standard
|
||||
libraries that accompany the operating system on which the executable
|
||||
file runs, or for standard header files or definitions files that
|
||||
accompany that operating system.
|
||||
|
||||
4. You may not copy, modify, sublicense, distribute or transfer the
|
||||
Program except as expressly provided under this General Public License.
|
||||
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
|
||||
the Program is void, and will automatically terminate your rights to use
|
||||
the Program under this License. However, parties who have received
|
||||
copies, or rights to use copies, from you under this General Public
|
||||
License will not have their licenses terminated so long as such parties
|
||||
remain in full compliance.
|
||||
|
||||
5. By copying, distributing or modifying the Program (or any work based
|
||||
on the Program) you indicate your acceptance of this license to do so,
|
||||
and all its terms and conditions.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the original
|
||||
licensor to copy, distribute or modify the Program subject to these
|
||||
terms and conditions. You may not impose any further restrictions on the
|
||||
recipients' exercise of the rights granted herein.
|
||||
|
||||
|
||||
|
||||
7. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of the license which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
the license, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
8. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to humanity, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19xx name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the
|
||||
appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than `show w' and `show
|
||||
c'; they could even be mouse-clicks or menu items--whatever suits your
|
||||
program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
program `Gnomovision' (a program to direct compilers to make passes
|
||||
at assemblers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
NAME Hyperoid
|
||||
DESCRIPTION 'Hyperoid Copyright (C) 1990,91 Hutchins Software'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
STACKSIZE 4096
|
||||
HEAPSIZE 32768
|
||||
DATA MOVEABLE MULTIPLE
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
SEGMENTS
|
||||
HYPEROID LOADONCALL MOVEABLE DISCARDABLE
|
||||
ROIDSUPP LOADONCALL MOVEABLE DISCARDABLE
|
||||
|
||||
EXPORTS
|
||||
HyperoidWndProc @1
|
||||
HyperoidAboutDlg @2
|
|
@ -0,0 +1,241 @@
|
|||
//
|
||||
// HYPEROID.H - hyperoid internal header information
|
||||
//
|
||||
// Version: 1.1 Copyright (C) 1990,91 Hutchins Software
|
||||
// This software is licenced under the GNU General Public Licence
|
||||
// Please read the associated legal documentation
|
||||
// Author: Edward Hutchins
|
||||
// Revisions:
|
||||
//
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#define OEMRESOURCE
|
||||
#include <winext.h>
|
||||
|
||||
//
|
||||
// typedefs and defines
|
||||
//
|
||||
|
||||
// color stuff
|
||||
#define PALETTE_SIZE 16
|
||||
typedef enum
|
||||
{
|
||||
BLACK, DKGREY, GREY, WHITE,
|
||||
DKRED, RED, DKGREEN, GREEN, DKBLUE, BLUE,
|
||||
DKYELLOW, YELLOW, DKCYAN, CYAN, DKMAGENTA, MAGENTA
|
||||
} COLORS;
|
||||
|
||||
// degrees scaled to integer math
|
||||
#define DEGREE_SIZE 256
|
||||
#define DEGREE_MASK 255
|
||||
#define DEGREE_MAX 0x4000
|
||||
|
||||
// object limits
|
||||
#define MAX_PTS 8
|
||||
#define MAX_OBJS 100
|
||||
#define MAX_COORD 0x2000
|
||||
#define CLIP_COORD (MAX_COORD+300)
|
||||
|
||||
// timer stuff
|
||||
#define DRAW_TIMER 1
|
||||
#define DRAW_DELAY 50
|
||||
#define RESTART_TIMER 2
|
||||
#define RESTART_DELAY 5000
|
||||
|
||||
// restart modes
|
||||
typedef enum { RESTART_GAME, RESTART_LEVEL, RESTART_NEXTLEVEL } RESTART_MODE;
|
||||
|
||||
// letter scaling
|
||||
#define LETTER_MAX 256
|
||||
|
||||
// extra life every
|
||||
#define EXTRA_LIFE 100000
|
||||
|
||||
// list node
|
||||
typedef struct tagNODE
|
||||
{
|
||||
struct tagNODE *npNext, *npPrev;
|
||||
} NODE;
|
||||
pointerdef( NODE );
|
||||
|
||||
// list header
|
||||
typedef struct
|
||||
{
|
||||
NPNODE npHead, npTail;
|
||||
} LIST;
|
||||
pointerdef( LIST );
|
||||
|
||||
// object descriptor
|
||||
typedef struct
|
||||
{
|
||||
NODE Link; // for object list
|
||||
POINT Pos; // position of center of object
|
||||
POINT Vel; // velocity in logical units/update
|
||||
INT nMass; // mass of object
|
||||
INT nDir; // direction in degrees
|
||||
INT nSpin; // angular momentum degrees/update
|
||||
INT nCount; // used by different objects
|
||||
INT nDelay; // used by different objects
|
||||
BYTE byColor; // palette color
|
||||
BYTE byPts; // number of points in object
|
||||
POINT Pts[MAX_PTS]; // points making up an object
|
||||
POINT Old[MAX_PTS]; // last plotted location
|
||||
} OBJ;
|
||||
pointerdef( OBJ );
|
||||
|
||||
//
|
||||
// inline macro functions
|
||||
//
|
||||
|
||||
// function aliases
|
||||
#define AddHeadObj(l,o) AddHead((l),((NPNODE)o))
|
||||
#define RemHeadObj(l) ((NPOBJ)RemHead(l))
|
||||
#define RemoveObj(l,o) Remove((l),((NPNODE)o))
|
||||
#define HeadObj(l) ((NPOBJ)((l)->npHead))
|
||||
#define NextObj(o) ((NPOBJ)((o)->Link.npNext))
|
||||
|
||||
// real-time check of the keyboard
|
||||
#define IsKeyDown(x) (GetAsyncKeyState(x)<0)
|
||||
|
||||
// I HATE typing this allatime!
|
||||
#define INTRES(x) MAKEINTRESOURCE(x)
|
||||
|
||||
// size of an array
|
||||
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
// faster than MulDiv!
|
||||
#define MULDEG(x,y) ((INT)(((LONG)(x)*(y))/DEGREE_MAX))
|
||||
|
||||
// DEG - convert an integer into a degree lookup index
|
||||
#define DEG(x) ((WORD)(x)&DEGREE_MASK)
|
||||
|
||||
// ACCEL - accelerate an object in a given direction
|
||||
#define ACCEL(o,d,s) \
|
||||
(((o)->Vel.x += MULDEG((s),nCos[DEG(d)])), \
|
||||
((o)->Vel.y += MULDEG((s),nSin[DEG(d)])))
|
||||
|
||||
// PTINRECT - a faster PtInRect
|
||||
#define PTINRECT(r,p) \
|
||||
(((r)->left <= (p).x) && ((r)->right > (p).x) && \
|
||||
((r)->top <= (p).y) && ((r)->bottom > (p).y))
|
||||
|
||||
// INTRECT - a faster IntersectRect that just returns the condition
|
||||
#define INTRECT(r1,r2) \
|
||||
(((r1)->right >= (r2)->left) && \
|
||||
((r1)->left < (r2)->right) && \
|
||||
((r1)->bottom >= (r2)->top) && \
|
||||
((r1)->top < (r2)->bottom))
|
||||
|
||||
// MKRECT - make a rect around a point
|
||||
#define MKRECT(r,p,s) \
|
||||
(((r)->left = ((p).x-(s))), ((r)->right = ((p).x+(s))), \
|
||||
((r)->top = ((p).y-(s))), ((r)->bottom = ((p).y+(s))))
|
||||
|
||||
//
|
||||
// prototypes
|
||||
//
|
||||
|
||||
// hyperoid.c
|
||||
INT NEAR PASCAL arand( INT x );
|
||||
VOID NEAR PASCAL AddHead( NPLIST npList, NPNODE npNode );
|
||||
NPNODE NEAR PASCAL RemHead( NPLIST npList );
|
||||
VOID NEAR PASCAL Remove( NPLIST npList, NPNODE npNode );
|
||||
VOID NEAR PASCAL DrawObject( HDC hDC, NPOBJ npObj );
|
||||
VOID NEAR PASCAL SetRestart( BOOL bGameOver );
|
||||
VOID NEAR PASCAL AddExtraLife( VOID );
|
||||
VOID NEAR PASCAL Hit( HDC hDC, NPOBJ npObj );
|
||||
VOID NEAR PASCAL Explode( HDC hDC, NPOBJ npObj );
|
||||
BOOL NEAR PASCAL HitPlayer( HDC hDC, NPOBJ npObj );
|
||||
NPOBJ FAR PASCAL CreateLetter( CHAR cLetter, INT nSize );
|
||||
VOID NEAR PASCAL DrawLetters( HDC hDC );
|
||||
VOID NEAR PASCAL DrawHunterShots( HDC hDC );
|
||||
VOID NEAR PASCAL FireHunterShot( NPOBJ npHunt );
|
||||
VOID NEAR PASCAL CreateHunter( VOID );
|
||||
VOID NEAR PASCAL DrawHunters( HDC hDC );
|
||||
VOID NEAR PASCAL CreateSpinner( VOID );
|
||||
VOID NEAR PASCAL DrawSpinners( HDC hDC );
|
||||
VOID NEAR PASCAL CreateRoid( POINT Pos, POINT Vel, INT nSides, BYTE byColor, INT nDir, INT nSpeed, INT nSpin );
|
||||
VOID NEAR PASCAL BreakRoid( HDC hDC, NPOBJ npRoid, NPOBJ npShot );
|
||||
VOID NEAR PASCAL DrawRoids( HDC hDC );
|
||||
VOID NEAR PASCAL DrawShots( HDC hDC );
|
||||
VOID NEAR PASCAL DrawFlames( HDC hDC );
|
||||
VOID NEAR PASCAL FireShot( VOID );
|
||||
VOID NEAR PASCAL AccelPlayer( INT nDir, INT nAccel );
|
||||
VOID NEAR PASCAL DrawPlayer( HDC hDC );
|
||||
VOID NEAR PASCAL DrawObjects( HWND hWnd );
|
||||
VOID NEAR PASCAL CheckScore( HWND hWnd );
|
||||
VOID NEAR PASCAL HitList( HDC hDC, NPLIST npList );
|
||||
VOID NEAR PASCAL ExplodeBadguys( HDC hDC, NPLIST npList );
|
||||
VOID NEAR PASCAL NewGame( HWND hWnd );
|
||||
VOID NEAR PASCAL RestartHyperoid( VOID );
|
||||
VOID NEAR PASCAL Panic( BOOL bPanic );
|
||||
VOID NEAR PASCAL PaintHyperoid( HWND hWnd );
|
||||
VOID NEAR PASCAL DisableHyperoidInput( HWND hWnd, BOOL bCapture );
|
||||
LONG FAR PASCAL EXPORT HyperoidWndProc( HWND hWnd, unsigned message, WORD wParam, LONG lParam );
|
||||
BOOL NEAR PASCAL InitHyperoid( VOID );
|
||||
VOID NEAR PASCAL ExitHyperoid( VOID );
|
||||
INT FAR PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, INT nCmdShow );
|
||||
|
||||
// roidsupp.c
|
||||
VOID FAR PASCAL PrintLetters( NPSTR npszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize );
|
||||
VOID FAR PASCAL SpinLetters( NPSTR npszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize );
|
||||
HPALETTE FAR PASCAL CreateHyperoidPalette( VOID );
|
||||
BOOL FAR PASCAL CreateHyperoidClass( VOID );
|
||||
VOID NEAR PASCAL SetHyperoidMenu( HWND hWnd, INT nFirstID, INT nLastID );
|
||||
HWND FAR PASCAL CreateHyperoidWindow( LPSTR lpszCmd, INT nCmdShow );
|
||||
VOID FAR PASCAL SaveHyperoidWindowPos( HWND hWnd );
|
||||
VOID FAR PASCAL GetHyperoidIni( VOID );
|
||||
VOID FAR PASCAL HyperoidHelp( HWND hWnd );
|
||||
BOOL FAR PASCAL EXPORT HyperoidAboutDlg( HWND hDlg, WORD mess, WORD wParam, LONG lParam );
|
||||
VOID FAR PASCAL AboutHyperoid( HWND hWnd );
|
||||
|
||||
#endif // RC_INVOKED //
|
||||
|
||||
//
|
||||
// resource IDs
|
||||
//
|
||||
|
||||
// icons and bitmaps
|
||||
#define IDI_HYPEROID 10
|
||||
#define IDI_PANIC 20
|
||||
|
||||
// bitmaps
|
||||
#define IDB_blank 50
|
||||
#define IDB_bomb 51
|
||||
#define IDB_level 52
|
||||
#define IDB_life 53
|
||||
#define IDB_num0 54
|
||||
#define IDB_num1 55
|
||||
#define IDB_num2 56
|
||||
#define IDB_num3 57
|
||||
#define IDB_num4 58
|
||||
#define IDB_num5 59
|
||||
#define IDB_num6 60
|
||||
#define IDB_num7 61
|
||||
#define IDB_num8 62
|
||||
#define IDB_num9 63
|
||||
#define IDB_plus 64
|
||||
#define IDB_score 65
|
||||
#define IDB_shield 66
|
||||
// additional bitmap stuff
|
||||
#define IDB_MAX 17
|
||||
#define CX_BITMAP 16
|
||||
#define CY_BITMAP 16
|
||||
|
||||
// strings
|
||||
#define IDS_NAME 100
|
||||
|
||||
// menus
|
||||
#define IDM_NEW 200
|
||||
#define IDM_ABOUT 201
|
||||
|
||||
// about box
|
||||
#define IDD_ABOUT 500
|
||||
#define IDD_A_HELP 501
|
||||
#define IDD_A_HISCORE 502
|
After Width: | Height: | Size: 766 B |
|
@ -0,0 +1,35 @@
|
|||
PROJ =HYPEROID
|
||||
DEBUG =1
|
||||
CC =qcl
|
||||
CFLAGS_G = /AM /W3 /Ze
|
||||
CFLAGS_D = /Zi /Od
|
||||
CFLAGS_R = /O /Ol /Gs /DNDEBUG
|
||||
CFLAGS =$(CFLAGS_G) $(CFLAGS_D)
|
||||
LFLAGS_G = /CP:0xffff /NOI /SE:0x80 /ST:0x2000
|
||||
LFLAGS_D = /CO /M
|
||||
LFLAGS_R =
|
||||
LFLAGS =$(LFLAGS_G) $(LFLAGS_D)
|
||||
RUNFLAGS =
|
||||
OBJS_EXT =
|
||||
LIBS_EXT =
|
||||
|
||||
all: $(PROJ).exe
|
||||
|
||||
hyperoid.obj: hyperoid.c
|
||||
|
||||
roidsupp.obj: roidsupp.c
|
||||
|
||||
$(PROJ).exe: hyperoid.obj roidsupp.obj $(OBJS_EXT)
|
||||
echo >NUL @<<$(PROJ).crf
|
||||
hyperoid.obj +
|
||||
roidsupp.obj +
|
||||
$(OBJS_EXT)
|
||||
$(PROJ).exe
|
||||
|
||||
$(LIBS_EXT);
|
||||
<<
|
||||
ilink -a -e "link $(LFLAGS) @$(PROJ).crf" $(PROJ)
|
||||
|
||||
run: $(PROJ).exe
|
||||
$(PROJ) $(RUNFLAGS)
|
||||
|
|
@ -0,0 +1,671 @@
|
|||
Stack Allocation = 8192 bytes
|
||||
|
||||
hyperoid
|
||||
|
||||
Start Length Name Class
|
||||
0001:0000 022D8H HYPEROID CODE
|
||||
0001:22D8 006E8H ROIDSUPP CODE
|
||||
0001:29C0 02834H _TEXT CODE
|
||||
0001:5200 026F0H EMULATOR_TEXT CODE
|
||||
0001:78F0 00000H C_ETEXT ENDCODE
|
||||
0002:0000 00170H EMULATOR_DATA FAR_DATA
|
||||
0003:0000 00042H NULL BEGDATA
|
||||
0003:0042 00A00H _DATA DATA
|
||||
0003:0A42 00002H XIQC DATA
|
||||
0003:0A44 0000EH DBDATA DATA
|
||||
0003:0A52 0000EH CDATA DATA
|
||||
0003:0A60 00000H XIFB DATA
|
||||
0003:0A60 00000H XIF DATA
|
||||
0003:0A60 00000H XIFE DATA
|
||||
0003:0A60 00000H XIB DATA
|
||||
0003:0A60 0000CH XI DATA
|
||||
0003:0A6C 00000H XIE DATA
|
||||
0003:0A6C 00000H XPB DATA
|
||||
0003:0A6C 00000H XP DATA
|
||||
0003:0A6C 00000H XPE DATA
|
||||
0003:0A6C 00000H XCB DATA
|
||||
0003:0A6C 00000H XC DATA
|
||||
0003:0A6C 00000H XCE DATA
|
||||
0003:0A6C 00000H XCFB DATA
|
||||
0003:0A6C 00000H XCF DATA
|
||||
0003:0A6C 00000H XCFE DATA
|
||||
0003:0A6C 00018H CONST CONST
|
||||
0003:0A84 00008H HDR MSG
|
||||
0003:0A8C 001DDH MSG MSG
|
||||
0003:0C69 00002H PAD MSG
|
||||
0003:0C6B 00001H EPAD MSG
|
||||
0003:0C6C 0006EH _BSS BSS
|
||||
0003:0CDA 00000H XOB BSS
|
||||
0003:0CDA 00000H XO BSS
|
||||
0003:0CDA 00000H XOE BSS
|
||||
0003:0CE0 02616H c_common BSS
|
||||
0003:3300 02000H STACK STACK
|
||||
|
||||
Origin Group
|
||||
0003:0 DGROUP
|
||||
|
||||
Address Export Alias
|
||||
|
||||
0001:28D9 HYPEROIDABOUTDLG HYPEROIDABOUTDLG
|
||||
0001:1ECA HYPEROIDWNDPROC HYPEROIDWNDPROC
|
||||
|
||||
Address Publics by Name
|
||||
|
||||
0001:3B44 $I10_OUTPUT
|
||||
0001:382E $i8_output
|
||||
0001:3AEF $i8_tpwr10
|
||||
0001:296C ABOUTHYPEROID
|
||||
0001:029D ACCELERATE
|
||||
0001:18B6 ACCELPLAYER
|
||||
0001:006B ADDHEAD
|
||||
0001:0000 ARAND
|
||||
0001:13D9 BREAKROID
|
||||
0001:1B94 CHECKSCORE
|
||||
0001:0C8A CREATEHUNTER
|
||||
0001:2595 CREATEHYPEROIDCLASS
|
||||
0001:23AC CREATEHYPEROIDPALETTE
|
||||
0001:268F CREATEHYPEROIDWINDOW
|
||||
0001:08E8 CREATELETTER
|
||||
0001:12D3 CREATEROID
|
||||
0001:0F98 CREATESPINNER
|
||||
0001:1754 DRAWFLAMES
|
||||
0001:0D5E DRAWHUNTERS
|
||||
0001:0AD2 DRAWHUNTERSHOTS
|
||||
0001:0A44 DRAWLETTERS
|
||||
0001:02F2 DRAWOBJECT
|
||||
0001:1AB6 DRAWOBJECTS
|
||||
0001:198E DRAWPLAYER
|
||||
0001:15AC DRAWROIDS
|
||||
0001:16C5 DRAWSHOTS
|
||||
0001:107D DRAWSPINNERS
|
||||
0001:1E41 ERASEHYPEROIDBKGND
|
||||
0001:21CC EXITHYPEROID
|
||||
0001:0630 EXPLODE
|
||||
0001:3552 fFYTOX
|
||||
0000:FE32 Abs FIARQQ
|
||||
0000:0E32 Abs FICRQQ
|
||||
0000:5C32 Abs FIDRQQ
|
||||
0000:1632 Abs FIERQQ
|
||||
0001:0BAC FIREHUNTERSHOT
|
||||
0001:17E3 FIRESHOT
|
||||
0000:0632 Abs FISRQQ
|
||||
0000:A23D Abs FIWRQQ
|
||||
0000:4000 Abs FJARQQ
|
||||
0000:C000 Abs FJCRQQ
|
||||
0000:8000 Abs FJSRQQ
|
||||
0001:0547 HIT
|
||||
0001:0787 HITPLAYER
|
||||
0001:28D9 HYPEROIDABOUTDLG
|
||||
0001:28AA HYPEROIDHELP
|
||||
0001:1ECA HYPEROIDWNDPROC
|
||||
0001:214C INITHYPEROID
|
||||
0001:0195 INITOBJECTS
|
||||
0001:1DF2 PAINTHYPEROID
|
||||
0001:1D51 PANIC
|
||||
0003:0CE4 PLOCALHEAP
|
||||
0001:22D8 PRINTLETTERS
|
||||
0001:00D0 REMHEAD
|
||||
0001:0136 REMOVE
|
||||
0001:1C13 RESTARTHYPEROID
|
||||
0001:2790 SAVEHYPEROIDWINDOWPOS
|
||||
0001:2616 SETHYPEROIDMENU
|
||||
0001:0513 SETRESTART
|
||||
0001:2222 WINMAIN
|
||||
0001:317C _atof
|
||||
0001:3178 _atoi
|
||||
0003:32C6 _bPaused
|
||||
0003:32BE _bRestart
|
||||
0001:4AE4 _cos
|
||||
0003:0C6C _edata
|
||||
0003:3300 _end
|
||||
0003:06AF _environ
|
||||
0003:0688 _errno
|
||||
0001:2B8D _exit
|
||||
0003:3086 _FlameList
|
||||
0003:32C2 _FreeList
|
||||
0003:30AE _hAppInst
|
||||
0003:32D2 _hAppPalette
|
||||
0003:32C0 _hAppWnd
|
||||
0003:308E _hPen
|
||||
0003:0A38 _HUGE
|
||||
0003:30B0 _HunterList
|
||||
0003:0CE8 _HunterShotList
|
||||
0003:0CE0 _LetterList
|
||||
0003:0250 _LetterPart
|
||||
0003:30B8 _lScore
|
||||
0001:2F34 _malloc
|
||||
0001:4E30 _matherr
|
||||
0001:32F4 _memmove
|
||||
0001:333C _memset
|
||||
0003:32BC _nBadGuys
|
||||
0003:0CEE _nCos
|
||||
0003:32C8 _nGravity
|
||||
0003:308C _nLevel
|
||||
0003:0CEC _npPlayer
|
||||
0003:0CE6 _nSafe
|
||||
0003:32F4 _nShield
|
||||
0003:30BC _nSin
|
||||
0003:0EEE _Obj
|
||||
0003:32CE _RoidList
|
||||
0003:32CA _ShotList
|
||||
0001:4ADE _sin
|
||||
0003:30B4 _SpinnerList
|
||||
0001:3130 _strcmp
|
||||
0001:30FE _strcpy
|
||||
0001:315C _strlen
|
||||
0003:32D4 _szAppName
|
||||
0003:0298 _szLetterDesc
|
||||
0003:0284 _szNumberDesc
|
||||
0001:4AE9 _tan
|
||||
0003:308A _wTick
|
||||
0003:09A4 __80x87
|
||||
0003:066C __acfinfo
|
||||
0000:9876 Abs __acrtmsg
|
||||
0000:9876 Abs __acrtused
|
||||
0000:D6D6 Abs __aDBdoswp
|
||||
0003:06BE __adbgmsg
|
||||
0003:0650 __aexit_rtn
|
||||
0001:4AF4 __aFCIcos
|
||||
0001:4AEE __aFCIsin
|
||||
0001:4AF9 __aFCItan
|
||||
0001:4D08 __aFftol
|
||||
0001:3386 __aFldiv
|
||||
0001:3420 __aFlmul
|
||||
0001:3420 __aFulmul
|
||||
0003:067A __aintdiv
|
||||
0003:06C6 __amblksiz
|
||||
0001:2AA3 __amsg_exit
|
||||
0003:0042 __anullsize
|
||||
0003:0668 __aseghi
|
||||
0003:066A __aseglo
|
||||
0003:0652 __asizds
|
||||
0003:06E4 __asizeC
|
||||
0003:06E5 __asizeD
|
||||
0001:29D0 __astart
|
||||
0001:51D0 __atold
|
||||
0003:064E __atopsp
|
||||
0001:31C2 __catox
|
||||
0001:2B9C __cexit
|
||||
0001:4A64 __cfltcvt
|
||||
0003:06C8 __cfltcvt_tab
|
||||
0001:474E __cftoe
|
||||
0001:489C __cftof
|
||||
0001:49B2 __cftog
|
||||
0003:06B6 __child
|
||||
0001:2AC8 __cinit
|
||||
0001:2A93 __cintDIV
|
||||
0001:4BA2 __cintrindisp1
|
||||
0001:4B79 __cintrindisp2
|
||||
0001:517A __cldcvt
|
||||
0001:4E40 __cldtoe
|
||||
0001:4FCE __cldtof
|
||||
0001:510C __cldtog
|
||||
0003:08E2 __cosjmptab
|
||||
0003:0912 __cotanjmptab
|
||||
0003:07FC __cpower
|
||||
0001:4656 __cropzeros
|
||||
0001:2C10 __ctermsub
|
||||
0001:4BD7 __ctrandisp1
|
||||
0001:4BC4 __ctrandisp2
|
||||
0003:06E6 __ctype
|
||||
0003:06E6 __ctype_
|
||||
0001:2BA6 __c_exit
|
||||
0001:2AC5 __dataseg
|
||||
0001:32BB __DOSCREATECSALIAS
|
||||
0001:3286 __DOSDEVCONFIG
|
||||
0003:0693 __doserrno
|
||||
0001:32D1 __DOSFREESEG
|
||||
0001:329D __DOSGETMACHINEMODE
|
||||
0001:32B2 __DOSSETVEC
|
||||
0003:0690 __dosvermajor
|
||||
0003:0691 __dosverminor
|
||||
0001:32DA __DOSWRITE
|
||||
0001:5200 __EmDataSeg
|
||||
0001:2B94 __exit
|
||||
0003:08A0 __expjmptab
|
||||
0003:067E __fac
|
||||
0001:46F2 __fassign
|
||||
0001:36D7 __fFCOS
|
||||
0001:355E __fFEXP
|
||||
0001:3686 __ffexpm1
|
||||
0001:360B __fFLN
|
||||
0001:36F0 __fFSIN
|
||||
0001:2C50 __FF_MSGBANNER
|
||||
0001:30DD __findlast
|
||||
0001:4D3C __fltin
|
||||
0001:4D92 __fltout
|
||||
0000:9876 Abs __fltused
|
||||
0001:45EE __forcdecpt
|
||||
0001:5A7F __fpemulator
|
||||
0001:5210 __fpemulatorbegin
|
||||
0001:786F __fpemulatorend
|
||||
0001:54DE __FPEXCEPTION87
|
||||
0003:0A54 __fpinit
|
||||
0001:787A __FPINSTALL87
|
||||
0001:523A __fpmath
|
||||
0001:4DD8 __fpsignal
|
||||
0002:0169 __fptaskdata
|
||||
0001:78A9 __FPTERMINATE87
|
||||
0001:3216 __fptostr
|
||||
0001:2C72 __fptrap
|
||||
0001:4D08 __ftol
|
||||
0001:3000 __growseg
|
||||
0001:308C __incseg
|
||||
0003:07E8 __indefinite
|
||||
0003:080E __infinity
|
||||
0001:4AFE __Init80x87
|
||||
0003:06B9 __intno
|
||||
0001:40DF __LD12MULT
|
||||
0001:400A __LD12MULTTENPOWER
|
||||
0003:0888 __lnjmptab
|
||||
0003:0818 __logemax
|
||||
0003:0870 __logjmptab
|
||||
0001:4264 __MANTOLD12
|
||||
0003:0A40 __matherr_flag
|
||||
0001:2F0E __myalloc
|
||||
0003:0695 __nfile
|
||||
0001:2F3A __nfree
|
||||
0003:0654 __nheap_desc
|
||||
0001:2F5B __nmalloc
|
||||
0001:2EAC __NMSG_TEXT
|
||||
0001:2ED7 __NMSG_WRITE
|
||||
0001:2C78 __nullcheck
|
||||
0003:0693 __oserr
|
||||
0003:0697 __osfile
|
||||
0003:0690 __osmajor
|
||||
0003:0691 __osminor
|
||||
0003:0692 __osmode
|
||||
0003:0690 __osversion
|
||||
0003:06B8 __ovlflag
|
||||
0003:06BA __ovlvec
|
||||
0003:06B1 __pgmptr
|
||||
0003:07F2 __piby2
|
||||
0001:46C4 __positive
|
||||
0003:068E __psp
|
||||
0003:068C __pspadr
|
||||
0001:351A __rtbignan
|
||||
0001:3549 __rtchsifneg
|
||||
0001:3540 __rtifprojnpop
|
||||
0001:3521 __rtifprojpop
|
||||
0001:352B __rtindfnpop
|
||||
0001:3528 __rtindfpop
|
||||
0001:366B __rtinfnpop
|
||||
0001:35FE __rtinfnpopse
|
||||
0001:3668 __rtinfpop
|
||||
0001:35FB __rtinfpopse
|
||||
0001:34FD __rtnospop
|
||||
0001:3501 __rtnospopde
|
||||
0001:3513 __rtonenpop
|
||||
0001:3510 __rtonepop
|
||||
0001:3500 __rttosnpop
|
||||
0001:3539 __rttosnpopde
|
||||
0001:34FA __rttospop
|
||||
0001:34F7 __rttospopde
|
||||
0001:3509 __rtzeronpop
|
||||
0001:3506 __rtzeropop
|
||||
0001:2F84 __searchseg
|
||||
0001:2C9C __setargv
|
||||
0001:2E2E __setenvp
|
||||
0003:06E2 __sigintoff
|
||||
0003:06E0 __sigintseg
|
||||
0003:08CA __sinjmptab
|
||||
0001:431E __STRINGTOD
|
||||
0001:4386 __STRINGTOLD
|
||||
0003:08FA __tanjmptab
|
||||
0001:3452 __trandisp1
|
||||
0001:3494 __trandisp2
|
||||
0003:068A __umaskval
|
||||
0001:336A __wrt2err
|
||||
0003:0840 __ytoxjmptab
|
||||
0003:0A4A ___aDBexit
|
||||
0003:0A50 ___aDBptrchk
|
||||
0003:0A48 ___aDBrterr
|
||||
0003:0A46 ___aDBswpchk
|
||||
0003:0A44 ___aDBswpflg
|
||||
0003:06AB ___argc
|
||||
0003:06AD ___argv
|
||||
0003:0A42 ___qczrinit
|
||||
|
||||
Address Publics by Value
|
||||
|
||||
0000:0632 Abs FISRQQ
|
||||
0000:0E32 Abs FICRQQ
|
||||
0000:1632 Abs FIERQQ
|
||||
0000:4000 Abs FJARQQ
|
||||
0000:5C32 Abs FIDRQQ
|
||||
0000:8000 Abs FJSRQQ
|
||||
0000:9876 Abs __acrtmsg
|
||||
0000:9876 Abs __acrtused
|
||||
0000:9876 Abs __fltused
|
||||
0000:A23D Abs FIWRQQ
|
||||
0000:C000 Abs FJCRQQ
|
||||
0000:D6D6 Abs __aDBdoswp
|
||||
0000:FE32 Abs FIARQQ
|
||||
0001:0000 ARAND
|
||||
0001:006B ADDHEAD
|
||||
0001:00D0 REMHEAD
|
||||
0001:0136 REMOVE
|
||||
0001:0195 INITOBJECTS
|
||||
0001:029D ACCELERATE
|
||||
0001:02F2 DRAWOBJECT
|
||||
0001:0513 SETRESTART
|
||||
0001:0547 HIT
|
||||
0001:0630 EXPLODE
|
||||
0001:0787 HITPLAYER
|
||||
0001:08E8 CREATELETTER
|
||||
0001:0A44 DRAWLETTERS
|
||||
0001:0AD2 DRAWHUNTERSHOTS
|
||||
0001:0BAC FIREHUNTERSHOT
|
||||
0001:0C8A CREATEHUNTER
|
||||
0001:0D5E DRAWHUNTERS
|
||||
0001:0F98 CREATESPINNER
|
||||
0001:107D DRAWSPINNERS
|
||||
0001:12D3 CREATEROID
|
||||
0001:13D9 BREAKROID
|
||||
0001:15AC DRAWROIDS
|
||||
0001:16C5 DRAWSHOTS
|
||||
0001:1754 DRAWFLAMES
|
||||
0001:17E3 FIRESHOT
|
||||
0001:18B6 ACCELPLAYER
|
||||
0001:198E DRAWPLAYER
|
||||
0001:1AB6 DRAWOBJECTS
|
||||
0001:1B94 CHECKSCORE
|
||||
0001:1C13 RESTARTHYPEROID
|
||||
0001:1D51 PANIC
|
||||
0001:1DF2 PAINTHYPEROID
|
||||
0001:1E41 ERASEHYPEROIDBKGND
|
||||
0001:1ECA HYPEROIDWNDPROC
|
||||
0001:214C INITHYPEROID
|
||||
0001:21CC EXITHYPEROID
|
||||
0001:2222 WINMAIN
|
||||
0001:22D8 PRINTLETTERS
|
||||
0001:23AC CREATEHYPEROIDPALETTE
|
||||
0001:2595 CREATEHYPEROIDCLASS
|
||||
0001:2616 SETHYPEROIDMENU
|
||||
0001:268F CREATEHYPEROIDWINDOW
|
||||
0001:2790 SAVEHYPEROIDWINDOWPOS
|
||||
0001:28AA HYPEROIDHELP
|
||||
0001:28D9 HYPEROIDABOUTDLG
|
||||
0001:296C ABOUTHYPEROID
|
||||
0001:29D0 __astart
|
||||
0001:2A93 __cintDIV
|
||||
0001:2AA3 __amsg_exit
|
||||
0001:2AC5 __dataseg
|
||||
0001:2AC8 __cinit
|
||||
0001:2B8D _exit
|
||||
0001:2B94 __exit
|
||||
0001:2B9C __cexit
|
||||
0001:2BA6 __c_exit
|
||||
0001:2C10 __ctermsub
|
||||
0001:2C50 __FF_MSGBANNER
|
||||
0001:2C72 __fptrap
|
||||
0001:2C78 __nullcheck
|
||||
0001:2C9C __setargv
|
||||
0001:2E2E __setenvp
|
||||
0001:2EAC __NMSG_TEXT
|
||||
0001:2ED7 __NMSG_WRITE
|
||||
0001:2F0E __myalloc
|
||||
0001:2F34 _malloc
|
||||
0001:2F3A __nfree
|
||||
0001:2F5B __nmalloc
|
||||
0001:2F84 __searchseg
|
||||
0001:3000 __growseg
|
||||
0001:308C __incseg
|
||||
0001:30DD __findlast
|
||||
0001:30FE _strcpy
|
||||
0001:3130 _strcmp
|
||||
0001:315C _strlen
|
||||
0001:3178 _atoi
|
||||
0001:317C _atof
|
||||
0001:31C2 __catox
|
||||
0001:3216 __fptostr
|
||||
0001:3286 __DOSDEVCONFIG
|
||||
0001:329D __DOSGETMACHINEMODE
|
||||
0001:32B2 __DOSSETVEC
|
||||
0001:32BB __DOSCREATECSALIAS
|
||||
0001:32D1 __DOSFREESEG
|
||||
0001:32DA __DOSWRITE
|
||||
0001:32F4 _memmove
|
||||
0001:333C _memset
|
||||
0001:336A __wrt2err
|
||||
0001:3386 __aFldiv
|
||||
0001:3420 __aFulmul
|
||||
0001:3420 __aFlmul
|
||||
0001:3452 __trandisp1
|
||||
0001:3494 __trandisp2
|
||||
0001:34F7 __rttospopde
|
||||
0001:34FA __rttospop
|
||||
0001:34FD __rtnospop
|
||||
0001:3500 __rttosnpop
|
||||
0001:3501 __rtnospopde
|
||||
0001:3506 __rtzeropop
|
||||
0001:3509 __rtzeronpop
|
||||
0001:3510 __rtonepop
|
||||
0001:3513 __rtonenpop
|
||||
0001:351A __rtbignan
|
||||
0001:3521 __rtifprojpop
|
||||
0001:3528 __rtindfpop
|
||||
0001:352B __rtindfnpop
|
||||
0001:3539 __rttosnpopde
|
||||
0001:3540 __rtifprojnpop
|
||||
0001:3549 __rtchsifneg
|
||||
0001:3552 fFYTOX
|
||||
0001:355E __fFEXP
|
||||
0001:35FB __rtinfpopse
|
||||
0001:35FE __rtinfnpopse
|
||||
0001:360B __fFLN
|
||||
0001:3668 __rtinfpop
|
||||
0001:366B __rtinfnpop
|
||||
0001:3686 __ffexpm1
|
||||
0001:36D7 __fFCOS
|
||||
0001:36F0 __fFSIN
|
||||
0001:382E $i8_output
|
||||
0001:3AEF $i8_tpwr10
|
||||
0001:3B44 $I10_OUTPUT
|
||||
0001:400A __LD12MULTTENPOWER
|
||||
0001:40DF __LD12MULT
|
||||
0001:4264 __MANTOLD12
|
||||
0001:431E __STRINGTOD
|
||||
0001:4386 __STRINGTOLD
|
||||
0001:45EE __forcdecpt
|
||||
0001:4656 __cropzeros
|
||||
0001:46C4 __positive
|
||||
0001:46F2 __fassign
|
||||
0001:474E __cftoe
|
||||
0001:489C __cftof
|
||||
0001:49B2 __cftog
|
||||
0001:4A64 __cfltcvt
|
||||
0001:4ADE _sin
|
||||
0001:4AE4 _cos
|
||||
0001:4AE9 _tan
|
||||
0001:4AEE __aFCIsin
|
||||
0001:4AF4 __aFCIcos
|
||||
0001:4AF9 __aFCItan
|
||||
0001:4AFE __Init80x87
|
||||
0001:4B79 __cintrindisp2
|
||||
0001:4BA2 __cintrindisp1
|
||||
0001:4BC4 __ctrandisp2
|
||||
0001:4BD7 __ctrandisp1
|
||||
0001:4D08 __aFftol
|
||||
0001:4D08 __ftol
|
||||
0001:4D3C __fltin
|
||||
0001:4D92 __fltout
|
||||
0001:4DD8 __fpsignal
|
||||
0001:4E30 _matherr
|
||||
0001:4E40 __cldtoe
|
||||
0001:4FCE __cldtof
|
||||
0001:510C __cldtog
|
||||
0001:517A __cldcvt
|
||||
0001:51D0 __atold
|
||||
0001:5200 __EmDataSeg
|
||||
0001:5210 __fpemulatorbegin
|
||||
0001:523A __fpmath
|
||||
0001:54DE __FPEXCEPTION87
|
||||
0001:5A7F __fpemulator
|
||||
0001:786F __fpemulatorend
|
||||
0001:787A __FPINSTALL87
|
||||
0001:78A9 __FPTERMINATE87
|
||||
0002:0169 __fptaskdata
|
||||
0003:0042 __anullsize
|
||||
0003:0250 _LetterPart
|
||||
0003:0284 _szNumberDesc
|
||||
0003:0298 _szLetterDesc
|
||||
0003:064E __atopsp
|
||||
0003:0650 __aexit_rtn
|
||||
0003:0652 __asizds
|
||||
0003:0654 __nheap_desc
|
||||
0003:0668 __aseghi
|
||||
0003:066A __aseglo
|
||||
0003:066C __acfinfo
|
||||
0003:067A __aintdiv
|
||||
0003:067E __fac
|
||||
0003:0688 _errno
|
||||
0003:068A __umaskval
|
||||
0003:068C __pspadr
|
||||
0003:068E __psp
|
||||
0003:0690 __osversion
|
||||
0003:0690 __dosvermajor
|
||||
0003:0690 __osmajor
|
||||
0003:0691 __osminor
|
||||
0003:0691 __dosverminor
|
||||
0003:0692 __osmode
|
||||
0003:0693 __oserr
|
||||
0003:0693 __doserrno
|
||||
0003:0695 __nfile
|
||||
0003:0697 __osfile
|
||||
0003:06AB ___argc
|
||||
0003:06AD ___argv
|
||||
0003:06AF _environ
|
||||
0003:06B1 __pgmptr
|
||||
0003:06B6 __child
|
||||
0003:06B8 __ovlflag
|
||||
0003:06B9 __intno
|
||||
0003:06BA __ovlvec
|
||||
0003:06BE __adbgmsg
|
||||
0003:06C6 __amblksiz
|
||||
0003:06C8 __cfltcvt_tab
|
||||
0003:06E0 __sigintseg
|
||||
0003:06E2 __sigintoff
|
||||
0003:06E4 __asizeC
|
||||
0003:06E5 __asizeD
|
||||
0003:06E6 __ctype_
|
||||
0003:06E6 __ctype
|
||||
0003:07E8 __indefinite
|
||||
0003:07F2 __piby2
|
||||
0003:07FC __cpower
|
||||
0003:080E __infinity
|
||||
0003:0818 __logemax
|
||||
0003:0840 __ytoxjmptab
|
||||
0003:0870 __logjmptab
|
||||
0003:0888 __lnjmptab
|
||||
0003:08A0 __expjmptab
|
||||
0003:08CA __sinjmptab
|
||||
0003:08E2 __cosjmptab
|
||||
0003:08FA __tanjmptab
|
||||
0003:0912 __cotanjmptab
|
||||
0003:09A4 __80x87
|
||||
0003:0A38 _HUGE
|
||||
0003:0A40 __matherr_flag
|
||||
0003:0A42 ___qczrinit
|
||||
0003:0A44 ___aDBswpflg
|
||||
0003:0A46 ___aDBswpchk
|
||||
0003:0A48 ___aDBrterr
|
||||
0003:0A4A ___aDBexit
|
||||
0003:0A50 ___aDBptrchk
|
||||
0003:0A54 __fpinit
|
||||
0003:0C6C _edata
|
||||
0003:0CE0 _LetterList
|
||||
0003:0CE4 PLOCALHEAP
|
||||
0003:0CE6 _nSafe
|
||||
0003:0CE8 _HunterShotList
|
||||
0003:0CEC _npPlayer
|
||||
0003:0CEE _nCos
|
||||
0003:0EEE _Obj
|
||||
0003:3086 _FlameList
|
||||
0003:308A _wTick
|
||||
0003:308C _nLevel
|
||||
0003:308E _hPen
|
||||
0003:30AE _hAppInst
|
||||
0003:30B0 _HunterList
|
||||
0003:30B4 _SpinnerList
|
||||
0003:30B8 _lScore
|
||||
0003:30BC _nSin
|
||||
0003:32BC _nBadGuys
|
||||
0003:32BE _bRestart
|
||||
0003:32C0 _hAppWnd
|
||||
0003:32C2 _FreeList
|
||||
0003:32C6 _bPaused
|
||||
0003:32C8 _nGravity
|
||||
0003:32CA _ShotList
|
||||
0003:32CE _RoidList
|
||||
0003:32D2 _hAppPalette
|
||||
0003:32D4 _szAppName
|
||||
0003:32F4 _nShield
|
||||
0003:3300 _end
|
||||
|
||||
Program entry point at 0001:29D0
|
||||
|
||||
: error L2029: 'ENDDIALOG' : unresolved external
|
||||
: error L2029: 'ISZOOMED' : unresolved external
|
||||
: error L2029: '_main' : unresolved external
|
||||
: error L2029: 'GETPRIVATEPROFILEINT' : unresolved external
|
||||
: error L2029: 'SELECTPALETTE' : unresolved external
|
||||
: error L2029: 'CREATEWINDOW' : unresolved external
|
||||
: error L2029: 'SETBRUSHORG' : unresolved external
|
||||
: error L2029: 'MULDIV' : unresolved external
|
||||
: error L2029: 'MULDIV' : unresolved external
|
||||
: error L2029: '_wsprintf' : unresolved external
|
||||
: error L2029: '_wsprintf' : unresolved external
|
||||
: error L2029: 'GETPRIVATEPROFILESTRING' : unresolved external
|
||||
: error L2029: 'GETASYNCKEYSTATE' : unresolved external
|
||||
: error L2029: 'RELEASEDC' : unresolved external
|
||||
: error L2029: 'DELETEDC' : unresolved external
|
||||
: error L2029: 'POSTQUITMESSAGE' : unresolved external
|
||||
: error L2029: 'MESSAGEBOX' : unresolved external
|
||||
: error L2029: 'UPDATEWINDOW' : unresolved external
|
||||
: error L2029: 'LOADSTRING' : unresolved external
|
||||
: error L2029: 'GETDC' : unresolved external
|
||||
: error L2029: 'MAKEPROCINSTANCE' : unresolved external
|
||||
: error L2029: 'GETCURRENTTIME' : unresolved external
|
||||
: error L2029: 'FREEPROCINSTANCE' : unresolved external
|
||||
: error L2029: 'CREATEIC' : unresolved external
|
||||
: error L2029: 'SETMAPMODE' : unresolved external
|
||||
: error L2029: 'FILLRECT' : unresolved external
|
||||
: error L2029: 'LOADICON' : unresolved external
|
||||
: error L2029: 'REGISTERCLASS' : unresolved external
|
||||
: error L2029: 'LOADCURSOR' : unresolved external
|
||||
: error L2029: 'GETSYSTEMMENU' : unresolved external
|
||||
: error L2029: 'WRITEPRIVATEPROFILESTRING' : unresolved external
|
||||
: error L2029: 'DRAWICON' : unresolved external
|
||||
: error L2029: 'CREATEPEN' : unresolved external
|
||||
: error L2029: 'CREATESOLIDBRUSH' : unresolved external
|
||||
: error L2029: 'SETVIEWPORTORG' : unresolved external
|
||||
: error L2029: 'ENDPAINT' : unresolved external
|
||||
: error L2029: 'TRANSLATEMESSAGE' : unresolved external
|
||||
: error L2029: 'GETMESSAGE' : unresolved external
|
||||
: error L2029: 'SETWINDOWEXT' : unresolved external
|
||||
: error L2029: 'PTINRECT' : unresolved external
|
||||
: error L2029: 'GETDEVICECAPS' : unresolved external
|
||||
: error L2029: 'DELETEOBJECT' : unresolved external
|
||||
: error L2029: 'KILLTIMER' : unresolved external
|
||||
: error L2029: 'DISPATCHMESSAGE' : unresolved external
|
||||
: error L2029: 'SETVIEWPORTEXT' : unresolved external
|
||||
: error L2029: 'DEFWINDOWPROC' : unresolved external
|
||||
: error L2029: 'SHOWWINDOW' : unresolved external
|
||||
: error L2029: 'SHOWWINDOW' : unresolved external
|
||||
: error L2029: 'GETCLIENTRECT' : unresolved external
|
||||
: error L2029: 'INVALIDATERECT' : unresolved external
|
||||
: error L2029: 'SELECTOBJECT' : unresolved external
|
||||
: error L2029: 'GETINSTANCEDATA' : unresolved external
|
||||
: error L2029: 'SETTIMER' : unresolved external
|
||||
: error L2029: 'BEGINPAINT' : unresolved external
|
||||
: error L2029: 'CHANGEMENU' : unresolved external
|
||||
: error L2029: 'GETWINDOWRECT' : unresolved external
|
||||
: error L2029: 'CREATEPALETTE' : unresolved external
|
||||
: error L2029: 'POLYLINE' : unresolved external
|
||||
: error L2029: 'DIALOGBOX' : unresolved external
|
||||
: error L2029: 'REALIZEPALETTE' : unresolved external
|
||||
: error L2029: 'SETPIXEL' : unresolved external
|
||||
: error L2029: 'GETSYSCOLOR' : unresolved external
|
||||
: error L2029: 'SETWINDOWTEXT' : unresolved external
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// HYPEROID.RC - orbiter resources
|
||||
//
|
||||
|
||||
#include <windows.h>
|
||||
#include "hyperoid.h"
|
||||
|
||||
IDI_HYPEROID ICON "hyperoid.ico"
|
||||
IDI_PANIC ICON "panic.ico"
|
||||
|
||||
STRINGTABLE
|
||||
{
|
||||
IDS_NAME, "Hyperoid"
|
||||
IDM_NEW, "New Game&!"
|
||||
IDM_ABOUT, "&About..."
|
||||
}
|
||||
|
||||
//
|
||||
// About box
|
||||
//
|
||||
|
||||
IDD_ABOUT DIALOG LOADONCALL MOVEABLE DISCARDABLE 30, 30, 150, 120
|
||||
CAPTION "About"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME | WS_POPUP
|
||||
{
|
||||
CTEXT "Hyperoid", -1, 0, 10, 150, 8
|
||||
CTEXT "The classic game", -1, 0, 20, 150, 8
|
||||
CTEXT "Version 1.1", -1, 0, 30, 150, 8
|
||||
CTEXT "Copyright © 1991 Hutchins Software", -1, 0, 45, 150, 8
|
||||
CTEXT "This program is freeware", -1, 0, 55, 150, 8
|
||||
CTEXT "Author: Edward Hutchins", -1, 0, 65, 150, 8
|
||||
CTEXT "eah1@cec1.wustl.edu", -1, 0, 75, 150, 8
|
||||
CTEXT "", IDD_A_HISCORE, 0, 85, 150, 8
|
||||
ICON IDI_HYPEROID, -1, 10, 16, 0, 0
|
||||
DEFPUSHBUTTON "Ok!", IDOK, 20, 100, 40, 12
|
||||
CONTROL "&Help", IDD_A_HELP, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 90, 100, 40, 12
|
||||
}
|
||||
|
||||
//
|
||||
// bitmaps
|
||||
//
|
||||
|
||||
IDB_blank BITMAP DISCARDABLE "blank.bmp"
|
||||
IDB_bomb BITMAP DISCARDABLE "bomb.bmp"
|
||||
IDB_level BITMAP DISCARDABLE "level.bmp"
|
||||
IDB_life BITMAP DISCARDABLE "life.bmp"
|
||||
IDB_num0 BITMAP DISCARDABLE "num0.bmp"
|
||||
IDB_num1 BITMAP DISCARDABLE "num1.bmp"
|
||||
IDB_num2 BITMAP DISCARDABLE "num2.bmp"
|
||||
IDB_num3 BITMAP DISCARDABLE "num3.bmp"
|
||||
IDB_num4 BITMAP DISCARDABLE "num4.bmp"
|
||||
IDB_num5 BITMAP DISCARDABLE "num5.bmp"
|
||||
IDB_num6 BITMAP DISCARDABLE "num6.bmp"
|
||||
IDB_num7 BITMAP DISCARDABLE "num7.bmp"
|
||||
IDB_num8 BITMAP DISCARDABLE "num8.bmp"
|
||||
IDB_num9 BITMAP DISCARDABLE "num9.bmp"
|
||||
IDB_plus BITMAP DISCARDABLE "plus.bmp"
|
||||
IDB_score BITMAP DISCARDABLE "score.bmp"
|
||||
IDB_shield BITMAP DISCARDABLE "shield.bmp"
|
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// LIST - list processing functions for orbiter
|
||||
//
|
||||
// Version: 1.0 Copyright (C) 1990, Hutchins Software
|
||||
// Author: Edward Hutchins
|
||||
// Revisions:
|
||||
//
|
||||
|
||||
#include "orbiter.h"
|
||||
|
||||
//
|
||||
// AddHead - add an object to the head of a list
|
||||
//
|
||||
|
||||
VOID FAR PASCAL AddHead( NPLIST npList, NPNODE npNode )
|
||||
{
|
||||
if (npList->npHead)
|
||||
{
|
||||
npNode->npNext = npList->npHead;
|
||||
npNode->npPrev = NULL;
|
||||
npList->npHead = (npList->npHead->npPrev = npNode);
|
||||
}
|
||||
else // add to an empty list
|
||||
{
|
||||
npList->npHead = npList->npTail = npNode;
|
||||
npNode->npNext = npNode->npPrev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// RemHead - remove the first element in a list
|
||||
//
|
||||
|
||||
NPNODE FAR PASCAL RemHead( NPLIST npList )
|
||||
{
|
||||
if (npList->npHead)
|
||||
{
|
||||
NPNODE npNode = npList->npHead;
|
||||
if (npList->npTail != npNode)
|
||||
{
|
||||
npList->npHead = npNode->npNext;
|
||||
npNode->npNext->npPrev = NULL;
|
||||
}
|
||||
else npList->npHead = npList->npTail = NULL;
|
||||
return( npNode );
|
||||
}
|
||||
else return( NULL );
|
||||
}
|
||||
|
||||
//
|
||||
// Remove - remove an arbitrary element from a list
|
||||
//
|
||||
|
||||
VOID FAR PASCAL Remove( NPLIST npList, NPNODE npNode )
|
||||
{
|
||||
if (npNode->npPrev) npNode->npPrev->npNext = npNode->npNext;
|
||||
else npList->npHead = npNode->npNext;
|
||||
if (npNode->npNext) npNode->npNext->npPrev = npNode->npPrev;
|
||||
else npList->npTail = npNode->npPrev;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
########################################################
|
||||
#
|
||||
# hyperoid makefile
|
||||
#
|
||||
# Copyright (C) 1988-1990 Lantern Corp.
|
||||
#
|
||||
########################################################
|
||||
|
||||
# This is just a teaser to show how little you have to do to make projects
|
||||
# under Lantern Corp.'s software engineering system. To make Hyperoid on
|
||||
# your system, make sure <winext.h> is in your include path and set up your
|
||||
# makefile like you normally do for your own stuff.
|
||||
# I'll (hopefully) post the 100k of stuff you need for this makefile to
|
||||
# be usefull. I'll have to talk to my boss first...
|
||||
# P.S. The system only works for the Mircosoft C6.0 compiler, but its easy
|
||||
# enough to change.
|
||||
# P.P.S. I hate every integrated environment I've run across so far, thus
|
||||
# the system is run from a command prompt.
|
||||
|
||||
PROJ = hyperoid
|
||||
OBJS = hyperoid.obj roidsupp.obj
|
||||
RESS = hyperoid.res
|
||||
LIBS =
|
||||
|
||||
!include <windows.mk>
|
||||
|
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |
After Width: | Height: | Size: 246 B |