summaryrefslogtreecommitdiff
path: root/emulators/palmosemulator
diff options
context:
space:
mode:
authordsainty <dsainty@pkgsrc.org>2003-01-05 03:31:25 +0000
committerdsainty <dsainty@pkgsrc.org>2003-01-05 03:31:25 +0000
commitb494ed5cbfc536022f6be5080f56cdb14527f030 (patch)
treeea8c61a866b00f5ae537a21687ee516f3bc5d839 /emulators/palmosemulator
parentdaf948e59eb23770985d20c8e4ab2105f3bdb0d0 (diff)
downloadpkgsrc-b494ed5cbfc536022f6be5080f56cdb14527f030.tar.gz
palmosemulator-3.5nb1. Pull in some changes suggested by Thomas Runge in
PR#19006: use the pkgsrc libjpeg instead of a local copy, and patch a bug in the serial device file descriptor handling. Also up the emulated "CPU idle" delay from 10ms to 100ms. For some reason the former saturates the CPU (on a Celeron 700 system), but with the latter the program idles at near 0%. This patch is probably not required for native threads. Mileage may vary...
Diffstat (limited to 'emulators/palmosemulator')
-rw-r--r--emulators/palmosemulator/Makefile24
-rw-r--r--emulators/palmosemulator/PLIST20
-rw-r--r--emulators/palmosemulator/distinfo11
-rw-r--r--emulators/palmosemulator/patches/patch-ab14
-rw-r--r--emulators/palmosemulator/patches/patch-ad37
-rw-r--r--emulators/palmosemulator/patches/patch-ae157
-rw-r--r--emulators/palmosemulator/patches/patch-ah36
-rw-r--r--emulators/palmosemulator/patches/patch-ai17
-rw-r--r--emulators/palmosemulator/patches/patch-aj19
9 files changed, 319 insertions, 16 deletions
diff --git a/emulators/palmosemulator/Makefile b/emulators/palmosemulator/Makefile
index 9edef82fe2b..07a92185fa8 100644
--- a/emulators/palmosemulator/Makefile
+++ b/emulators/palmosemulator/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.3 2003/01/04 22:19:31 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2003/01/05 03:31:25 dsainty Exp $
#
-DISTNAME= emulator_src_${PKGVERSION}
-PKGNAME= palmosemulator-3.5
+DISTNAME= emulator_src_${POSE_VERSION}
+PKGNAME= palmosemulator-${POSE_VERSION}
+PKGREVISION= 1
CATEGORIES= emulators x11
MASTER_SITES= http://www.palmos.com/dev/tools/emulator/sources/
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
@@ -12,6 +13,8 @@ MAINTAINER= dsainty@netbsd.org
HOMEPAGE= http://www.palmos.com/dev/tools/emulator/
COMMENT= Palm OS Emulator
+POSE_VERSION= 3.5
+
DIST_SUBDIR= ${PKGBASE}
# Source is under sources/ directory, skins are not...
@@ -19,7 +22,7 @@ SITES_emulator-skins-19.tar.gz= http://www.palmos.com/dev/tools/emulator/
#LICENSE= GPL
-WRKSRC= ${WRKDIR}/Emulator_Src_3.5
+WRKSRC= ${WRKDIR}/Emulator_Src_${POSE_VERSION}
POSE_BUILD_DIR= ${WRKSRC}/BuildUnix
POSE_SHARE_DIR= ${PREFIX}/share/palmosemulator
POSE_SKINS_DIR= ${POSE_SHARE_DIR}/skins
@@ -41,10 +44,22 @@ do-install:
${INSTALL_PROGRAM} ${POSE_BUILD_DIR}/pose ${PREFIX}/bin/pose
${INSTALL_DATA_DIR} ${POSE_SHARE_DIR}
${INSTALL_DATA_DIR} ${POSE_SHARE_DIR}/docs
+ ${INSTALL_DATA_DIR} ${POSE_SHARE_DIR}/scripting
${FIND} ${WRKSRC}/Docs -type f -print | \
while read i; do \
${INSTALL_DATA} "$$i" ${POSE_SHARE_DIR}/docs; \
done
+ for lang in Python Perl; do \
+ ddir="${POSE_SHARE_DIR}/scripting/$$lang"; \
+ ${INSTALL_SCRIPT_DIR} "$$ddir"; \
+ ${FIND} "${WRKSRC}/Scripting/$$lang" -type f -print | \
+ while read i; do \
+ case "$$i" in \
+ *.pl) ${INSTALL_SCRIPT} "$$i" "$$ddir";; \
+ *) ${INSTALL_DATA} "$$i" "$$ddir";; \
+ esac; \
+ done; \
+ done
${INSTALL_DATA} ${WRKSRC_SKINS}/ReadMe.txt ${POSE_SHARE_DIR}/docs/ReadMe_skins.txt
${INSTALL_DATA_DIR} ${POSE_SHARE_DIR}/prc
${INSTALL_DATA} ${WRKSRC}/ROMTransfer/Source/ROM_Transfer.prc ${POSE_SHARE_DIR}/prc
@@ -54,6 +69,7 @@ do-install:
${INSTALL_DATA} "$$i" ${POSE_SKINS_DIR}; \
done
+.include "../../graphics/jpeg/buildlink2.mk"
.include "../../lang/perl5/buildlink2.mk"
.include "../../x11/fltk/buildlink2.mk"
.include "../../mk/pthread.buildlink2.mk"
diff --git a/emulators/palmosemulator/PLIST b/emulators/palmosemulator/PLIST
index ddf2b7d7a00..305fa970cbf 100644
--- a/emulators/palmosemulator/PLIST
+++ b/emulators/palmosemulator/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
+@comment $NetBSD: PLIST,v 1.2 2003/01/05 03:31:25 dsainty Exp $
bin/pose
share/palmosemulator/docs/12rollin.pdf
share/palmosemulator/docs/13hewgil.pdf
@@ -16,6 +16,21 @@ share/palmosemulator/docs/_OldNews.txt
share/palmosemulator/docs/_ReadMe.txt
share/palmosemulator/docs/_ToDo.txt
share/palmosemulator/prc/ROM_Transfer.prc
+share/palmosemulator/scripting/Perl/EmFunctions.pm
+share/palmosemulator/scripting/Perl/EmRPC.pm
+share/palmosemulator/scripting/Perl/EmSysTraps.pm
+share/palmosemulator/scripting/Perl/EmUtils.pm
+share/palmosemulator/scripting/Perl/FormSpy.pl
+share/palmosemulator/scripting/Perl/HostControl.pm
+share/palmosemulator/scripting/Perl/HostControlTest.pl
+share/palmosemulator/scripting/Perl/ListDatabases.pl
+share/palmosemulator/scripting/Perl/ListOpenDatabases.pl
+share/palmosemulator/scripting/Perl/MakeSysTraps.pl
+share/palmosemulator/scripting/Perl/PoserRPC.pl
+share/palmosemulator/scripting/Perl/SkipStartup.pl
+share/palmosemulator/scripting/Python/Poser.py
+share/palmosemulator/scripting/Python/SysTraps.py
+share/palmosemulator/scripting/Python/Test.py
share/palmosemulator/skins/HandEra330.skin
share/palmosemulator/skins/HandEra330Cards.skin
share/palmosemulator/skins/HandEra330Cards_16.jpg
@@ -83,6 +98,9 @@ share/palmosemulator/skins/Workpad_c3.skin
share/palmosemulator/skins/Workpad_c3_16.jpg
share/palmosemulator/skins/Workpad_c3_32.jpg
@dirrm share/palmosemulator/skins
+@dirrm share/palmosemulator/scripting/Python
+@dirrm share/palmosemulator/scripting/Perl
+@dirrm share/palmosemulator/scripting
@dirrm share/palmosemulator/prc
@dirrm share/palmosemulator/docs
@dirrm share/palmosemulator
diff --git a/emulators/palmosemulator/distinfo b/emulators/palmosemulator/distinfo
index adce1d74da4..28a807b2836 100644
--- a/emulators/palmosemulator/distinfo
+++ b/emulators/palmosemulator/distinfo
@@ -1,13 +1,16 @@
-$NetBSD: distinfo,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
+$NetBSD: distinfo,v 1.2 2003/01/05 03:31:25 dsainty Exp $
SHA1 (palmosemulator/emulator_src_3.5.tar.gz) = 2debd7690736397d0af41f7b2d482df65391fc65
Size (palmosemulator/emulator_src_3.5.tar.gz) = 3162363 bytes
SHA1 (palmosemulator/emulator-skins-19.tar.gz) = 70b0497061d6877a4e3c6a378fa647c64fe3e019
Size (palmosemulator/emulator-skins-19.tar.gz) = 2443913 bytes
SHA1 (patch-aa) = eef35ce5c3d91bf56903bb48c0c78bd333591fcc
-SHA1 (patch-ab) = 7019049a50432317283cfe8b57fc042879fddf20
+SHA1 (patch-ab) = 8e097f4c45ad9e5402a9d4019cfb86137ada9732
SHA1 (patch-ac) = c00a821d390ab92b28a01a47e7934eed4261fe6f
-SHA1 (patch-ad) = 71b971e6961134fe179609602b709e7a5ef62605
-SHA1 (patch-ae) = 93ac777942b85b0abf3310c833406b6d24771f39
+SHA1 (patch-ad) = 6ad0beceb03bed0f51383331715a160b16c04ffd
+SHA1 (patch-ae) = eff843f8603b14791d3363a13634fb482e996ee5
SHA1 (patch-af) = 746c83222cd847d6383fe9484ac81366b083ad22
SHA1 (patch-ag) = 9d4fba5f8bef808b8a00b71484c308da613d8140
+SHA1 (patch-ah) = e3a79fa2c376711ea6479907cca923d1e872683e
+SHA1 (patch-ai) = 0cbff6b3080ee9aa7e366ba4ba368d93f0560e04
+SHA1 (patch-aj) = 958f070f7bc19f6a4c2f12a9d0ba280ed64136cb
diff --git a/emulators/palmosemulator/patches/patch-ab b/emulators/palmosemulator/patches/patch-ab
index 5a49b4c747b..498fcd01671 100644
--- a/emulators/palmosemulator/patches/patch-ab
+++ b/emulators/palmosemulator/patches/patch-ab
@@ -1,4 +1,7 @@
-$NetBSD: patch-ab,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
+$NetBSD: patch-ab,v 1.2 2003/01/05 03:31:25 dsainty Exp $
+
+Use the libjpeg package, instead of a local copy, and pass through the skins
+directory.
--- BuildUnix/configure.orig Sat Nov 23 23:54:59 2002
+++ BuildUnix/configure Sun Nov 24 00:57:08 2002
@@ -14,6 +17,15 @@ $NetBSD: patch-ab,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
*-nto*)
THREAD_FLAGS="-D_REENTRANT -DPthreadDraftVersion=10"
THREAD_LIBS=""
+@@ -3598,7 +3603,7 @@
+
+
+ save_LIBS="$LIBS"
+-LIBS="-lfltk ${GLLIB} -L${ac_x_libraries} -lXext -lX11 -lm $X_EXTRA_LIBS $LIBS"
++LIBS="-ljpeg -lfltk ${GLLIB} -L${ac_x_libraries} -lXext -lX11 -lm $X_EXTRA_LIBS $LIBS"
+
+ ac_ext=C
+ # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -3853,6 +3858,7 @@
s%@CXXCPP@%$CXXCPP%g
s%@GLLIB@%$GLLIB%g
diff --git a/emulators/palmosemulator/patches/patch-ad b/emulators/palmosemulator/patches/patch-ad
index e950c3499ab..615e209a33d 100644
--- a/emulators/palmosemulator/patches/patch-ad
+++ b/emulators/palmosemulator/patches/patch-ad
@@ -1,4 +1,7 @@
-$NetBSD: patch-ad,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
+$NetBSD: patch-ad,v 1.2 2003/01/05 03:31:25 dsainty Exp $
+
+Use the libjpeg package, instead of a local copy, and pass through the skins
+directory.
--- BuildUnix/Makefile.in.orig Sat Mar 30 01:11:21 2002
+++ BuildUnix/Makefile.in Sun Nov 24 02:24:49 2002
@@ -10,14 +13,42 @@ $NetBSD: patch-ad,v 1.1.1.1 2002/12/31 06:59:54 dsainty Exp $
POSER_CFLAGS = @POSER_CFLAGS@
POSER_CXXFLAGS = @POSER_CXXFLAGS@
RANLIB = @RANLIB@
-@@ -85,8 +86,8 @@
+@@ -78,16 +79,16 @@
+ THREAD_SRC = @THREAD_SRC@
+ VERSION = @VERSION@
+
+-SUBDIRS = Gzip jpeg espws-2.0
++SUBDIRS = Gzip espws-2.0
+
+ SUFFIXES = .cpp
+
VPATH = $(srcdir)/../SrcUnix: $(srcdir)/../SrcShared: $(srcdir)/../SrcShared/Hardware: $(srcdir)/../SrcShared/Hardware/TRG: $(srcdir)/../SrcShared/omnithread: $(srcdir)/../SrcShared/Palm/Platform/Core/System/Src: $(srcdir)/../SrcShared/Patches: $(srcdir)/../SrcShared/UAE:
-CFLAGS = $(POSER_CFLAGS) $(LOCAL_CFLAGS) $(FLAGS) $(THREAD_FLAGS) $(X_CFLAGS)
-CXXFLAGS = $(POSER_CXXFLAGS) $(LOCAL_CFLAGS) $(FLAGS) $(THREAD_FLAGS) $(X_CFLAGS)
+-INCLUDES = -I$(srcdir)/../SrcShared -I$(srcdir)/../SrcShared/Hardware -I$(srcdir)/../SrcShared/Hardware/TRG -I$(srcdir)/../SrcShared/Palm/Device -I$(srcdir)/../SrcShared/Palm/Platform -I$(srcdir)/../SrcShared/Palm/Platform/Core/Hardware/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Core/System/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Incs -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/Hardware -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/System -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/UI -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Libraries -I$(srcdir)/../SrcShared/Gzip -I$(srcdir)/../SrcShared/jpeg -I$(srcdir)/../SrcShared/omnithread -I$(srcdir)/../SrcShared/Patches -I$(srcdir)/../SrcShared/UAE -I$(srcdir)/../SrcUnix -I$(srcdir)/../SrcUnix/espws-2.0
+CFLAGS = $(POSER_CFLAGS) $(LOCAL_CFLAGS) $(FLAGS) $(THREAD_FLAGS) $(PACKAGE_SKINS_FLAGS) $(X_CFLAGS)
+CXXFLAGS = $(POSER_CXXFLAGS) $(LOCAL_CFLAGS) $(FLAGS) $(THREAD_FLAGS) $(PACKAGE_SKINS_FLAGS) $(X_CFLAGS)
- INCLUDES = -I$(srcdir)/../SrcShared -I$(srcdir)/../SrcShared/Hardware -I$(srcdir)/../SrcShared/Hardware/TRG -I$(srcdir)/../SrcShared/Palm/Device -I$(srcdir)/../SrcShared/Palm/Platform -I$(srcdir)/../SrcShared/Palm/Platform/Core/Hardware/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Core/System/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Incs -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/Hardware -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/System -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/UI -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Libraries -I$(srcdir)/../SrcShared/Gzip -I$(srcdir)/../SrcShared/jpeg -I$(srcdir)/../SrcShared/omnithread -I$(srcdir)/../SrcShared/Patches -I$(srcdir)/../SrcShared/UAE -I$(srcdir)/../SrcUnix -I$(srcdir)/../SrcUnix/espws-2.0
++INCLUDES = -I$(srcdir)/../SrcShared -I$(srcdir)/../SrcShared/Hardware -I$(srcdir)/../SrcShared/Hardware/TRG -I$(srcdir)/../SrcShared/Palm/Device -I$(srcdir)/../SrcShared/Palm/Platform -I$(srcdir)/../SrcShared/Palm/Platform/Core/Hardware/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Core/System/IncsPrv -I$(srcdir)/../SrcShared/Palm/Platform/Incs -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/Hardware -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/System -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/UI -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Libraries -I$(srcdir)/../SrcShared/Gzip -I$(srcdir)/../SrcShared/omnithread -I$(srcdir)/../SrcShared/Patches -I$(srcdir)/../SrcShared/UAE -I$(srcdir)/../SrcUnix -I$(srcdir)/../SrcUnix/espws-2.0
SRC_UNIX = EmApplicationFltk.cpp EmApplicationFltk.h EmCommonUnix.h EmDirRefUnix.cpp EmDirRefUnix.h EmDlgFltk.cpp EmDlgFltk.h EmDocumentUnix.cpp EmDocumentUnix.h EmFileRefUnix.cpp EmFileRefUnix.h EmMenusFltk.cpp EmMenusFltk.h EmPixMapUnix.cpp EmPixMapUnix.h EmTransportSerialUnix.cpp EmTransportSerialUnix.h EmTransportUSBUnix.cpp EmTransportUSBUnix.h EmWindowFltk.cpp EmWindowFltk.h Platform_Unix.cpp jconfig.h
+
+@@ -115,7 +116,7 @@
+ @SOLARIS_FALSE@SRC_THREAD = posix.cpp
+
+ bin_PROGRAMS = pose
+-pose_LDADD = $(srcdir)/Gzip/libposergzip.a $(srcdir)/jpeg/libposerjpeg.a $(srcdir)/espws-2.0/libposerespws.a -lfltk -L/usr/local/lib $(X_LIBS) -lXext -lX11 $(THREAD_LIBS) $(GLLIB) -lm
++pose_LDADD = $(srcdir)/Gzip/libposergzip.a $(srcdir)/espws-2.0/libposerespws.a -lfltk -ljpeg $(X_LIBS) -lXext -lX11 $(THREAD_LIBS) $(GLLIB) -lm
+ pose_SOURCES = $(SRC_UNIX) $(SRC_UNIX_GEN) $(SRC_SHARED) $(SRC_SHARED_HARDWARE) $(SRC_PATCHES) $(SRC_TRG) $(SRC_UAE) $(SRC_PALM) $(SRC_THREAD)
+ CLEANFILES = ResStrings.cpp EmDlgFltkFactory.h EmDlgFltkFactory.cpp config.cache config.log
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -222,7 +223,7 @@
+ @SOLARIS_FALSE@EmTRGSD.o cpudefs.o cpuemu.o cpustbl.o readcpu.o Crc.o \
+ @SOLARIS_FALSE@posix.o
+ pose_DEPENDENCIES = $(srcdir)/Gzip/libposergzip.a \
+-$(srcdir)/jpeg/libposerjpeg.a $(srcdir)/espws-2.0/libposerespws.a
++$(srcdir)/espws-2.0/libposerespws.a
+ pose_LDFLAGS =
+ CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+ CXXLD = $(CXX)
diff --git a/emulators/palmosemulator/patches/patch-ae b/emulators/palmosemulator/patches/patch-ae
index ba648f8e115..cfea6fd87c2 100644
--- a/emulators/palmosemulator/patches/patch-ae
+++ b/emulators/palmosemulator/patches/patch-ae
@@ -1,7 +1,10 @@
-$NetBSD: patch-ae,v 1.1.1.1 2002/12/31 06:59:56 dsainty Exp $
+$NetBSD: patch-ae,v 1.2 2003/01/05 03:31:25 dsainty Exp $
-Without this patch, ROM transfers tend to not get very far due to consistently
-lost characters.
+Without the first hunk of this patch, ROM transfers tend to not get very far
+due to consistently lost characters.
+
+The remainder corrects an assumption in the code that 0 is an invalid file
+handle, and registers NetBSD-style tty device names.
--- SrcUnix/EmTransportSerialUnix.cpp.orig Sat Mar 30 01:11:19 2002
+++ SrcUnix/EmTransportSerialUnix.cpp Sun Nov 24 05:42:39 2002
@@ -14,3 +17,151 @@ lost characters.
// The UNIX Programming FAQ (<www://www.faqs.org/faqs/unix-faq/programmer/faq/>)
// recommends just setting all the c_iflags and c_oflags to zero.
+@@ -541,6 +541,20 @@
+ #ifdef __QNXNTO__
+ results.push_back ("/dev/ser1");
+ results.push_back ("/dev/ser2");
++#elif __FreeBSD__
++ results.push_back ("/dev/pilot");
++ results.push_back ("/dev/cuaa0");
++ results.push_back ("/dev/cuaa1");
++ results.push_back ("/dev/cuaa2");
++ results.push_back ("/dev/cuaa3");
++#elif __NetBSD__
++ results.push_back ("/dev/pilot");
++ results.push_back ("/dev/tty00");
++ results.push_back ("/dev/tty01");
++ results.push_back ("/dev/tty02");
++ results.push_back ("/dev/tty03");
++ results.push_back ("/dev/ttyU0");
++ results.push_back ("/dev/ttyU1");
+ #else
+ results.push_back ("/dev/ttyS0");
+ results.push_back ("/dev/ttyS1");
+@@ -596,9 +610,9 @@
+ EmHostTransportSerial::EmHostTransportSerial (void) :
+ fReadThread (NULL),
+ fWriteThread (NULL),
+- fCommHandle (0),
+- fCommSignalPipeA (0),
+- fCommSignalPipeB (0),
++ fCommHandle (-1),
++ fCommSignalPipeA (-1),
++ fCommSignalPipeB (-1),
+ fTimeToQuit (false),
+ fDataMutex (),
+ fDataCondition (&fDataMutex),
+@@ -626,9 +640,9 @@
+ {
+ EmAssert (fReadThread == NULL);
+ EmAssert (fWriteThread == NULL);
+- EmAssert (fCommHandle == 0);
+- EmAssert (fCommSignalPipeA == 0);
+- EmAssert (fCommSignalPipeB == 0);
++ EmAssert (fCommHandle == -1);
++ EmAssert (fCommSignalPipeA == -1);
++ EmAssert (fCommSignalPipeB == -1);
+ }
+
+
+@@ -662,9 +676,9 @@
+
+ fCommHandle = open(portName.c_str (), O_RDWR | O_NOCTTY | O_NDELAY);
+
+- if (fCommHandle <= 0)
++ if (fCommHandle < 0)
+ {
+- fCommHandle = 0;
++ fCommHandle = -1;
+
+ return errno;
+ }
+@@ -694,7 +708,7 @@
+
+ ErrCode EmHostTransportSerial::CreateCommThreads (const EmTransportSerial::ConfigSerial& /*config*/)
+ {
+- if (fCommHandle)
++ if (fCommHandle != -1)
+ {
+ PRINTF ("EmTransportSerial::HostOpen: Creating serial port handler threads...");
+
+@@ -734,40 +748,41 @@
+ {
+ // If never created, nothing to destroy.
+
+- if (!fCommSignalPipeA)
++ if (fCommSignalPipeA == -1)
+ return errNone;
+
+ // Signal the threads to quit.
+
+- fDataMutex.lock ();
+-
+- fTimeToQuit = true;
+-
+- int dummy = 0;
+- write (fCommSignalPipeB, &dummy, sizeof (dummy)); // Signals CommRead.
+-
+- fDataCondition.broadcast (); // Signals CommWrite.
+- fDataMutex.unlock ();
++ if((fCommSignalPipeA != -1) && (fCommSignalPipeB != -1))
++ {
++ fDataMutex.lock();
+
+- // Wait for the threads to quit.
++ fTimeToQuit = true;
+
+- if (fReadThread)
+- {
+- fReadThread->join (NULL);
+- fWriteThread->join (NULL);
+- }
++ int dummy = 0;
++ write(fCommSignalPipeB, &dummy, sizeof (dummy)); // Signals CommRead.
+
+- // Thread objects delete themselves, so set our references to NULL.
++ fDataCondition.broadcast(); // Signals CommWrite.
++ fDataMutex.unlock();
+
+- fReadThread = NULL;
+- fWriteThread = NULL;
++ // Wait for the threads to quit.
+
+- // Close the signal pipe.
++ if (fReadThread)
++ {
++ fReadThread->join (NULL);
++ fWriteThread->join (NULL);
++ }
+
+- close (fCommSignalPipeA);
+- close (fCommSignalPipeB);
++ // Thread objects delete themselves, so set our references to NULL.
++ fReadThread = NULL;
++ fWriteThread = NULL;
++
++ // Close the signal pipe.
++ close (fCommSignalPipeA);
++ close (fCommSignalPipeB);
+
+- fCommSignalPipeA = fCommSignalPipeB = 0;
++ fCommSignalPipeA = fCommSignalPipeB = -1;
++ }
+
+ return errNone;
+ }
+@@ -787,9 +802,11 @@
+
+ ErrCode EmHostTransportSerial::CloseCommPort (void)
+ {
+- (void) close (fCommHandle);
+-
+- fCommHandle = 0;
++ if(fCommHandle != -1)
++ {
++ int result = close(fCommHandle);
++ fCommHandle = -1;
++ }
+
+ return errNone;
+ }
diff --git a/emulators/palmosemulator/patches/patch-ah b/emulators/palmosemulator/patches/patch-ah
new file mode 100644
index 00000000000..5d3d2c095b9
--- /dev/null
+++ b/emulators/palmosemulator/patches/patch-ah
@@ -0,0 +1,36 @@
+$NetBSD: patch-ah,v 1.1 2003/01/05 03:31:25 dsainty Exp $
+
+Use the libjpeg package, instead of a local copy.
+
+--- BuildUnix/Makefile.am.orig Sat Mar 30 01:11:19 2002
++++ BuildUnix/Makefile.am Wed Jan 1 17:27:26 2003
+@@ -4,7 +4,7 @@
+ ## All rights reserved.
+ ## ======================================================================================
+
+-SUBDIRS = Gzip jpeg espws-2.0
++SUBDIRS = Gzip espws-2.0
+
+ SUFFIXES = .cpp
+
+@@ -37,7 +37,6 @@
+ INCLUDES += -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Core/UI
+ INCLUDES += -I$(srcdir)/../SrcShared/Palm/Platform/Incs/Libraries
+ INCLUDES += -I$(srcdir)/../SrcShared/Gzip
+-INCLUDES += -I$(srcdir)/../SrcShared/jpeg
+ INCLUDES += -I$(srcdir)/../SrcShared/omnithread
+ INCLUDES += -I$(srcdir)/../SrcShared/Patches
+ INCLUDES += -I$(srcdir)/../SrcShared/UAE
+@@ -403,10 +402,10 @@
+ bin_PROGRAMS = pose
+
+ pose_LDADD = $(srcdir)/Gzip/libposergzip.a
+-pose_LDADD += $(srcdir)/jpeg/libposerjpeg.a
+ pose_LDADD += $(srcdir)/espws-2.0/libposerespws.a
++pose_LDADD += -ljpeg
+ pose_LDADD += -lfltk
+-pose_LDADD += -L/usr/local/lib $(X_LIBS) -lXext -lX11 $(THREAD_LIBS) $(GLLIB) -lm
++pose_LDADD += $(X_LIBS) -lXext -lX11 $(THREAD_LIBS) $(GLLIB) -lm
+
+ pose_SOURCES = $(SRC_UNIX) $(SRC_UNIX_GEN) $(SRC_SHARED) $(SRC_SHARED_HARDWARE)
+ pose_SOURCES += $(SRC_PATCHES) $(SRC_TRG) $(SRC_UAE) $(SRC_PALM) $(SRC_THREAD)
diff --git a/emulators/palmosemulator/patches/patch-ai b/emulators/palmosemulator/patches/patch-ai
new file mode 100644
index 00000000000..1dd028779cb
--- /dev/null
+++ b/emulators/palmosemulator/patches/patch-ai
@@ -0,0 +1,17 @@
+$NetBSD: patch-ai,v 1.1 2003/01/05 03:31:25 dsainty Exp $
+
+jinclude.h is not part of the libjpeg interface, and isn't available from the
+pkgsrc libjpeg installation. But we need to include <stdio.h> ourselves for
+the benefit of "jpeglib.h".
+
+--- SrcShared/EmJPEG.h.orig Sat Mar 30 01:11:14 2002
++++ SrcShared/EmJPEG.h Wed Jan 1 18:05:36 2003
+@@ -30,7 +30,7 @@
+
+ extern "C"
+ {
+- #include "jinclude.h"
++ #include <stdio.h>
+ #include "jpeglib.h"
+ #include "jerror.h"
+ }
diff --git a/emulators/palmosemulator/patches/patch-aj b/emulators/palmosemulator/patches/patch-aj
new file mode 100644
index 00000000000..0baa7606953
--- /dev/null
+++ b/emulators/palmosemulator/patches/patch-aj
@@ -0,0 +1,19 @@
+$NetBSD: patch-aj,v 1.1 2003/01/05 03:31:26 dsainty Exp $
+
+This patch changes the idle CPU wait time from 10ms to 100ms. For some reason
+the former saturates the CPU (on a Celeron 700 system), but with the latter
+the program idles at near 0%. This patch is probably not required for native
+threads.
+
+--- SrcUnix/Platform_Unix.cpp.orig Sat Mar 30 01:11:19 2002
++++ SrcUnix/Platform_Unix.cpp Sun Jan 5 15:01:21 2003
+@@ -598,7 +598,8 @@
+ // Wait on an event instead of just calling Sleep(10) so that another
+ // thread can wake us up before our time.
+
+- omni_thread::sleep( 0, 10000 ); // 10k nanoseconds = 1/100 sec
++ // pkgsrc: updated 10k to 100k, makes a huge difference to CPU usage
++ omni_thread::sleep( 0, 100000 ); // 10k nanoseconds = 1/100 sec
+ }
+
+