aboutsummaryrefslogtreecommitdiff
path: root/Scripting
diff options
context:
space:
mode:
Diffstat (limited to 'Scripting')
-rw-r--r--Scripting/Perl/EmFunctions.pm1023
-rw-r--r--Scripting/Perl/EmRPC.pm1285
-rw-r--r--Scripting/Perl/EmSysTraps.pm997
-rw-r--r--Scripting/Perl/EmUtils.pm228
-rwxr-xr-xScripting/Perl/FormSpy.pl98
-rw-r--r--Scripting/Perl/HostControl.pm897
-rw-r--r--Scripting/Perl/HostControlTest.pl87
-rwxr-xr-xScripting/Perl/ListDatabases.pl30
-rwxr-xr-xScripting/Perl/ListOpenDatabases.pl53
-rw-r--r--Scripting/Perl/MakeSysTraps.pl88
-rwxr-xr-xScripting/Perl/PoserRPC.pl313
-rwxr-xr-xScripting/Perl/SkipStartup.pl43
-rw-r--r--Scripting/Python/Poser.py471
-rw-r--r--Scripting/Python/SysTraps.py895
-rw-r--r--Scripting/Python/Test.py132
15 files changed, 6640 insertions, 0 deletions
diff --git a/Scripting/Perl/EmFunctions.pm b/Scripting/Perl/EmFunctions.pm
new file mode 100644
index 0000000..4454ff7
--- /dev/null
+++ b/Scripting/Perl/EmFunctions.pm
@@ -0,0 +1,1023 @@
+########################################################################
+#
+# File: EmFunctions.pm
+#
+# Purpose: Perl wrappers for Palm OS functions
+#
+# Description: This file contains Perl equivalents of Palm OS
+# functions like DmNumDatabases, FrmGetActiveForm,
+# etc. Currently, the functions here are generated
+# by hand, and so only a small subset of Palm OS
+# functions are wrapped. In the future, this file
+# (or files) may be automatically generated by
+# a script that converts the SDK headers.
+#
+# In general, functions follow the calling
+# conventions in the SDK headers. However, there
+# are exceptions. See the comments before each
+# subroutine for details.
+#
+########################################################################
+
+package EmFunctions;
+
+use EmRPC;
+use EmSysTraps;
+
+use strict;
+use vars qw(@ISA @EXPORT);
+
+use Exporter;
+@ISA = qw(Exporter);
+
+@EXPORT = qw(
+ CtlGetLabel
+
+ DmNumDatabases DmFindDatabase DmGetDatabase DmDatabaseInfo
+ DmNextOpenDatabase DmOpenDatabaseInfo
+
+ EvtEnqueuePenPoint EvtEnqueueKey
+
+ FrmGetActiveForm FrmGetLabel FrmGetNumberOfObjects FrmGetObjectBounds
+ FrmGetObjectId FrmGetObjectIndex FrmGetObjectPtr FrmGetObjectType FrmGetTitle
+
+ FtrGet
+
+ HwrDisplayAttributes
+
+ MemChunkFree MemPtrFree MemPtrNew MemPtrSetOwner MemStoreInfo MemCardInfo
+ MemNumCards MemNumHeaps MemNumRAMHeaps
+ MemHeapID MemHeapDynamic MemHeapFlags MemHeapSize
+
+ SysUIAppSwitch SysCurAppDatabase
+
+ WinDisplayToWindowPt WinWindowToDisplayPt
+
+ dmModeReadOnly dmModeWrite dmModeReadWrite
+ dmModeLeaveOpen dmModeExclusive dmModeShowSecret
+
+ frmFieldObj frmControlObj frmListObj frmTableObj frmBitmapObj frmLineObj
+ frmFrameObj frmRectangleObj frmLabelObj frmTitleObj frmPopupObj
+ frmGraffitiStateObj frmGadgetObj frmScrollBarObj
+
+ hwrDispType hwrDispRev hwrDispVers hwrDispAllDepths hwrDispMaxDepth
+ hwrDispBootDepth hwrDispMaxGrays hwrDispHorizontal hwrDispVertical hwrDispVRAMBaseAddr
+ hwrDispVRAMSize hwrDispColor hwrDispName hwrDispBaseAddr hwrDispDepth
+ hwrDispWidth hwrDispHeight hwrDispRowBytes hwrDispBacklight hwrDispBrightness
+ hwrDispContrast hwrDispDbgIndicator hwrDispEndAddr hwrDispBufferMask hwrDispResolutionX
+ hwrDispResolutionY hwrDispMemAccessOK
+);
+
+use constant dmModeReadOnly => 0x01;
+use constant dmModeWrite => 0x02;
+use constant dmModeReadWrite => 0x03;
+use constant dmModeLeaveOpen => 0x04;
+use constant dmModeExclusive => 0x08;
+use constant dmModeShowSecret => 0x10;
+
+use constant frmFieldObj => 0;
+use constant frmControlObj => 1;
+use constant frmListObj => 2;
+use constant frmTableObj => 3;
+use constant frmBitmapObj => 4;
+use constant frmLineObj => 5;
+use constant frmFrameObj => 6;
+use constant frmRectangleObj => 7;
+use constant frmLabelObj => 8;
+use constant frmTitleObj => 9;
+use constant frmPopupObj => 10;
+use constant frmGraffitiStateObj => 11;
+use constant frmGadgetObj => 12;
+use constant frmScrollBarObj => 13;
+
+use constant hwrDispType => 0; # (4) Get 4-char code for controller/display combination.
+use constant hwrDispRev => 1; # (2) Get Hardware Revision
+use constant hwrDispVers => 2; # (2) Get Display driver HAL version.
+use constant hwrDispAllDepths => 3; # (2) Get All display depths in bitmap format.
+use constant hwrDispMaxDepth => 4; # (2) Get Maximum supported bit depth.
+use constant hwrDispBootDepth => 5; # (2) The preset boot depth of the device.
+use constant hwrDispMaxGrays => 6; # (2) Get Maximum number of grays supported by HW.
+use constant hwrDispHorizontal => 7; # (2) Get Maximum hortizontal pixels supported by Display.
+use constant hwrDispVertical => 8; # (2) Get Maximum vertical pixels supported by Display.
+use constant hwrDispVRAMBaseAddr => 9; # (4) Get Base address of video memory if any (if 0, no VRAM)
+use constant hwrDispVRAMSize => 10; # (4) Get Size of VRAM (if 0, no VRAM)
+use constant hwrDispColor => 11; # (2) Get True if controller AND display supprt color.
+use constant hwrDispName => 12; #(32) Get 32 character string for controller and Hardware.
+
+use constant hwrDispBaseAddr => 13; # (4) Get/Set Base Address for current screen memory (somewhere in VRAM or main RAM)
+use constant hwrDispDepth => 14; # (2) Get/Set Depth of display
+use constant hwrDispWidth => 15; # (2) Get/Set current display width
+use constant hwrDispHeight => 16; # (2) Get/Set current display height
+use constant hwrDispRowBytes => 17; # (2) Get/Set bytes in a row of display (changed when depth or width change)
+use constant hwrDispBacklight => 18; # (1) Get/Set Backlight status: 0 = off, 1 = on (returns 0 on Austin)
+use constant hwrDispBrightness => 19; # (1) Get/Set Brightness level: 0(min/off)...255(max)
+use constant hwrDispContrast => 20; # (1) Get/Set Contrast Level: 0(min)...255(max)
+use constant hwrDispDbgIndicator => 21; # (2) Turn Debug Indicator on/off
+use constant hwrDispEndAddr => 22; # (4) Get last byte of screen memory
+use constant hwrDispBufferMask => 23; # (4) Mask for determining required display address alignment
+use constant hwrDispResolutionX => 24; # (?) Screen resolution
+use constant hwrDispResolutionY => 25; # (?) Screen resolution
+use constant hwrDispMemAccessOK => 26; # (1) true if controller can be accessed when bus clock disabled
+
+
+########################################################################
+#
+# FUNCTION: CtlGetLabel
+#
+# DESCRIPTION: Return a string pointer to the control's text label.
+#
+# PARAMETERS: Memory address on the remote device of the control
+# object. Usually the result of something like
+# FrmGetObjectPtr on a control object.
+#
+# RETURNED: A list containing the memory address on the remote
+# device of the label, and the label string itself.
+#
+########################################################################
+
+sub CtlGetLabel
+{
+ # const Char* CtlGetLabel (const ControlType * ctlP)
+
+ my ($return, $format) = ("string", "rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapCtlGetLabel, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmNumDatabases
+#
+# DESCRIPTION: Returns the number of databases on a card
+#
+# PARAMETERS: card number
+#
+# RETURNS: Number of databases found
+#
+########################################################################
+
+sub DmNumDatabases
+{
+ # UInt DmNumDatabases (UInt cardNo)
+
+ my ($return, $format) = ("int16", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmNumDatabases, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmDatabaseInfo
+#
+# DESCRIPTION: Retrieves database information
+#
+# PARAMETERS: Card number, database LocalID
+#
+# RETURNS: Result code from function, as well as the components
+# of a hash. To get the result, assign the result
+# of this function to ($err, %results). You can
+# then extract individual values from %results using
+# hash operators and the following keys: name
+# attributes, version, crDate, modDate, bckUpDate,
+# modNum, appInfoID, sortInfoID, type, and creator.
+# Example: $name = $results{name}.
+#
+########################################################################
+
+sub DmDatabaseInfo
+{
+ # Err DmDatabaseInfo (UInt cardNo, LocalID dbID, const CharPtr nameP,
+ # UIntPtr attributesP, UIntPtr versionP, ULongPtr crDateP,
+ # ULongPtr modDateP, ULongPtr bckUpDateP,
+ # ULongPtr modNumP, LocalID* appInfoIDP,
+ # LocalID* sortInfoIDP, ULongPtr typeP,
+ # ULongPtr creatorP)
+
+ my ($cardNo, $dbID) = @_;
+
+ my ($format) = "int16 LocalID string32 int16* int16* int32* int32* " .
+ "int32* int32* LocalID* LocalID* int32* int32*";
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmDatabaseInfo, $format,
+ $cardNo, $dbID, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ ($D0, name => $params[2],
+ attributes => $params[3],
+ version => $params[4],
+ crDate => $params[5],
+ modDate => $params[6],
+ bckUpDate => $params[7],
+ modNum => $params[8],
+ appInfoID => $params[9],
+ sortInfoID => $params[10],
+ type => $params[11],
+ creator => $params[12]);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmFindDatabase
+#
+# DESCRIPTION: Searches for a database by name
+#
+# PARAMETERS: card number, database name
+#
+# RETURNS: LocalID of database header
+#
+########################################################################
+
+sub DmFindDatabase
+{
+ # LocalID DmFindDatabase (UInt cardNo, const CharPtr nameP)
+
+ my ($return, $format) = ("LocalID", "int16 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmFindDatabase, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmGetDatabase
+#
+# DESCRIPTION: Finds the nth database on the card
+#
+# PARAMETERS: card number, database index
+#
+# RETURNS: LocalID of database header
+#
+########################################################################
+
+sub DmGetDatabase
+{
+ # LocalID DmGetDatabase (UInt16 cardNo, Uint16 index)
+
+ my ($return, $format) = ("LocalID", "int16 int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmGetDatabase, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmNextOpenDatabase
+#
+# DESCRIPTION: Returns the next open database
+#
+# PARAMETERS: A DmOpenRef (or 0 the first time)
+#
+# RETURNS: The next DmOpenRef, or 0 at the end of the chain
+#
+########################################################################
+
+sub DmNextOpenDatabase
+{
+ # DmOpenRef DmNextOpenDatabase (DmOpenRef currentP)
+
+ my ($return, $format) = ("rptr", "rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmNextOpenDatabase, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: DmOpenDatabaseInfo
+#
+# DESCRIPTION: Retrieves database information
+#
+# PARAMETERS: DmOpenRef
+#
+# RETURNS: Result code from function, as well as the components
+# of a hash. To get the result, assign the result
+# of this function to ($err, %results). You can
+# then extract individual values from %results using
+# hash operators and the following keys: cardNo, dbID,
+# openCount, mode, resDB.
+# Example: $name = $results{name}.
+#
+########################################################################
+
+sub DmOpenDatabaseInfo
+{
+ # Err DmOpenDatabaseInfo (DmOpenRef dbP, LocalID *dbIDP,
+ # UInt16 *openCountP, UInt16 *modeP, UInt16 *cardNoP,
+ # Boolean *resDBP)
+
+ my ($format) = "rptr LocalID* int16* int16* int16* int16*";
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapDmOpenDatabaseInfo, $format, @_, 0, 0, 0, 0, 0);
+
+ ($D0, dbID => $params[1],
+ openCount => $params[2],
+ mode => $params[3],
+ cardNo => $params[4],
+ resDB => $params[5]);
+}
+
+
+########################################################################
+#
+# FUNCTION: EvtEnqueuePenPoint
+#
+# DESCRIPTION: Called by the digitizer interrupt routine to enqueue
+# a pen coordinate into the pen queue.
+#
+# PARAMETERS: x and y coordinates, subtracted from 256.
+# Example: EvtEnqueuePoint (256 - 100, 256 - 80)
+# Pass in (-1, -1) to enqueue a Pen Up.
+#
+# RETURNS: size of queue in bytes
+#
+########################################################################
+
+sub EvtEnqueuePenPoint
+{
+ # Err EvtEnqueuePenPoint (PointType* ptP)
+
+ my ($return, $format) = ("Err", "point");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapEvtEnqueuePenPoint, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: EvtEnqueueKey
+#
+# DESCRIPTION: Called by the digitizer interrupt routine to enqueue
+# a key into the key queue.
+#
+# PARAMETERS: WChar ascii, UInt16 keycode, UInt16 modifiers
+#
+# RETURNS: size of queue in bytes
+#
+########################################################################
+
+sub EvtEnqueueKey
+{
+ # Err EvtEnqueueKey (WChar ascii, UInt16 keycode, UInt16 modifiers)
+
+ my ($return, $format) = ("Err", "int16 int16 int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapEvtEnqueueKey, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetActiveForm
+#
+# DESCRIPTION: This routine returns the currently active form.
+#
+# PARAMETERS: nothing
+#
+# RETURNED: Memory address on the remote device of the form.
+#
+########################################################################
+
+sub FrmGetActiveForm
+{
+ # FormPtr FrmGetActiveForm (void)
+
+ my ($return, $format) = ("rptr", "");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetActiveForm, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetLabel
+#
+# DESCRIPTION: This routine return the text of the specified label object
+# in the specified form.
+#
+# PARAMETERS: formP - memory block that contains the form.
+# labelID - id of the label object.
+#
+# RETURNED: A list containing the memory address on the remote
+# device of the label, and the label string itself.
+#
+########################################################################
+
+sub FrmGetLabel
+{
+ # CharPtr FrmGetLabel (const FormPtr frm, const Word lableID)
+
+ my ($return, $format) = ("string", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetLabel, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetNumberOfObjects
+#
+# DESCRIPTION: This routine returns the number of objects in a form.
+#
+# PARAMETERS: formP memory block that contains the form.
+#
+# RETURNED: number of object in the form specified
+#
+########################################################################
+
+sub FrmGetNumberOfObjects
+{
+ # Word FrmGetNumberOfObjects (const FormPtr frm)
+
+ my ($return, $format) = ("int16", "rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetNumberOfObjects, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetObjectBounds
+#
+# DESCRIPTION: This routine returns the bounds of the specified form object
+#
+# PARAMETERS: formP memory block that contains the form.
+# objIndex index of the object
+#
+# RETURNS: The components of a hash. To get the result, assign
+# the result of this function to %results. You can
+# then extract individual values from %results using
+# hash operators and the following keys: top, left
+# bottom, right, width, height.
+# Example: $top = $results{top}.
+#
+########################################################################
+
+sub FrmGetObjectBounds
+{
+ # void FrmGetObjectBounds (const FormPtr frm, const Word pObjIndex, const RectanglePtr r)
+
+ my ($form, $obj_index) = @_;
+
+ my ($return, $format) = ("", "rptr int16 rect");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetObjectBounds, $format,
+ $form, $obj_index, {});
+
+ my ($foo) = $params[2];
+ %$foo;
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetObjectId
+#
+# DESCRIPTION: This routine returns the id of the object specified.
+# An id is a value specified by the application developer
+# that uniquely identifies an object.
+#
+# PARAMETERS: formP memory block that contains the form.
+# objIndex item number of the object
+#
+# RETURNED: Object ID.
+#
+########################################################################
+
+sub FrmGetObjectId
+{
+ # UInt16 FrmGetObjectId (const FormType * formP, UInt16 objIndex)
+
+ my ($return, $format) = ("int16", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetObjectId, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetObjectIndex
+#
+# DESCRIPTION: This routine returns the item number of an object, the
+# item number is the position of the object in the objects
+# list.
+#
+# PARAMETERS: formP memory block that contains the form.
+# objId id of an object in the form.
+#
+# RETURNED: item number of an object (the first item number is 0).
+#
+########################################################################
+
+sub FrmGetObjectIndex
+{
+ # UInt16 FrmGetObjectIndex (const FormType * formP, UInt16 objId)
+
+ my ($return, $format) = ("int16", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetObjectIndex, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetObjectPtr
+#
+# DESCRIPTION: This routine returns a pointer to the data structure of an
+# object in a form.
+#
+# PARAMETERS: formP memory block that contains the form.
+# objIndex item number of the object
+#
+# RETURNED: Memory address on the remote device of the object.
+# The contents of the object depend on the object type.
+#
+########################################################################
+
+sub FrmGetObjectPtr
+{
+ # VoidPtr FrmGetObjectPtr (const FormPtr frm, const Word objIndex)
+
+ my ($return, $format) = ("rptr", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetObjectPtr, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetObjectType
+#
+# DESCRIPTION: This routine returns the type of an object.
+#
+# PARAMETERS: formP memory block that contains the form.
+# objIndex item number of the object
+#
+# RETURNED: FormObjectType of the item specified
+#
+########################################################################
+
+sub FrmGetObjectType
+{
+ # FormObjectKind FrmGetObjectType (const FormPtr frm, const Word objIndex)
+
+ my ($return, $format) = ("int16", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetObjectType, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FrmGetTitle
+#
+# DESCRIPTION: This routine returns a pointer to the title string of a
+# form.
+#
+# PARAMETERS: formP - memory block that contains the form.
+#
+# RETURNED: A list containing the memory address on the remote
+# device of the title, and the title string itself.
+#
+########################################################################
+
+sub FrmGetTitle
+{
+ # const Char * FrmGetTitle (const FormType * formP)
+
+ my ($return, $format) = ("string", "rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFrmGetTitle, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: FtrGet
+#
+# DESCRIPTION: Get a PalmOS feature setting
+#
+# PARAMETERS: creator - creator id
+# featureNum - number of feature requested
+#
+# RETURNS: Result code and value of feature
+#
+########################################################################
+
+sub FtrGet
+{
+ # Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP)
+
+ my ($creator, $featureNum) = @_;
+
+ my ($return, $format) = ("Err", "int32 int16 int32*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapFtrGet, $format, $creator, $featureNum, 0);
+ ($D0, $params[2]);
+}
+
+
+########################################################################
+#
+# FUNCTION: HwrDisplayAttributes
+#
+# DESCRIPTION: Get or set Info about the Hwr display and controller
+#
+# PARAMETERS: set - true to set, false to get. Ignored for read-only attributes
+# attr - HwrDisplayAttrType
+# dataP - data to get or set. Must be non-NULL, as read-only
+# attributes are always read, regardless of 'set' param.
+#
+# RETURNS:
+#
+########################################################################
+
+sub HwrDisplayAttributes
+{
+ # Err HwrDisplayAttributes(Boolean set, HwrDisplayAttrType attr, void* dataP)
+
+ my ($set, $attr, $data) = @_;
+
+ my ($return, $format) = ("Err", "int8 int8 block");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHwrDisplayAttributes, $format, $set, $attr, $data);
+ ($D0, $params[2]);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemChunkFree
+#
+# DESCRIPTION: Disposes of a chunk
+#
+# PARAMETERS: Pointer to chunk
+#
+# RETURNS: 0 if no error
+#
+########################################################################
+
+sub MemChunkFree
+{
+ my ($return, $format) = ("Err", "rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemChunkFree, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemPtrFree
+#
+# DESCRIPTION: Disposes of a chunk
+#
+# PARAMETERS: Pointer to chunk
+#
+# RETURNS: 0 if no error
+#
+########################################################################
+
+sub MemPtrFree
+{
+ MemChunkFree (@_);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemPtrNew
+#
+# DESCRIPTION: Allocates a non-movable chunk in the dynamic heap
+#
+# PARAMETERS: requested size of chunk
+#
+# RETURNS: Ptr to chunk, or 0 if error
+#
+########################################################################
+
+sub MemPtrNew
+{
+ my ($return, $format) = ("rptr", "int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemPtrNew, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemPtrSetOwner
+#
+# DESCRIPTION: Sets the owner ID of a chunk
+#
+# PARAMETERS: chunk data pointer
+#
+# RETURNS: 0 if no error
+#
+########################################################################
+
+sub MemPtrSetOwner
+{
+ # Err MemPtrSetOwner (void* p, UInt16 owner)
+
+ my ($return, $format) = ("Err", "rptr int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemPtrSetOwner, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/*******************************************************************
+#
+# FUNCTION: MemStoreInfo
+#
+# DESCRIPTION: Returns information on either the RAM store or
+# the ROM store for a memory card.
+#
+# PARAMETERS: 1) cardNo - either 0 or 1
+# 2) storeNumber - 0 for ROM, 1 for RAM
+# 3) versionP - Pointer to version variable, or 0.
+# 4) flagsP - Pointer to flags variable, or 0.
+# 5) nameP - Pointer to character array (32 bytes), or 0.
+# 6) crDateP - Pointer to creation date variable, or 0.
+# 7) bckUpDateP - Pointer to backup date variable, or 0.
+# 8) heapListOffsetP - Pointer to heapListOffset variable, or 0.
+# 9) initCodeOffset1P - Pointer to initCodeOffset1 variable, or 0.
+# 10) initCodeOffset2P - Pointer to initCodeOffset2 variable, or 0.
+# 11) databaseDirIDP - Pointer to database directory chunk ID variable, or 0.
+#
+# RETURNS: 0 if no error, error number otherwise
+#
+#*******************************************************************/
+sub MemStoreInfo
+{
+ my ($cardNo, $storeNumber) = @_;
+ my ($return, $format) = ("Err", "int16 int16 int16* int16* string int32* int32* int32* int32* int32* LocalID*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemStoreInfo, $format, $cardNo, $storeNumber, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ ($D0, version => $params[2],
+ flags => $params[3],
+ name => $params[4],
+ crDate => $params[5],
+ bckUpDate => $params[6],
+ heapListOffset => $params[7],
+ initCodeOffset1 => $params[8],
+ initCodeOffset2 => $params[9],
+ databaseDirID => $params[10]);
+}
+
+
+#/*******************************************************************
+#
+# FUNCTION: MemCardInfo
+#
+# DESCRIPTION: Returns information on either the RAM store or
+# the ROM store for a memory card.
+#
+# PARAMETERS:
+#
+# RETURNS: 0 if no error, error number otherwise
+#
+#*******************************************************************/
+sub MemCardInfo
+{
+ my ($cardNo) = @_;
+ my ($return, $format) = ("Err", "int16 string32 string32 int16* int32* int32* int32* int32*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC(EmSysTraps::sysTrapMemCardInfo, $format, $cardNo, 0, 0, 0, 0, 0, 0, 0);
+
+ ($D0, cardName => $params[1],
+ manufName => $params[2],
+ version => $params[3],
+ crDate => $params[4],
+ romSize => $params[5],
+ ramSize => $params[6],
+ freeBytes => $params[7]);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemNumCards
+#
+# DESCRIPTION: Counts the cards on the device.
+#
+# PARAMETERS: none
+#
+# RETURNS: Usually 1. :-)
+#
+########################################################################
+sub MemNumCards
+{
+ my ($return, $format) = ("int16", "");
+ my ($D0, $A0) = EmRPC::DoRPC (EmSysTraps::sysTrapMemNumCards, $format);
+ EmRPC::ReturnValue ($return, $D0, $A0);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemNumHeaps
+#
+# DESCRIPTION: Counts the heaps on the given card.
+#
+# PARAMETERS: Card number
+#
+# RETURNS: How many
+#
+########################################################################
+sub MemNumHeaps
+{
+ my ($return, $format) = ("int16", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemNumHeaps, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemNumRAMHeaps
+#
+# DESCRIPTION: Counts the RAM heaps on the given card.
+#
+# PARAMETERS: Card number
+#
+# RETURNS: How many
+#
+########################################################################
+sub MemNumRAMHeaps
+{
+ my ($return, $format) = ("int16", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemNumRAMHeaps, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemHeapID
+#
+# DESCRIPTION: Returns the heap ID of the j'th heap on the i'th card.
+#
+# PARAMETERS: Card number, heap index
+#
+# RETURNS: A heap ID
+#
+########################################################################
+sub MemHeapID
+{
+ my ($return, $format) = ("int16", "int16 int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemHeapID, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemHeapDynamic
+#
+# DESCRIPTION: Returns whether the given heap is dynamic.
+#
+# PARAMETERS: A heap ID
+#
+# RETURNS: Boolean
+#
+########################################################################
+sub MemHeapDynamic
+{
+ my ($return, $format) = ("int16", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemHeapDynamic, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemHeapFlags
+#
+# DESCRIPTION: Returns the given heap's flags.
+#
+# PARAMETERS: A heap ID
+#
+# RETURNS: The flags
+#
+########################################################################
+sub MemHeapFlags
+{
+ my ($return, $format) = ("int16", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemHeapFlags, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: MemHeapSize
+#
+# DESCRIPTION: Returns the size of the given heap.
+#
+# PARAMETERS: A heap ID
+#
+# RETURNS: The size
+#
+########################################################################
+sub MemHeapSize
+{
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapMemHeapSize, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: SysUIAppSwitch
+#
+# DESCRIPTION: Tries to make the current UI application quit and
+# then launches the given UI application by card
+# number and database ID.
+#
+# PARAMETERS: cardNo, dbID, launchCmd, cmdPBP
+#
+# Note that in order to utilize the cmdPBP, you need
+# to first create a buffer on the remote side with
+# MemPtrNew and fill in its contents with
+# EmRPC::WriteBlock. If you want to pass NULL for
+# cmdPBP, specify zero for the last parameter.
+#
+# RETURNS: errNone if no err
+#
+########################################################################
+
+sub SysUIAppSwitch
+{
+ # Err SysUIAppSwitch(UInt16 cardNo, LocalID dbID, UInt16 cmd, MemPtr cmdPBP)
+
+ my ($return, $format) = ("Err", "int16 LocalID int16 rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapSysUIAppSwitch, $format, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/*******************************************************************
+#
+# FUNCTION: SysCurAppDatabase
+#
+# DESCRIPTION:
+#
+# PARAMETERS:
+#
+# RETURNS:
+#
+#*******************************************************************/
+sub SysCurAppDatabase {
+ my ($return, $format) = ("Err", "int16* LocalID*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC(EmSysTraps::sysTrapSysCurAppDatabase, $format, 0, 0);
+
+ ($D0, cardNum => $params[0],
+ databaseID => $params[1]);
+}
+
+
+########################################################################
+#
+# FUNCTION: WinDisplayToWindowPt
+#
+# DESCRIPTION: This routine converts a display-relative coordinate to
+# a window-relative coordinate. The coordinate returned is
+# relative to the draw window.
+#
+# PARAMETERS: xP <-> x coordinate to convert
+# yP <-> y coordinate to convert
+#
+# RETURNED: nothing
+#
+########################################################################
+
+sub WinDisplayToWindowPt
+{
+ # void WinDisplayToWindowPt (Coord * xP, Coord * yP)
+
+ my ($return, $format) = ("void", "Coord* Coord*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapWinDisplayToWindowPt, $format, @_);
+ ($params[0], $params[1]);
+}
+
+
+########################################################################
+#
+# FUNCTION: WinWindowToDisplayPt
+#
+# DESCRIPTION: This routine converts a window-relative coordinate to
+# a display-relative coordinate. The coordinate passed is
+# assumed to be relative to the draw window.
+#
+# PARAMETERS: xP <-> x coordinate to convert
+# yP <-> y coordinate to convert
+#
+# RETURNED: nothing
+#
+########################################################################
+
+sub WinWindowToDisplayPt
+{
+ # void WinWindowToDisplayPt (Coord * xP, Coord * yP)
+
+ my ($return, $format) = ("void", "Coord* Coord*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapWinWindowToDisplayPt, $format, @_);
+ ($params[0], $params[1]);
+}
+
+1;
diff --git a/Scripting/Perl/EmRPC.pm b/Scripting/Perl/EmRPC.pm
new file mode 100644
index 0000000..d02433d
--- /dev/null
+++ b/Scripting/Perl/EmRPC.pm
@@ -0,0 +1,1285 @@
+########################################################################
+#
+# File: EmRPC.pm
+#
+# Purpose: Low-level functions for using RPC with the Palm OS
+# Emulator.
+#
+# Description: This file contains base functions for using RPC:
+#
+# OpenConnection
+# Opens a socket to the Emulator
+#
+# CloseConnection
+# Closes the socket
+#
+# DoRPC
+# Full-service RPC packet sending and receiving,
+# including marshalling and unmarshalling of
+# parameters.
+#
+# ReadBlock
+# Read up to 256 bytes from the remote device's
+# memory.
+#
+# WriteBlock
+# Write up to 256 bytes to the remote device's
+# memory.
+#
+# ReadString
+# Read a C string from the remote device's memory.
+#
+# PrintString
+# Debugging utility. Prints a Perl string
+# (block of arbitrary data) as a hex dump.
+#
+########################################################################
+
+package EmRPC;
+
+use vars qw(@ISA @EXPORT);
+
+use Exporter;
+$VERSION = 1.00;
+@ISA = qw(Exporter);
+
+@EXPORT = qw(
+ OpenConnection CloseConnection
+ DoRPC
+ ReadBlock WriteBlock
+ ReadString PrintString
+);
+
+use IO::Socket;
+use IO::File;
+
+use constant slkSocketDebugger => 0; # Debugger Socket
+use constant slkSocketConsole => 1; # Console Socket
+use constant slkSocketRemoteUI => 2; # Remote UI Socket
+use constant slkSocketDLP => 3; # Desktop Link Socket
+use constant slkSocketFirstDynamic => 4; # first dynamic socket ID
+use constant slkSocketPoserRPC => 14;
+
+use constant slkPktTypeSystem => 0; # System packets
+use constant slkPktTypeUnused1 => 1; # used to be: Connection Manager packets
+use constant slkPktTypePAD => 2; # PAD Protocol packets
+use constant slkPktTypeLoopBackTest => 3; # Loop-back test packets
+
+
+########################################################################
+#
+# FUNCTION: OpenConnection
+#
+# DESCRIPTION: Open a socket-based connection to Poser.
+#
+# PARAMETERS: Either "[<host>][:[<port>]]" (defaults are localhost and
+# 6415) to connect to an IPv4 socket, or a filename (with
+# at least one "/") to open a file (eg a device file), or
+# "@<fd>" to reopen an existing fd.
+#
+# "#<socket>" can be added to any of these, and causes the
+# given SLK socket to be used instead of slkSocketPoserRPC.
+#
+# The older form with two parameters, (<port> <host>), is
+# equivalent to "<host>:<port>".
+#
+# RETURNED: Nothing. Dies if fail to connect.
+#
+########################################################################
+
+sub OpenConnection
+{
+ # Are we already connected?
+ return if defined $sock;
+
+ # Rewrite the old two parameter (<port> <host>) form as <host>:<port>
+ local ($_) = join ":", reverse @_;
+ $_ = ":$_" unless /\D/; # Handle two parameters with <host> omitted
+
+ my $sname = (s/#(.*)//)? $1 : "PoserRPC";
+ $sname = "slkSocket\u$sname" unless $sname =~ /slkSocket/;
+ $sock_slkSocket = eval $sname;
+ die "invalid SLK socket '$sname'\n" if $sock_slkSocket =~ /\D/;
+
+ if (/^@(\d+)/)
+ {
+ my $fd = $1;
+ $sock = new_from_fd IO::Handle ($fd, "r+")
+ or die "cannot reopen fd $fd: $!\n";
+ }
+ elsif (m"/")
+ {
+ $sock = new IO::File ($_, O_RDWR)
+ or die "cannot open $_: $!\n";
+ }
+ else
+ {
+ my ($remote, $port) = split /:/, $_;
+ $remote = "localhost" unless $remote;
+ $port = 6415 unless $port;
+
+ $sock = new IO::Socket::INET( PeerAddr => $remote,
+ PeerPort => $port,
+ Proto => 'tcp')
+ or die "cannot connect to $_: $@\n";
+ }
+
+ $sock->autoflush (1);
+}
+
+
+########################################################################
+#
+# FUNCTION: CloseConnection
+#
+# DESCRIPTION: Close the socket connection to Poser.
+#
+# PARAMETERS: None.
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub CloseConnection
+{
+ close ($sock);
+ undef $sock;
+}
+
+
+########################################################################
+#
+# FUNCTION: DoRPC
+#
+# DESCRIPTION: Performs full, round-trip RPC service.
+#
+# PARAMETERS: Trap word of function to call.
+# Format string describing parameters.
+# Parameters to pass in the RPC call.
+#
+# The format string contains a series of format
+# descriptors. Descriptors must be seperated by
+# some sort of delimiter, which can be a space, a
+# common, a colon, or any combination of those. Each
+# descriptor has the following format:
+#
+# <type><optional size><optional "*">
+#
+# The "type" describes the parameter in the format
+# expected by the Palm OS. The RPC routines will
+# convert the Perl variable corresponding to the
+# parameter into the described type. The following
+# types are supported:
+#
+# int: integer
+# Err: 2 byte integer
+# Coord: 2 byte integer;
+# LocalID: 4 byte integer
+# HostErr: 4 byte integer
+# string: C string
+# rptr: Pointer to something back on
+# the emulated device
+# point: Palm OS PointType
+# rect: Palm OS RectangleType
+# block: Block of arbitrary data
+#
+# Some format types can accept a size specifier
+# after them. This size specifier is used when
+# a default parameter size cannot be implied, or
+# when you want to override the default parameter
+# size. The following describes how the size
+# specifier is handled for each parameter type:
+#
+# int:
+# Length specifier must be supplied, and
+# must be one of 8, 16, or 32.
+#
+# string:
+# Default length is the value as returned
+# by Perl's "length" function plus one.
+# You can override this value by including
+# your own length specifier.
+#
+# block:
+# Default length is the value as returned
+# by Perl's "length" function. You can
+# override this value by including your
+# own length specifier.
+#
+# all others:
+# Any specified size is ignored.
+#
+# In general, integer types are passed by value, and
+# all other types are passed by reference. That is
+# after all the parameters are marhsalled, sent to
+# the emulator, and unmarshalled, the "pass by value"
+# parameters are pushed directly onto the emulated
+# stack, and "pass by reference" parameters have
+# their addresses pushed onto the stack. You can
+# can change this behavior in one way: if you way
+# an integer to be passed by reference, then you
+# can append a "*" to its format specifier.
+#
+# Examples:
+#
+# "int16"
+# Pass a 2 byte integer
+#
+# "int32 string"
+# Pass a 4 byte integer, followed by
+# a C-string
+#
+# "block32"
+# Pass a 32 byte buffer, filling in
+# its contents as much as possible
+# with the given data
+#
+# "int16 in32 int32*"
+# Pass a 2 byte integer, followed by
+# a 4 byte integer, followed by a
+# 4 byte integer passed by reference.
+#
+# RETURNED: List containing:
+# Register D0
+# Register A0
+# Full parameter list. If any parameters were
+# "pass by reference", you'll receive the
+# updated parameters. If parameters are
+# "pass by value", you'll get them back just
+# the same way you provided them.
+#
+########################################################################
+
+sub DoRPC
+{
+ my ($trap_word, $format, @parameters) = @_;
+
+ my ($slkSocket) = $sock_slkSocket;
+ my ($slkPktType) = slkPktTypeSystem;
+ my ($send_body) = EmRPC::MakeRPCBody ($trap_word, $format, @parameters);
+
+ my ($packet) = MakePacket($slkSocket, $slkSocket, $slkPktType, $send_body);
+
+ SendPacket($packet);
+
+ my ($header, $body, $footer) = ReceivePacket();
+
+ EmRPC::UnmakeRPCBody ($body, $format);
+}
+
+
+########################################################################
+#
+# FUNCTION: ReturnValue
+#
+# DESCRIPTION: .
+#
+# PARAMETERS: .
+#
+# RETURNED: .
+#
+########################################################################
+
+sub ReturnValue
+{
+ my ($format, $D0, $A0, @parameters) = @_;
+
+ my ($type, $size, $by_ref) = GetFormat ($format, 0);
+
+ my ($result);
+
+ if ($type eq "int")
+ {
+ return $D0;
+ }
+ elsif ($type eq "string")
+ {
+ return ($A0, ReadString ($A0));
+ }
+ elsif ($type eq "rptr")
+ {
+ return $A0;
+ }
+
+ die "Unexpected type \"$type\" in EmRPC::ReturnValue, stopped";
+}
+
+
+########################################################################
+#
+# FUNCTION: ReadBlock
+#
+# DESCRIPTION: Read a range of memory from the remote device.
+#
+# PARAMETERS: address of remote device to start reading from.
+# number of bytes to read (256 max).
+#
+# RETURNED: A Perl string containing the result.
+#
+########################################################################
+
+$sysPktReadMemCmd = 0x01;
+$sysPktReadMemRsp = 0x81;
+
+ # typedef struct SysPktReadMemCmdType {
+ # _sysPktBodyCommon; // Common Body header
+ # void* address; // Address to read
+ # Word numBytes; // # of bytes to read
+ # } SysPktReadMemCmdType;
+ # typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr;
+ #
+ # typedef struct SysPktReadMemRspType {
+ # _sysPktBodyCommon; // Common Body header
+ # // Byte data[?]; // variable size
+ # } SysPktReadMemRspType;
+ # typedef SysPktReadMemRspType* SysPktReadMemRspPtr;
+
+sub ReadBlock
+{
+ my ($address, $num_bytes) = @_;
+
+ my ($slkSocket) = $sock_slkSocket;
+ my ($slkPktType) = slkPktTypeSystem;
+ my ($send_body) = pack ("cxNn", $sysPktReadMemCmd, $address, $num_bytes);
+
+ my ($packet) = MakePacket($slkSocket, $slkSocket, $slkPktType, $send_body);
+
+ SendPacket($packet);
+
+ my ($header, $body, $footer) = ReceivePacket();
+
+ unpack ("xx a$num_bytes", $body);
+}
+
+
+########################################################################
+#
+# FUNCTION: WriteBlock
+#
+# DESCRIPTION: Write a range of bytes to the remote device.
+#
+# PARAMETERS: address to start writing to.
+# a Perl string containing the stuff to write.
+#
+# RETURNED: nothing
+#
+########################################################################
+
+$sysPktWriteMemCmd = 0x02;
+$sysPktWriteMemRsp = 0x82;
+
+ # typedef struct SysPktWriteMemCmdType {
+ # _sysPktBodyCommon; // Common Body header
+ # void* address; // Address to write
+ # Word numBytes; // # of bytes to write
+ # // Byte data[?]; // variable size data
+ # } SysPktWriteMemCmdType;
+ # typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr;
+ #
+ # typedef struct SysPktWriteMemRspType {
+ # _sysPktBodyCommon; // Common Body header
+ # } SysPktWriteMemRspType;
+ # typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr;
+
+sub WriteBlock
+{
+ my ($address, $data) = @_;
+
+ my ($slkSocket) = $sock_slkSocket;
+ my ($slkPktType) = slkPktTypeSystem;
+ my ($send_body) = pack ("cxNn", $sysPktWriteMemCmd, $address, length ($data)) . $data;
+
+ my ($packet) = MakePacket($slkSocket, $slkSocket, $slkPktType, $send_body);
+
+ SendPacket($packet);
+
+ ReceivePacket(); # receive the results, but we don't need to do anything with them
+}
+
+
+########################################################################
+#
+# FUNCTION: SendPacket
+#
+# DESCRIPTION: Send a fully-built packet to Poser. The socket
+# connection to Poser should already have been
+# established
+#
+# PARAMETERS: The packet to be sent.
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub SendPacket
+{
+ my ($packet) = @_;
+
+ print $sock $packet;
+}
+
+
+########################################################################
+#
+# FUNCTION: ReceivePacket
+#
+# DESCRIPTION: Receive a packet from Poser.
+#
+# PARAMETERS: None.
+#
+# RETURNED: The packet header, body, and footer as an array.
+#
+########################################################################
+
+sub ReceivePacket
+{
+ my ($header, $body, $footer);
+
+ my ($header_length) = 10;
+ sysread($sock, $header, $header_length);
+
+ my ($body_length) = GetBodySize($header);
+ sysread($sock, $body, $body_length);
+
+ my ($footer_length) = 2;
+ sysread($sock, $footer, $footer_length);
+
+ ($header, $body, $footer);
+}
+
+
+########################################################################
+#
+# FUNCTION: MakePacket
+#
+# DESCRIPTION: Builds up a complete packet for sending to Poser
+# including the header, body, and footer.
+#
+# PARAMETERS: $src - the source SLP socket. Generally something
+# like slkSocketDebugger or slkSocketConsole.
+#
+# $dest - the destination SLP socket.
+#
+# $type - the type of packet. Generally something
+# like slkPktTypeSystem or slkPktTypePAD.
+#
+# $body - the body of the packet.
+#
+# RETURNED: The built packet as a Perl string. The header and
+# footer checksums will be calculated and filled in.
+#
+########################################################################
+
+ # struct SlkPktHeaderType
+ # {
+ # Word signature1; // X first 2 bytes of signature
+ # Byte signature2; // X 3 and final byte of signature
+ # Byte dest; // -> destination socket Id
+ # Byte src; // -> src socket Id
+ # Byte type; // -> packet type
+ # Word bodySize; // X size of body
+ # Byte transID; // -> transaction Id
+ # // if 0 specified, it will be replaced
+ # SlkPktHeaderChecksum checksum; // X check sum of header
+ # };
+ #
+ # struct SlkPktFooterType
+ # {
+ # Word crc16; // header and body crc
+ # };
+
+$header_template = "H6CCCnCC"; # 6 Hex digits, 3 unsigned chars, a B.E. short, 2 unsigned chars
+$footer_template = "n"; # a B.E. short
+
+$signature = "BEEFED";
+
+sub MakePacket
+{
+ my ($src, $dest, $type, $body) = @_;
+
+ if (not defined($transID))
+ {
+ $transID = 0;
+ }
+
+ ++$transID;
+
+ my ($bodySize) = length ($body);
+ my ($header_checksum) = CalcHeaderChecksum ($signature, $dest, $src, $type, $bodySize, $transID);
+
+ my ($header) = pack ($header_template, $signature, $dest, $src, $type, $bodySize, $transID, $header_checksum);
+
+# my ($footer_checksum) = CalcFooterChecksum ($header, &body);
+ my ($footer_checksum) = 0;
+ my ($footer) = pack ($footer_template, $footer_checksum);
+
+ $header . $body . $footer;
+}
+
+
+########################################################################
+#
+# FUNCTION: CalcHeaderChecksum
+#
+# DESCRIPTION: Calculate that checksum value for the packet header.
+#
+# PARAMETERS: The components of the header.
+#
+# RETURNED: The checksum that should be placed in the SLP
+# packet header.
+#
+########################################################################
+
+sub CalcHeaderChecksum
+{
+ my ($signature, $dest, $src, $type, $bodySize, $transID) = @_;
+
+ my ($checksum, $temp_buffer);
+
+ $checksum = 0;
+
+ $temp_buffer = pack ($header_template, $signature, $dest, $src, $type, $bodySize, $transID, 0);
+ @bytes = unpack("C8", $temp_buffer);
+ $checksum = $bytes[0] + $bytes[1] + $bytes[2] + $bytes[3] + $bytes[4] +
+ $bytes[5] + $bytes[6] + $bytes[7];
+
+ $checksum % 256;
+}
+
+
+########################################################################
+#
+# FUNCTION: CalcFooterChecksum
+#
+# DESCRIPTION: Calculate the checksum value for the packet footer.
+#
+# PARAMETERS: The header and body.
+#
+# RETURNED: The checksum that should be placed in the SLP
+# packet footer.
+#
+########################################################################
+
+sub CalcFooterChecksum
+{
+ my ($header, $body) = @_;
+
+ my ($checksum, $temp_buffer);
+
+ $temp_buffer = $header . $body;
+
+ $checksum = unpack("%16c*", $temp_buffer); # Wrong kind of checksum!
+}
+
+
+########################################################################
+#
+# FUNCTION: MakeRPCBody
+#
+# DESCRIPTION: Create the body of an RPC packet, suitable for
+# being passed off to MakePacket.
+#
+# PARAMETERS: The "trap word" of the trap that needs to be called
+# (as defined by the constants in SysTraps.pm) and
+# the parameters of the RPC call, as created by the
+# MakeParam function.
+#
+# RETURNED: The body of the packet as a string.
+#
+########################################################################
+
+ # struct SysPktRPCType
+ # {
+ # _sysPktBodyCommon; // Common Body header
+ # Word trapWord; // which trap to execute
+ # DWord resultD0; // result from D0 placed here
+ # DWord resultA0; // result from A0 placed here
+ # Word numParams; // how many parameters follow
+ # // Following is a variable length array ofSlkRPCParamInfo's
+ # SysPktRPCParamType param[1];
+ # };
+
+$rpc_header_template = "CxH4NNn"; # unsigned byte, filler, 4 hex digits, 2 B.E. longs, B.E. short
+$sysPktRPCCmd = 0x0A;
+$sysPktRPCRsp = 0x8A;
+
+sub MakeRPCBody
+{
+ my ($trapword, $format, @param_list) = @_;
+
+ my ($rpc_header) = pack ($rpc_header_template, $sysPktRPCCmd, $trapword, 0, 0, $#param_list + 1);
+ my ($rpc_body) = join ("", $rpc_header, Marshal($format, @param_list));
+
+ $rpc_body;
+}
+
+sub UnmakeRPCBody
+{
+ my ($body, $format) = @_;
+
+ my ($cmd, $trap_word, $D0, $A0, $num_params, $packed_parms) = unpack ("$rpc_header_template a*", $body);
+ my (@parms) = Unmarshal($packed_parms, $format);
+
+ return ($D0, $A0, @parms);
+}
+
+
+$rpc2_header_template = "CxH4NNN"; # unsigned byte, filler, 4 hex digits, 3 B.E. longs
+$sysPktRPC2Cmd = 0x20;
+$sysPktRPC2Rsp = 0xA0;
+
+sub MakeRPC2Body
+{
+ my ($trapword, $reg_list, @param_list) = @_;
+
+ my ($rpc_header) = pack ($rpc_header_template, $sysPktRPCCmd, $trapword, 0, 0, 0);
+ my ($param_count) = pack ("n", $#param_list + 1);
+ my ($rpc_body) = join ("", $rpc_header, $reg_list, $param_count, reverse @param_list);
+
+ $rpc_body;
+}
+
+
+########################################################################
+#
+# FUNCTION: PackRegList
+#
+# DESCRIPTION: Pack a list of register values into the format
+# needed by an RPC2 packet.
+#
+# PARAMETERS: An associative array, where each key contains Ax
+# or Dx, and the value contains the register value.
+#
+# RETURNED: The packed registers as a string.
+#
+########################################################################
+
+sub PackRegList
+{
+ my (%reg_list) = @_;
+
+ my ($dreg_bits, $areg_bits, $dregs, $aregs);
+
+ $dreg_bits = 0;
+ $areg_bits = 0;
+ $dregs = "";
+ $aregs = "";
+
+ foreach $key (sort keys %reg_list)
+ {
+ my($reg_space) = substr($key, 0, 1);
+ my($bit_to_set) = (1 << (ord(substr($key, 1, 1)) - ord("0")));
+ my($value) = $reg_list{$key};
+
+ if ($reg_space eq "D")
+ {
+ $dreg_bits |= $bit_to_set;
+ $dregs .= pack ("N", $value);
+ }
+ else
+ {
+ $areg_bits |= $bit_to_set;
+ $aregs .= pack ("N", $value);
+ }
+ }
+
+ my ($result) = join ("", pack("CC", $dreg_bits, $areg_bits), $dregs, $aregs);
+}
+
+
+########################################################################
+#
+# FUNCTION: MakeParam
+#
+# DESCRIPTION: Create a parameter array element, suitable for being
+# added to other parameter array elements and --
+# eventually -- to an RPC packet body.
+#
+# PARAMETERS: $data - the data to be added.
+# $data_len - the length of the data to be added. If
+# greater than zero, then we assume $data to be
+# an integer. If equal to zero, then we assume
+# data to be a string where the length of the
+# string is determined by the length () function.
+# If less than zero, then data is assumed to be
+# a buffer with a length of -$data.
+# $by_ref - zero if the parameter is to be treated as
+# pass-by-value. Non-zero if it's pass-by-ref.
+#
+# RETURNED: A parameter string that can be appended to a longer
+# string of parameters. If the length of the string
+# would otherwise be odd, a padding byte is added.
+#
+########################################################################
+
+ # struct SysPktRPCParamInfo
+ # {
+ # Byte byRef; // true if param is by reference
+ # Byte size; // # of Bytes of paramData (must be even)
+ # Word data[1]; // variable length array of paramData
+ # };
+
+sub ToParamBlock
+{
+ my ($data, $data_len) = @_;
+
+ die "Undefined \$data, stopped" unless defined($data);
+ die "\$data_len is negative, stopped" if ($data_len < 0);
+
+ ## If data_len == 0, determine the length using the length () function.
+ ## Else, use the given length.
+
+ if ($data_len == 0)
+ {
+ $data_len = length ($data);
+ }
+ else
+ {
+ $data = pack ("a$data_len", $data);
+ }
+
+ ## Pack up the data.
+
+ my ($param) = pack ("CC", 1, $data_len) . $data;
+
+ ## Make sure the packed data is an even number of bytes long.
+
+ if (($data_len % 2) != 0)
+ {
+ $param .= "\0";
+ }
+
+ $param;
+}
+
+
+sub FromParamBlock
+{
+ my ($param, $data_len) = @_;
+
+ die "Undefined \$param, stopped" unless defined($param);
+ die "\$data_len is negative, stopped" if ($data_len < 0);
+
+ ## Just ignore the $data_len and use what's in the parameter block.
+
+ $data_len = unpack ("xC", $param);
+
+ unpack ("xxa$data_len", $param);
+}
+
+
+sub ToParamInt
+{
+ my ($data, $data_len, $by_ref) = @_;
+
+ die "Undefined \$data, stopped" unless defined($data);
+
+ my ($format);
+
+ if ($data_len == 8)
+ {
+ $format = ("CCCx");
+ $data_len = 1;
+ }
+ elsif ($data_len == 16 || $data_len == 0)
+ {
+ $format = ("CCn");
+ $data_len = 2;
+ }
+ elsif ($data_len == 32)
+ {
+ $format = ("CCN");
+ $data_len = 4;
+ }
+ else
+ {
+ die "\$data_len not 8, 16, or 32, stopped";
+ }
+
+ ## Pack up the data.
+
+ pack ($format, $by_ref, $data_len, $data);
+}
+
+
+sub FromParamInt
+{
+ my ($param, $data_len) = @_;
+
+ die "Undefined \$param, stopped" unless defined($param);
+
+ my ($format);
+
+ if ($data_len == 8)
+ {
+ $format = ("xxCx");
+ }
+ elsif ($data_len == 16 || $data_len == 0)
+ {
+ $format = ("xxn");
+ }
+ elsif ($data_len == 32)
+ {
+ $format = ("xxN");
+ }
+ else
+ {
+ die "\$data_len not 8, 16, or 32, stopped";
+ }
+
+ unpack ($format, $param);
+}
+
+
+sub ToParamPoint
+{
+ my ($point) = @_;
+ my ($param);
+
+ if (defined $point->{x})
+ {
+ $param = pack ("CCnn", 1, 4, $point->{x}, $point->{y});
+ }
+ else
+ {
+ $param = pack ("CCxxxx", 1, 4);
+ }
+
+ $param;
+}
+
+
+sub FromParamPoint
+{
+ my ($param) = @_;
+
+ die "Undefined \$param, stopped" unless defined($param);
+
+ my (@coords) = unpack ("xxnn", $param);
+
+ {x => $coords[0],
+ y => $coords[1]};
+}
+
+
+sub ToParamRect
+{
+ my ($rect) = @_;
+ my ($param);
+
+ if (defined $rect->{height})
+ {
+ $param = pack ("CCnnnn", 1, 8, $rect->{left}, $rect->{top}, $rect->{width}, $rect->{height});
+ }
+ elsif (defined $rect->{bottom})
+ {
+ $param = pack ("CCnnnn", 1, 8, $rect->{left}, $rect->{top}, $rect->{right} - $rect->{left}, $rect->{bottom} - $rect->{top});
+ }
+ else
+ {
+ $param = pack ("CCxxxxxxxx", 1, 8);
+ }
+
+ $param;
+}
+
+
+sub FromParamRect
+{
+ my ($param) = @_;
+
+ die "Undefined \$param, stopped" unless defined($param);
+
+ my (@coords) = unpack ("xxnnnn", $param);
+
+ {left => $coords[0],
+ top => $coords[1],
+ width => $coords[2],
+ height => $coords[3],
+ right => $coords[0] + $coords[2],
+ bottom => $coords[1] + $coords[3]};
+}
+
+
+sub ToParamString
+{
+ my ($data, $data_len) = @_;
+
+ die "Undefined \$data, stopped" unless defined($data);
+ die "\$data_len is negative, stopped" if ($data_len < 0);
+
+ ## If $data_len == 0, determine the length using the length () function.
+
+ if ($data_len == 0)
+ {
+ $data_len = length ($data) + 1; # Add 1 to get 1 byte of NULL padding
+ }
+
+ ## Pack up the data.
+
+ my ($param) = pack ("CCa$data_len", 1, $data_len, $data);
+
+ ## Make sure the packed data is an even number of bytes long.
+
+ if (($data_len % 2) != 0)
+ {
+ $param .= "\0";
+ }
+
+ $param;
+}
+
+
+sub FromParamString
+{
+ my ($param) = @_;
+
+ unpack ("xxA*", $param);
+}
+
+
+########################################################################
+#
+# FUNCTION: UnpackHeader
+#
+# DESCRIPTION: Disassemble a packet header into its consituent
+# parts.
+#
+# PARAMETERS: The packet header as received from Poser
+#
+# RETURNED: The signature, destination port, source port,
+# packet type, body size, transaction ID, and
+# checksum as an array.
+#
+########################################################################
+
+sub UnpackHeader
+{
+ my($header) = @_;
+
+ my ($signature, $dest, $src, $type, $bodySize, $transID, $checksum)
+ = unpack ($header_template, $header);
+
+ ($signature, $dest, $src, $type, $bodySize, $transID, $checksum);
+}
+
+
+########################################################################
+#
+# FUNCTION: GetBodySize
+#
+# DESCRIPTION: Utility function to extract the packet body size
+# field from the packet header.
+#
+# PARAMETERS: The packet header as received from Poser.
+#
+# RETURNED: The size of the body following the header.
+#
+########################################################################
+
+sub GetBodySize
+{
+ my($header) = @_;
+
+ my ($signature, $dest, $srs, $type, $bodySize, $transID, $checksum)
+ = UnpackHeader ($header);
+
+ $bodySize;
+}
+
+
+sub SkipWhite
+{
+ my ($format, $format_index) = @_;
+
+ while ()
+ {
+ last if ($format_index >= length ($format));
+
+ my ($char) = substr ($format, $format_index, 1);
+ last unless ($char eq " " || $char eq "," || $char eq ":");
+
+ $format_index += 1;
+ }
+
+ $format_index
+}
+
+
+sub GetType
+{
+ my ($format, $format_index) = @_;
+ my ($type) = "";
+
+ $format_index = SkipWhite ($format, $format_index);
+
+ while ()
+ {
+ last if ($format_index >= length ($format));
+
+ my ($char) = substr ($format, $format_index, 1);
+ last if (($char lt "a" || $char gt "z") && ($char lt "A" || $char gt "Z"));
+
+ $type .= $char;
+ $format_index += 1;
+ }
+
+ die "Unknown type (\"$type\" @ $format_index), stopped"
+ unless ($type eq "int" ||
+ $type eq "Err" ||
+ $type eq "Coord" ||
+ $type eq "LocalID" ||
+ $type eq "HostErr" ||
+ $type eq "string" ||
+ $type eq "rptr" ||
+ $type eq "point" ||
+ $type eq "rect" ||
+ $type eq "block");
+
+ return ($type, $format_index);
+}
+
+
+sub GetSize
+{
+ my ($format, $format_index) = @_;
+ my ($size) = 0;
+
+ while ()
+ {
+ last if ($format_index >= length ($format));
+
+ my ($char) = substr ($format, $format_index, 1);
+ last if ($char lt "0" || $char gt "9");
+
+ $size = $size * 10 + $char;
+ $format_index += 1;
+ }
+
+ return ($size, $format_index);
+}
+
+
+sub GetByRef
+{
+ my ($format, $format_index) = @_;
+ my ($by_ref) = 0;
+
+ if (substr ($format, $format_index, 1) eq "*")
+ {
+ $by_ref = 1;
+ }
+
+ if ($by_ref)
+ {
+ $format_index += 1;
+ }
+
+ return ($by_ref, $format_index);
+}
+
+
+sub GetFormat
+{
+ my ($format, $format_index) = @_;
+ my ($type, $size, $by_ref) = (" ", 0, 0);
+
+ ($type, $format_index) = GetType ($format, $format_index);
+ ($size, $format_index) = GetSize ($format, $format_index);
+ ($by_ref, $format_index) = GetByRef ($format, $format_index);
+
+ ## Deal with aliases
+
+ if ($type eq "LocalID" or $type eq "HostErr")
+ {
+ $type = "int";
+ $size = 32;
+ }
+ elsif ($type eq "Err" or $type eq "Coord")
+ {
+ $type = "int";
+ $size = 16;
+ }
+
+ return ($type, $size, $by_ref, $format_index);
+}
+
+
+sub Marshal
+{
+ my ($format, @parameters) = @_;
+ my (@result);
+
+ my ($format_index) = 0;
+ my ($parameter_index) = 0;
+
+ while ($format_index < length ($format))
+ {
+ my ($parm);
+
+ my ($type, $size);
+ ($type, $size, $by_ref, $format_index) = GetFormat ($format, $format_index);
+
+ if ($type eq "int")
+ {
+ $parm = EmRPC::ToParamInt($parameters[$parameter_index], $size, $by_ref);
+ }
+ elsif ($type eq "rptr")
+ {
+ $parm = EmRPC::ToParamInt($parameters[$parameter_index], 32, 0);
+ }
+ elsif ($type eq "point")
+ {
+ $parm = EmRPC::ToParamPoint($parameters[$parameter_index], $size);
+ }
+ elsif ($type eq "rect")
+ {
+ $parm = EmRPC::ToParamRect($parameters[$parameter_index], $size);
+ }
+ elsif ($type eq "string")
+ {
+ $parm = EmRPC::ToParamString($parameters[$parameter_index], $size);
+ }
+ elsif ($type eq "block")
+ {
+ $parm = EmRPC::ToParamBlock($parameters[$parameter_index], $size);
+ }
+ else
+ {
+ die "Unexpected type \"$type\" in EmRPC::Marshal, stopped";
+ }
+
+ push (@result, $parm);
+
+ $parameter_index += 1;
+ }
+
+ return join ("", reverse @result);
+}
+
+
+sub BreakApartParameters
+{
+ my ($packed_parms) = @_;
+ my (@result) = 0;
+
+ my ($offset) = 0;
+
+ while ($offset < length ($packed_parms))
+ {
+ # Get the size field.
+
+ my ($size) = unpack ("x$offset" . "xC", $packed_parms);
+
+ # Add in the lengths of the byRef and size fields.
+
+ $size += 2;
+
+ # Make sure the field is word-aligned.
+
+ if (($size % 2) != 0)
+ {
+ $size += 1;
+ }
+
+ # Get the SysPktRPCParamInfo.
+
+ my ($parm) = unpack ("x$offset a$size", $packed_parms);
+
+ push (@result, $parm);
+
+ $offset += $size;
+ }
+
+ return @result;
+}
+
+
+sub Unmarshal
+{
+ my ($packed_parms, $format) = @_;
+ my (@result);
+
+ my ($format_index) = 0;
+ my ($parameter_index) = 0;
+
+ my (@parameters) = reverse BreakApartParameters($packed_parms);
+
+ while ($format_index < length ($format))
+ {
+ my ($parm);
+
+ my ($type, $size);
+ ($type, $size, $by_ref, $format_index) = GetFormat ($format, $format_index);
+
+ if ($type eq "int")
+ {
+ $parm = EmRPC::FromParamInt($parameters[$parameter_index], $size);
+ }
+ elsif ($type eq "rptr")
+ {
+ $parm = EmRPC::FromParamInt($parameters[$parameter_index], 32);
+ }
+ elsif ($type eq "point")
+ {
+ $parm = EmRPC::FromParamPoint($parameters[$parameter_index]);
+ }
+ elsif ($type eq "rect")
+ {
+ $parm = EmRPC::FromParamRect($parameters[$parameter_index]);
+ }
+ elsif ($type eq "string")
+ {
+ $parm = EmRPC::FromParamString($parameters[$parameter_index]);
+ }
+ elsif ($type eq "block")
+ {
+ $parm = EmRPC::FromParamBlock($parameters[$parameter_index], $size);
+ }
+ else
+ {
+ die "Unexpected type \"$type\" in EmRPC::Unmarshal, stopped";
+ }
+
+ push (@result, $parm);
+
+ $parameter_index += 1;
+ }
+
+ return @result;
+}
+
+
+sub ReadString
+{
+ my ($address) = @_;
+
+ my ($block) = EmRPC::ReadBlock($address, 128);
+
+ $block =~ /^([^\000]*)/;
+ return $1;
+}
+
+
+sub PrintString
+{
+ my($string) = @_;
+
+ foreach $ii (0..length ($string) - 1)
+ {
+ my($ch) = substr($string, $ii, 1);
+
+ printf "0x%02X, ", ord($ch);
+
+ if ($ii % 8 == 7)
+ {
+ print "\n";
+ }
+ }
+
+ printf "\n";
+
+ $string;
+}
+
+1;
diff --git a/Scripting/Perl/EmSysTraps.pm b/Scripting/Perl/EmSysTraps.pm
new file mode 100644
index 0000000..38ae497
--- /dev/null
+++ b/Scripting/Perl/EmSysTraps.pm
@@ -0,0 +1,997 @@
+# DO NOT EDIT! This section was automatically produced by D:\Projects\Emulator\Main\Scripting\Perl\MakeSysTraps.pl
+# from D:\Projects\Emulator\Main\SrcShared\Palm\Incs\System\SysTraps.h
+
+package EmSysTraps;
+
+use constant sysTrapMemInit => "A000";
+use constant sysTrapMemInitHeapTable => "A001";
+use constant sysTrapMemStoreInit => "A002";
+use constant sysTrapMemCardFormat => "A003";
+use constant sysTrapMemCardInfo => "A004";
+use constant sysTrapMemStoreInfo => "A005";
+use constant sysTrapMemStoreSetInfo => "A006";
+use constant sysTrapMemNumHeaps => "A007";
+use constant sysTrapMemNumRAMHeaps => "A008";
+use constant sysTrapMemHeapID => "A009";
+use constant sysTrapMemHeapPtr => "A00A";
+use constant sysTrapMemHeapFreeBytes => "A00B";
+use constant sysTrapMemHeapSize => "A00C";
+use constant sysTrapMemHeapFlags => "A00D";
+use constant sysTrapMemHeapCompact => "A00E";
+use constant sysTrapMemHeapInit => "A00F";
+use constant sysTrapMemHeapFreeByOwnerID => "A010";
+use constant sysTrapMemChunkNew => "A011";
+use constant sysTrapMemChunkFree => "A012";
+use constant sysTrapMemPtrNew => "A013";
+use constant sysTrapMemPtrRecoverHandle => "A014";
+use constant sysTrapMemPtrFlags => "A015";
+use constant sysTrapMemPtrSize => "A016";
+use constant sysTrapMemPtrOwner => "A017";
+use constant sysTrapMemPtrHeapID => "A018";
+use constant sysTrapMemPtrCardNo => "A019";
+use constant sysTrapMemPtrToLocalID => "A01A";
+use constant sysTrapMemPtrSetOwner => "A01B";
+use constant sysTrapMemPtrResize => "A01C";
+use constant sysTrapMemPtrResetLock => "A01D";
+use constant sysTrapMemHandleNew => "A01E";
+use constant sysTrapMemHandleLockCount => "A01F";
+use constant sysTrapMemHandleToLocalID => "A020";
+use constant sysTrapMemHandleLock => "A021";
+use constant sysTrapMemHandleUnlock => "A022";
+use constant sysTrapMemLocalIDToGlobal => "A023";
+use constant sysTrapMemLocalIDKind => "A024";
+use constant sysTrapMemLocalIDToPtr => "A025";
+use constant sysTrapMemMove => "A026";
+use constant sysTrapMemSet => "A027";
+use constant sysTrapMemStoreSearch => "A028";
+use constant sysTrapReserved6 => "A029";
+use constant sysTrapMemKernelInit => "A02A";
+use constant sysTrapMemHandleFree => "A02B";
+use constant sysTrapMemHandleFlags => "A02C";
+use constant sysTrapMemHandleSize => "A02D";
+use constant sysTrapMemHandleOwner => "A02E";
+use constant sysTrapMemHandleHeapID => "A02F";
+use constant sysTrapMemHandleDataStorage => "A030";
+use constant sysTrapMemHandleCardNo => "A031";
+use constant sysTrapMemHandleSetOwner => "A032";
+use constant sysTrapMemHandleResize => "A033";
+use constant sysTrapMemHandleResetLock => "A034";
+use constant sysTrapMemPtrUnlock => "A035";
+use constant sysTrapMemLocalIDToLockedPtr => "A036";
+use constant sysTrapMemSetDebugMode => "A037";
+use constant sysTrapMemHeapScramble => "A038";
+use constant sysTrapMemHeapCheck => "A039";
+use constant sysTrapMemNumCards => "A03A";
+use constant sysTrapMemDebugMode => "A03B";
+use constant sysTrapMemSemaphoreReserve => "A03C";
+use constant sysTrapMemSemaphoreRelease => "A03D";
+use constant sysTrapMemHeapDynamic => "A03E";
+use constant sysTrapMemNVParams => "A03F";
+use constant sysTrapDmInit => "A040";
+use constant sysTrapDmCreateDatabase => "A041";
+use constant sysTrapDmDeleteDatabase => "A042";
+use constant sysTrapDmNumDatabases => "A043";
+use constant sysTrapDmGetDatabase => "A044";
+use constant sysTrapDmFindDatabase => "A045";
+use constant sysTrapDmDatabaseInfo => "A046";
+use constant sysTrapDmSetDatabaseInfo => "A047";
+use constant sysTrapDmDatabaseSize => "A048";
+use constant sysTrapDmOpenDatabase => "A049";
+use constant sysTrapDmCloseDatabase => "A04A";
+use constant sysTrapDmNextOpenDatabase => "A04B";
+use constant sysTrapDmOpenDatabaseInfo => "A04C";
+use constant sysTrapDmResetRecordStates => "A04D";
+use constant sysTrapDmGetLastErr => "A04E";
+use constant sysTrapDmNumRecords => "A04F";
+use constant sysTrapDmRecordInfo => "A050";
+use constant sysTrapDmSetRecordInfo => "A051";
+use constant sysTrapDmAttachRecord => "A052";
+use constant sysTrapDmDetachRecord => "A053";
+use constant sysTrapDmMoveRecord => "A054";
+use constant sysTrapDmNewRecord => "A055";
+use constant sysTrapDmRemoveRecord => "A056";
+use constant sysTrapDmDeleteRecord => "A057";
+use constant sysTrapDmArchiveRecord => "A058";
+use constant sysTrapDmNewHandle => "A059";
+use constant sysTrapDmRemoveSecretRecords => "A05A";
+use constant sysTrapDmQueryRecord => "A05B";
+use constant sysTrapDmGetRecord => "A05C";
+use constant sysTrapDmResizeRecord => "A05D";
+use constant sysTrapDmReleaseRecord => "A05E";
+use constant sysTrapDmGetResource => "A05F";
+use constant sysTrapDmGet1Resource => "A060";
+use constant sysTrapDmReleaseResource => "A061";
+use constant sysTrapDmResizeResource => "A062";
+use constant sysTrapDmNextOpenResDatabase => "A063";
+use constant sysTrapDmFindResourceType => "A064";
+use constant sysTrapDmFindResource => "A065";
+use constant sysTrapDmSearchResource => "A066";
+use constant sysTrapDmNumResources => "A067";
+use constant sysTrapDmResourceInfo => "A068";
+use constant sysTrapDmSetResourceInfo => "A069";
+use constant sysTrapDmAttachResource => "A06A";
+use constant sysTrapDmDetachResource => "A06B";
+use constant sysTrapDmNewResource => "A06C";
+use constant sysTrapDmRemoveResource => "A06D";
+use constant sysTrapDmGetResourceIndex => "A06E";
+use constant sysTrapDmQuickSort => "A06F";
+use constant sysTrapDmQueryNextInCategory => "A070";
+use constant sysTrapDmNumRecordsInCategory => "A071";
+use constant sysTrapDmPositionInCategory => "A072";
+use constant sysTrapDmSeekRecordInCategory => "A073";
+use constant sysTrapDmMoveCategory => "A074";
+use constant sysTrapDmOpenDatabaseByTypeCreator => "A075";
+use constant sysTrapDmWrite => "A076";
+use constant sysTrapDmStrCopy => "A077";
+use constant sysTrapDmGetNextDatabaseByTypeCreator => "A078";
+use constant sysTrapDmWriteCheck => "A079";
+use constant sysTrapDmMoveOpenDBContext => "A07A";
+use constant sysTrapDmFindRecordByID => "A07B";
+use constant sysTrapDmGetAppInfoID => "A07C";
+use constant sysTrapDmFindSortPositionV10 => "A07D";
+use constant sysTrapDmSet => "A07E";
+use constant sysTrapDmCreateDatabaseFromImage => "A07F";
+use constant sysTrapDbgSrcMessage => "A080";
+use constant sysTrapDbgMessage => "A081";
+use constant sysTrapDbgGetMessage => "A082";
+use constant sysTrapDbgCommSettings => "A083";
+use constant sysTrapErrDisplayFileLineMsg => "A084";
+use constant sysTrapErrSetJump => "A085";
+use constant sysTrapErrLongJump => "A086";
+use constant sysTrapErrThrow => "A087";
+use constant sysTrapErrExceptionList => "A088";
+use constant sysTrapSysBroadcastActionCode => "A089";
+use constant sysTrapSysUnimplemented => "A08A";
+use constant sysTrapSysColdBoot => "A08B";
+use constant sysTrapSysReset => "A08C";
+use constant sysTrapSysDoze => "A08D";
+use constant sysTrapSysAppLaunch => "A08E";
+use constant sysTrapSysAppStartup => "A08F";
+use constant sysTrapSysAppExit => "A090";
+use constant sysTrapSysSetA5 => "A091";
+use constant sysTrapSysSetTrapAddress => "A092";
+use constant sysTrapSysGetTrapAddress => "A093";
+use constant sysTrapSysTranslateKernelErr => "A094";
+use constant sysTrapSysSemaphoreCreate => "A095";
+use constant sysTrapSysSemaphoreDelete => "A096";
+use constant sysTrapSysSemaphoreWait => "A097";
+use constant sysTrapSysSemaphoreSignal => "A098";
+use constant sysTrapSysTimerCreate => "A099";
+use constant sysTrapSysTimerWrite => "A09A";
+use constant sysTrapSysTaskCreate => "A09B";
+use constant sysTrapSysTaskDelete => "A09C";
+use constant sysTrapSysTaskTrigger => "A09D";
+use constant sysTrapSysTaskID => "A09E";
+use constant sysTrapSysTaskUserInfoPtr => "A09F";
+use constant sysTrapSysTaskDelay => "A0A0";
+use constant sysTrapSysTaskSetTermProc => "A0A1";
+use constant sysTrapSysUILaunch => "A0A2";
+use constant sysTrapSysNewOwnerID => "A0A3";
+use constant sysTrapSysSemaphoreSet => "A0A4";
+use constant sysTrapSysDisableInts => "A0A5";
+use constant sysTrapSysRestoreStatus => "A0A6";
+use constant sysTrapSysUIAppSwitch => "A0A7";
+use constant sysTrapSysCurAppInfoPV20 => "A0A8";
+use constant sysTrapSysHandleEvent => "A0A9";
+use constant sysTrapSysInit => "A0AA";
+use constant sysTrapSysQSort => "A0AB";
+use constant sysTrapSysCurAppDatabase => "A0AC";
+use constant sysTrapSysFatalAlert => "A0AD";
+use constant sysTrapSysResSemaphoreCreate => "A0AE";
+use constant sysTrapSysResSemaphoreDelete => "A0AF";
+use constant sysTrapSysResSemaphoreReserve => "A0B0";
+use constant sysTrapSysResSemaphoreRelease => "A0B1";
+use constant sysTrapSysSleep => "A0B2";
+use constant sysTrapSysKeyboardDialogV10 => "A0B3";
+use constant sysTrapSysAppLauncherDialog => "A0B4";
+use constant sysTrapSysSetPerformance => "A0B5";
+use constant sysTrapSysBatteryInfoV20 => "A0B6";
+use constant sysTrapSysLibInstall => "A0B7";
+use constant sysTrapSysLibRemove => "A0B8";
+use constant sysTrapSysLibTblEntry => "A0B9";
+use constant sysTrapSysLibFind => "A0BA";
+use constant sysTrapSysBatteryDialog => "A0BB";
+use constant sysTrapSysCopyStringResource => "A0BC";
+use constant sysTrapSysKernelInfo => "A0BD";
+use constant sysTrapSysLaunchConsole => "A0BE";
+use constant sysTrapSysTimerDelete => "A0BF";
+use constant sysTrapSysSetAutoOffTime => "A0C0";
+use constant sysTrapSysFormPointerArrayToStrings => "A0C1";
+use constant sysTrapSysRandom => "A0C2";
+use constant sysTrapSysTaskSwitching => "A0C3";
+use constant sysTrapSysTimerRead => "A0C4";
+use constant sysTrapStrCopy => "A0C5";
+use constant sysTrapStrCat => "A0C6";
+use constant sysTrapStrLen => "A0C7";
+use constant sysTrapStrCompare => "A0C8";
+use constant sysTrapStrIToA => "A0C9";
+use constant sysTrapStrCaselessCompare => "A0CA";
+use constant sysTrapStrIToH => "A0CB";
+use constant sysTrapStrChr => "A0CC";
+use constant sysTrapStrStr => "A0CD";
+use constant sysTrapStrAToI => "A0CE";
+use constant sysTrapStrToLower => "A0CF";
+use constant sysTrapSerReceiveISP => "A0D0";
+use constant sysTrapSlkOpen => "A0D1";
+use constant sysTrapSlkClose => "A0D2";
+use constant sysTrapSlkOpenSocket => "A0D3";
+use constant sysTrapSlkCloseSocket => "A0D4";
+use constant sysTrapSlkSocketRefNum => "A0D5";
+use constant sysTrapSlkSocketSetTimeout => "A0D6";
+use constant sysTrapSlkFlushSocket => "A0D7";
+use constant sysTrapSlkSetSocketListener => "A0D8";
+use constant sysTrapSlkSendPacket => "A0D9";
+use constant sysTrapSlkReceivePacket => "A0DA";
+use constant sysTrapSlkSysPktDefaultResponse => "A0DB";
+use constant sysTrapSlkProcessRPC => "A0DC";
+use constant sysTrapConPutS => "A0DD";
+use constant sysTrapConGetS => "A0DE";
+use constant sysTrapFplInit => "A0DF";
+use constant sysTrapFplFree => "A0E0";
+use constant sysTrapFplFToA => "A0E1";
+use constant sysTrapFplAToF => "A0E2";
+use constant sysTrapFplBase10Info => "A0E3";
+use constant sysTrapFplLongToFloat => "A0E4";
+use constant sysTrapFplFloatToLong => "A0E5";
+use constant sysTrapFplFloatToULong => "A0E6";
+use constant sysTrapFplMul => "A0E7";
+use constant sysTrapFplAdd => "A0E8";
+use constant sysTrapFplSub => "A0E9";
+use constant sysTrapFplDiv => "A0EA";
+use constant sysTrapWinScreenInit => "A0EB";
+use constant sysTrapScrCopyRectangle => "A0EC";
+use constant sysTrapScrDrawChars => "A0ED";
+use constant sysTrapScrLineRoutine => "A0EE";
+use constant sysTrapScrRectangleRoutine => "A0EF";
+use constant sysTrapScrScreenInfo => "A0F0";
+use constant sysTrapScrDrawNotify => "A0F1";
+use constant sysTrapScrSendUpdateArea => "A0F2";
+use constant sysTrapScrCompressScanLine => "A0F3";
+use constant sysTrapScrDeCompressScanLine => "A0F4";
+use constant sysTrapTimGetSeconds => "A0F5";
+use constant sysTrapTimSetSeconds => "A0F6";
+use constant sysTrapTimGetTicks => "A0F7";
+use constant sysTrapTimInit => "A0F8";
+use constant sysTrapTimSetAlarm => "A0F9";
+use constant sysTrapTimGetAlarm => "A0FA";
+use constant sysTrapTimHandleInterrupt => "A0FB";
+use constant sysTrapTimSecondsToDateTime => "A0FC";
+use constant sysTrapTimDateTimeToSeconds => "A0FD";
+use constant sysTrapTimAdjust => "A0FE";
+use constant sysTrapTimSleep => "A0FF";
+use constant sysTrapTimWake => "A100";
+use constant sysTrapCategoryCreateListV10 => "A101";
+use constant sysTrapCategoryFreeListV10 => "A102";
+use constant sysTrapCategoryFind => "A103";
+use constant sysTrapCategoryGetName => "A104";
+use constant sysTrapCategoryEditV10 => "A105";
+use constant sysTrapCategorySelectV10 => "A106";
+use constant sysTrapCategoryGetNext => "A107";
+use constant sysTrapCategorySetTriggerLabel => "A108";
+use constant sysTrapCategoryTruncateName => "A109";
+use constant sysTrapClipboardAddItem => "A10A";
+use constant sysTrapClipboardCheckIfItemExist => "A10B";
+use constant sysTrapClipboardGetItem => "A10C";
+use constant sysTrapCtlDrawControl => "A10D";
+use constant sysTrapCtlEraseControl => "A10E";
+use constant sysTrapCtlHideControl => "A10F";
+use constant sysTrapCtlShowControl => "A110";
+use constant sysTrapCtlGetValue => "A111";
+use constant sysTrapCtlSetValue => "A112";
+use constant sysTrapCtlGetLabel => "A113";
+use constant sysTrapCtlSetLabel => "A114";
+use constant sysTrapCtlHandleEvent => "A115";
+use constant sysTrapCtlHitControl => "A116";
+use constant sysTrapCtlSetEnabled => "A117";
+use constant sysTrapCtlSetUsable => "A118";
+use constant sysTrapCtlEnabled => "A119";
+use constant sysTrapEvtInitialize => "A11A";
+use constant sysTrapEvtAddEventToQueue => "A11B";
+use constant sysTrapEvtCopyEvent => "A11C";
+use constant sysTrapEvtGetEvent => "A11D";
+use constant sysTrapEvtGetPen => "A11E";
+use constant sysTrapEvtSysInit => "A11F";
+use constant sysTrapEvtGetSysEvent => "A120";
+use constant sysTrapEvtProcessSoftKeyStroke => "A121";
+use constant sysTrapEvtGetPenBtnList => "A122";
+use constant sysTrapEvtSetPenQueuePtr => "A123";
+use constant sysTrapEvtPenQueueSize => "A124";
+use constant sysTrapEvtFlushPenQueue => "A125";
+use constant sysTrapEvtEnqueuePenPoint => "A126";
+use constant sysTrapEvtDequeuePenStrokeInfo => "A127";
+use constant sysTrapEvtDequeuePenPoint => "A128";
+use constant sysTrapEvtFlushNextPenStroke => "A129";
+use constant sysTrapEvtSetKeyQueuePtr => "A12A";
+use constant sysTrapEvtKeyQueueSize => "A12B";
+use constant sysTrapEvtFlushKeyQueue => "A12C";
+use constant sysTrapEvtEnqueueKey => "A12D";
+use constant sysTrapEvtDequeueKeyEvent => "A12E";
+use constant sysTrapEvtWakeup => "A12F";
+use constant sysTrapEvtResetAutoOffTimer => "A130";
+use constant sysTrapEvtKeyQueueEmpty => "A131";
+use constant sysTrapEvtEnableGraffiti => "A132";
+use constant sysTrapFldCopy => "A133";
+use constant sysTrapFldCut => "A134";
+use constant sysTrapFldDrawField => "A135";
+use constant sysTrapFldEraseField => "A136";
+use constant sysTrapFldFreeMemory => "A137";
+use constant sysTrapFldGetBounds => "A138";
+use constant sysTrapFldGetTextPtr => "A139";
+use constant sysTrapFldGetSelection => "A13A";
+use constant sysTrapFldHandleEvent => "A13B";
+use constant sysTrapFldPaste => "A13C";
+use constant sysTrapFldRecalculateField => "A13D";
+use constant sysTrapFldSetBounds => "A13E";
+use constant sysTrapFldSetText => "A13F";
+use constant sysTrapFldGetFont => "A140";
+use constant sysTrapFldSetFont => "A141";
+use constant sysTrapFldSetSelection => "A142";
+use constant sysTrapFldGrabFocus => "A143";
+use constant sysTrapFldReleaseFocus => "A144";
+use constant sysTrapFldGetInsPtPosition => "A145";
+use constant sysTrapFldSetInsPtPosition => "A146";
+use constant sysTrapFldSetScrollPosition => "A147";
+use constant sysTrapFldGetScrollPosition => "A148";
+use constant sysTrapFldGetTextHeight => "A149";
+use constant sysTrapFldGetTextAllocatedSize => "A14A";
+use constant sysTrapFldGetTextLength => "A14B";
+use constant sysTrapFldScrollField => "A14C";
+use constant sysTrapFldScrollable => "A14D";
+use constant sysTrapFldGetVisibleLines => "A14E";
+use constant sysTrapFldGetAttributes => "A14F";
+use constant sysTrapFldSetAttributes => "A150";
+use constant sysTrapFldSendChangeNotification => "A151";
+use constant sysTrapFldCalcFieldHeight => "A152";
+use constant sysTrapFldGetTextHandle => "A153";
+use constant sysTrapFldCompactText => "A154";
+use constant sysTrapFldDirty => "A155";
+use constant sysTrapFldWordWrap => "A156";
+use constant sysTrapFldSetTextAllocatedSize => "A157";
+use constant sysTrapFldSetTextHandle => "A158";
+use constant sysTrapFldSetTextPtr => "A159";
+use constant sysTrapFldGetMaxChars => "A15A";
+use constant sysTrapFldSetMaxChars => "A15B";
+use constant sysTrapFldSetUsable => "A15C";
+use constant sysTrapFldInsert => "A15D";
+use constant sysTrapFldDelete => "A15E";
+use constant sysTrapFldUndo => "A15F";
+use constant sysTrapFldSetDirty => "A160";
+use constant sysTrapFldSendHeightChangeNotification => "A161";
+use constant sysTrapFldMakeFullyVisible => "A162";
+use constant sysTrapFntGetFont => "A163";
+use constant sysTrapFntSetFont => "A164";
+use constant sysTrapFntGetFontPtr => "A165";
+use constant sysTrapFntBaseLine => "A166";
+use constant sysTrapFntCharHeight => "A167";
+use constant sysTrapFntLineHeight => "A168";
+use constant sysTrapFntAverageCharWidth => "A169";
+use constant sysTrapFntCharWidth => "A16A";
+use constant sysTrapFntCharsWidth => "A16B";
+use constant sysTrapFntDescenderHeight => "A16C";
+use constant sysTrapFntCharsInWidth => "A16D";
+use constant sysTrapFntLineWidth => "A16E";
+use constant sysTrapFrmInitForm => "A16F";
+use constant sysTrapFrmDeleteForm => "A170";
+use constant sysTrapFrmDrawForm => "A171";
+use constant sysTrapFrmEraseForm => "A172";
+use constant sysTrapFrmGetActiveForm => "A173";
+use constant sysTrapFrmSetActiveForm => "A174";
+use constant sysTrapFrmGetActiveFormID => "A175";
+use constant sysTrapFrmGetUserModifiedState => "A176";
+use constant sysTrapFrmSetNotUserModified => "A177";
+use constant sysTrapFrmGetFocus => "A178";
+use constant sysTrapFrmSetFocus => "A179";
+use constant sysTrapFrmHandleEvent => "A17A";
+use constant sysTrapFrmGetFormBounds => "A17B";
+use constant sysTrapFrmGetWindowHandle => "A17C";
+use constant sysTrapFrmGetFormId => "A17D";
+use constant sysTrapFrmGetFormPtr => "A17E";
+use constant sysTrapFrmGetNumberOfObjects => "A17F";
+use constant sysTrapFrmGetObjectIndex => "A180";
+use constant sysTrapFrmGetObjectId => "A181";
+use constant sysTrapFrmGetObjectType => "A182";
+use constant sysTrapFrmGetObjectPtr => "A183";
+use constant sysTrapFrmHideObject => "A184";
+use constant sysTrapFrmShowObject => "A185";
+use constant sysTrapFrmGetObjectPosition => "A186";
+use constant sysTrapFrmSetObjectPosition => "A187";
+use constant sysTrapFrmGetControlValue => "A188";
+use constant sysTrapFrmSetControlValue => "A189";
+use constant sysTrapFrmGetControlGroupSelection => "A18A";
+use constant sysTrapFrmSetControlGroupSelection => "A18B";
+use constant sysTrapFrmCopyLabel => "A18C";
+use constant sysTrapFrmSetLabel => "A18D";
+use constant sysTrapFrmGetLabel => "A18E";
+use constant sysTrapFrmSetCategoryLabel => "A18F";
+use constant sysTrapFrmGetTitle => "A190";
+use constant sysTrapFrmSetTitle => "A191";
+use constant sysTrapFrmAlert => "A192";
+use constant sysTrapFrmDoDialog => "A193";
+use constant sysTrapFrmCustomAlert => "A194";
+use constant sysTrapFrmHelp => "A195";
+use constant sysTrapFrmUpdateScrollers => "A196";
+use constant sysTrapFrmGetFirstForm => "A197";
+use constant sysTrapFrmVisible => "A198";
+use constant sysTrapFrmGetObjectBounds => "A199";
+use constant sysTrapFrmCopyTitle => "A19A";
+use constant sysTrapFrmGotoForm => "A19B";
+use constant sysTrapFrmPopupForm => "A19C";
+use constant sysTrapFrmUpdateForm => "A19D";
+use constant sysTrapFrmReturnToForm => "A19E";
+use constant sysTrapFrmSetEventHandler => "A19F";
+use constant sysTrapFrmDispatchEvent => "A1A0";
+use constant sysTrapFrmCloseAllForms => "A1A1";
+use constant sysTrapFrmSaveAllForms => "A1A2";
+use constant sysTrapFrmGetGadgetData => "A1A3";
+use constant sysTrapFrmSetGadgetData => "A1A4";
+use constant sysTrapFrmSetCategoryTrigger => "A1A5";
+use constant sysTrapUIInitialize => "A1A6";
+use constant sysTrapUIReset => "A1A7";
+use constant sysTrapInsPtInitialize => "A1A8";
+use constant sysTrapInsPtSetLocation => "A1A9";
+use constant sysTrapInsPtGetLocation => "A1AA";
+use constant sysTrapInsPtEnable => "A1AB";
+use constant sysTrapInsPtEnabled => "A1AC";
+use constant sysTrapInsPtSetHeight => "A1AD";
+use constant sysTrapInsPtGetHeight => "A1AE";
+use constant sysTrapInsPtCheckBlink => "A1AF";
+use constant sysTrapLstSetDrawFunction => "A1B0";
+use constant sysTrapLstDrawList => "A1B1";
+use constant sysTrapLstEraseList => "A1B2";
+use constant sysTrapLstGetSelection => "A1B3";
+use constant sysTrapLstGetSelectionText => "A1B4";
+use constant sysTrapLstHandleEvent => "A1B5";
+use constant sysTrapLstSetHeight => "A1B6";
+use constant sysTrapLstSetSelection => "A1B7";
+use constant sysTrapLstSetListChoices => "A1B8";
+use constant sysTrapLstMakeItemVisible => "A1B9";
+use constant sysTrapLstGetNumberOfItems => "A1BA";
+use constant sysTrapLstPopupList => "A1BB";
+use constant sysTrapLstSetPosition => "A1BC";
+use constant sysTrapMenuInit => "A1BD";
+use constant sysTrapMenuDispose => "A1BE";
+use constant sysTrapMenuHandleEvent => "A1BF";
+use constant sysTrapMenuDrawMenu => "A1C0";
+use constant sysTrapMenuEraseStatus => "A1C1";
+use constant sysTrapMenuGetActiveMenu => "A1C2";
+use constant sysTrapMenuSetActiveMenu => "A1C3";
+use constant sysTrapRctSetRectangle => "A1C4";
+use constant sysTrapRctCopyRectangle => "A1C5";
+use constant sysTrapRctInsetRectangle => "A1C6";
+use constant sysTrapRctOffsetRectangle => "A1C7";
+use constant sysTrapRctPtInRectangle => "A1C8";
+use constant sysTrapRctGetIntersection => "A1C9";
+use constant sysTrapTblDrawTable => "A1CA";
+use constant sysTrapTblEraseTable => "A1CB";
+use constant sysTrapTblHandleEvent => "A1CC";
+use constant sysTrapTblGetItemBounds => "A1CD";
+use constant sysTrapTblSelectItem => "A1CE";
+use constant sysTrapTblGetItemInt => "A1CF";
+use constant sysTrapTblSetItemInt => "A1D0";
+use constant sysTrapTblSetItemStyle => "A1D1";
+use constant sysTrapTblUnhighlightSelection => "A1D2";
+use constant sysTrapTblSetRowUsable => "A1D3";
+use constant sysTrapTblGetNumberOfRows => "A1D4";
+use constant sysTrapTblSetCustomDrawProcedure => "A1D5";
+use constant sysTrapTblSetRowSelectable => "A1D6";
+use constant sysTrapTblRowSelectable => "A1D7";
+use constant sysTrapTblSetLoadDataProcedure => "A1D8";
+use constant sysTrapTblSetSaveDataProcedure => "A1D9";
+use constant sysTrapTblGetBounds => "A1DA";
+use constant sysTrapTblSetRowHeight => "A1DB";
+use constant sysTrapTblGetColumnWidth => "A1DC";
+use constant sysTrapTblGetRowID => "A1DD";
+use constant sysTrapTblSetRowID => "A1DE";
+use constant sysTrapTblMarkRowInvalid => "A1DF";
+use constant sysTrapTblMarkTableInvalid => "A1E0";
+use constant sysTrapTblGetSelection => "A1E1";
+use constant sysTrapTblInsertRow => "A1E2";
+use constant sysTrapTblRemoveRow => "A1E3";
+use constant sysTrapTblRowInvalid => "A1E4";
+use constant sysTrapTblRedrawTable => "A1E5";
+use constant sysTrapTblRowUsable => "A1E6";
+use constant sysTrapTblReleaseFocus => "A1E7";
+use constant sysTrapTblEditing => "A1E8";
+use constant sysTrapTblGetCurrentField => "A1E9";
+use constant sysTrapTblSetColumnUsable => "A1EA";
+use constant sysTrapTblGetRowHeight => "A1EB";
+use constant sysTrapTblSetColumnWidth => "A1EC";
+use constant sysTrapTblGrabFocus => "A1ED";
+use constant sysTrapTblSetItemPtr => "A1EE";
+use constant sysTrapTblFindRowID => "A1EF";
+use constant sysTrapTblGetLastUsableRow => "A1F0";
+use constant sysTrapTblGetColumnSpacing => "A1F1";
+use constant sysTrapTblFindRowData => "A1F2";
+use constant sysTrapTblGetRowData => "A1F3";
+use constant sysTrapTblSetRowData => "A1F4";
+use constant sysTrapTblSetColumnSpacing => "A1F5";
+use constant sysTrapWinCreateWindow => "A1F6";
+use constant sysTrapWinCreateOffscreenWindow => "A1F7";
+use constant sysTrapWinDeleteWindow => "A1F8";
+use constant sysTrapWinInitializeWindow => "A1F9";
+use constant sysTrapWinAddWindow => "A1FA";
+use constant sysTrapWinRemoveWindow => "A1FB";
+use constant sysTrapWinSetActiveWindow => "A1FC";
+use constant sysTrapWinSetDrawWindow => "A1FD";
+use constant sysTrapWinGetDrawWindow => "A1FE";
+use constant sysTrapWinGetActiveWindow => "A1FF";
+use constant sysTrapWinGetDisplayWindow => "A200";
+use constant sysTrapWinGetFirstWindow => "A201";
+use constant sysTrapWinEnableWindow => "A202";
+use constant sysTrapWinDisableWindow => "A203";
+use constant sysTrapWinGetWindowFrameRect => "A204";
+use constant sysTrapWinDrawWindowFrame => "A205";
+use constant sysTrapWinEraseWindow => "A206";
+use constant sysTrapWinSaveBits => "A207";
+use constant sysTrapWinRestoreBits => "A208";
+use constant sysTrapWinCopyRectangle => "A209";
+use constant sysTrapWinScrollRectangle => "A20A";
+use constant sysTrapWinGetDisplayExtent => "A20B";
+use constant sysTrapWinGetWindowExtent => "A20C";
+use constant sysTrapWinDisplayToWindowPt => "A20D";
+use constant sysTrapWinWindowToDisplayPt => "A20E";
+use constant sysTrapWinGetClip => "A20F";
+use constant sysTrapWinSetClip => "A210";
+use constant sysTrapWinResetClip => "A211";
+use constant sysTrapWinClipRectangle => "A212";
+use constant sysTrapWinDrawLine => "A213";
+use constant sysTrapWinDrawGrayLine => "A214";
+use constant sysTrapWinEraseLine => "A215";
+use constant sysTrapWinInvertLine => "A216";
+use constant sysTrapWinFillLine => "A217";
+use constant sysTrapWinDrawRectangle => "A218";
+use constant sysTrapWinEraseRectangle => "A219";
+use constant sysTrapWinInvertRectangle => "A21A";
+use constant sysTrapWinDrawRectangleFrame => "A21B";
+use constant sysTrapWinDrawGrayRectangleFrame => "A21C";
+use constant sysTrapWinEraseRectangleFrame => "A21D";
+use constant sysTrapWinInvertRectangleFrame => "A21E";
+use constant sysTrapWinGetFramesRectangle => "A21F";
+use constant sysTrapWinDrawChars => "A220";
+use constant sysTrapWinEraseChars => "A221";
+use constant sysTrapWinInvertChars => "A222";
+use constant sysTrapWinGetPattern => "A223";
+use constant sysTrapWinSetPattern => "A224";
+use constant sysTrapWinSetUnderlineMode => "A225";
+use constant sysTrapWinDrawBitmap => "A226";
+use constant sysTrapWinModal => "A227";
+use constant sysTrapWinGetWindowBounds => "A228";
+use constant sysTrapWinFillRectangle => "A229";
+use constant sysTrapWinDrawInvertedChars => "A22A";
+use constant sysTrapPrefOpenPreferenceDBV10 => "A22B";
+use constant sysTrapPrefGetPreferences => "A22C";
+use constant sysTrapPrefSetPreferences => "A22D";
+use constant sysTrapPrefGetAppPreferencesV10 => "A22E";
+use constant sysTrapPrefSetAppPreferencesV10 => "A22F";
+use constant sysTrapSndInit => "A230";
+use constant sysTrapSndSetDefaultVolume => "A231";
+use constant sysTrapSndGetDefaultVolume => "A232";
+use constant sysTrapSndDoCmd => "A233";
+use constant sysTrapSndPlaySystemSound => "A234";
+use constant sysTrapAlmInit => "A235";
+use constant sysTrapAlmCancelAll => "A236";
+use constant sysTrapAlmAlarmCallback => "A237";
+use constant sysTrapAlmSetAlarm => "A238";
+use constant sysTrapAlmGetAlarm => "A239";
+use constant sysTrapAlmDisplayAlarm => "A23A";
+use constant sysTrapAlmEnableNotification => "A23B";
+use constant sysTrapHwrGetRAMMapping => "A23C";
+use constant sysTrapHwrMemWritable => "A23D";
+use constant sysTrapHwrMemReadable => "A23E";
+use constant sysTrapHwrDoze => "A23F";
+use constant sysTrapHwrSleep => "A240";
+use constant sysTrapHwrWake => "A241";
+use constant sysTrapHwrSetSystemClock => "A242";
+use constant sysTrapHwrSetCPUDutyCycle => "A243";
+use constant sysTrapHwrDisplayInit => "A244";
+use constant sysTrapHwrDisplaySleep => "A245";
+use constant sysTrapHwrTimerInit => "A246";
+use constant sysTrapHwrCursorV33 => "A247";
+use constant sysTrapHwrBatteryLevel => "A248";
+use constant sysTrapHwrDelay => "A249";
+use constant sysTrapHwrEnableDataWrites => "A24A";
+use constant sysTrapHwrDisableDataWrites => "A24B";
+use constant sysTrapHwrLCDBaseAddrV33 => "A24C";
+use constant sysTrapHwrDisplayDrawBootScreen => "A24D";
+use constant sysTrapHwrTimerSleep => "A24E";
+use constant sysTrapHwrTimerWake => "A24F";
+use constant sysTrapHwrDisplayWake => "A250";
+use constant sysTrapHwrIRQ1Handler => "A251";
+use constant sysTrapHwrIRQ2Handler => "A252";
+use constant sysTrapHwrIRQ3Handler => "A253";
+use constant sysTrapHwrIRQ4Handler => "A254";
+use constant sysTrapHwrIRQ5Handler => "A255";
+use constant sysTrapHwrIRQ6Handler => "A256";
+use constant sysTrapHwrDockSignals => "A257";
+use constant sysTrapHwrPluggedIn => "A258";
+use constant sysTrapCrc16CalcBlock => "A259";
+use constant sysTrapSelectDayV10 => "A25A";
+use constant sysTrapSelectTimeV33 => "A25B";
+use constant sysTrapDayDrawDaySelector => "A25C";
+use constant sysTrapDayHandleEvent => "A25D";
+use constant sysTrapDayDrawDays => "A25E";
+use constant sysTrapDayOfWeek => "A25F";
+use constant sysTrapDaysInMonth => "A260";
+use constant sysTrapDayOfMonth => "A261";
+use constant sysTrapDateDaysToDate => "A262";
+use constant sysTrapDateToDays => "A263";
+use constant sysTrapDateAdjust => "A264";
+use constant sysTrapDateSecondsToDate => "A265";
+use constant sysTrapDateToAscii => "A266";
+use constant sysTrapDateToDOWDMFormat => "A267";
+use constant sysTrapTimeToAscii => "A268";
+use constant sysTrapFind => "A269";
+use constant sysTrapFindStrInStr => "A26A";
+use constant sysTrapFindSaveMatch => "A26B";
+use constant sysTrapFindGetLineBounds => "A26C";
+use constant sysTrapFindDrawHeader => "A26D";
+use constant sysTrapPenOpen => "A26E";
+use constant sysTrapPenClose => "A26F";
+use constant sysTrapPenGetRawPen => "A270";
+use constant sysTrapPenCalibrate => "A271";
+use constant sysTrapPenRawToScreen => "A272";
+use constant sysTrapPenScreenToRaw => "A273";
+use constant sysTrapPenResetCalibration => "A274";
+use constant sysTrapPenSleep => "A275";
+use constant sysTrapPenWake => "A276";
+use constant sysTrapResLoadForm => "A277";
+use constant sysTrapResLoadMenu => "A278";
+use constant sysTrapFtrInit => "A279";
+use constant sysTrapFtrUnregister => "A27A";
+use constant sysTrapFtrGet => "A27B";
+use constant sysTrapFtrSet => "A27C";
+use constant sysTrapFtrGetByIndex => "A27D";
+use constant sysTrapGrfInit => "A27E";
+use constant sysTrapGrfFree => "A27F";
+use constant sysTrapGrfGetState => "A280";
+use constant sysTrapGrfSetState => "A281";
+use constant sysTrapGrfFlushPoints => "A282";
+use constant sysTrapGrfAddPoint => "A283";
+use constant sysTrapGrfInitState => "A284";
+use constant sysTrapGrfCleanState => "A285";
+use constant sysTrapGrfMatch => "A286";
+use constant sysTrapGrfGetMacro => "A287";
+use constant sysTrapGrfFilterPoints => "A288";
+use constant sysTrapGrfGetNumPoints => "A289";
+use constant sysTrapGrfGetPoint => "A28A";
+use constant sysTrapGrfFindBranch => "A28B";
+use constant sysTrapGrfMatchGlyph => "A28C";
+use constant sysTrapGrfGetGlyphMapping => "A28D";
+use constant sysTrapGrfGetMacroName => "A28E";
+use constant sysTrapGrfDeleteMacro => "A28F";
+use constant sysTrapGrfAddMacro => "A290";
+use constant sysTrapGrfGetAndExpandMacro => "A291";
+use constant sysTrapGrfProcessStroke => "A292";
+use constant sysTrapGrfFieldChange => "A293";
+use constant sysTrapGetCharSortValue => "A294";
+use constant sysTrapGetCharAttr => "A295";
+use constant sysTrapGetCharCaselessValue => "A296";
+use constant sysTrapPwdExists => "A297";
+use constant sysTrapPwdVerify => "A298";
+use constant sysTrapPwdSet => "A299";
+use constant sysTrapPwdRemove => "A29A";
+use constant sysTrapGsiInitialize => "A29B";
+use constant sysTrapGsiSetLocation => "A29C";
+use constant sysTrapGsiEnable => "A29D";
+use constant sysTrapGsiEnabled => "A29E";
+use constant sysTrapGsiSetShiftState => "A29F";
+use constant sysTrapKeyInit => "A2A0";
+use constant sysTrapKeyHandleInterrupt => "A2A1";
+use constant sysTrapKeyCurrentState => "A2A2";
+use constant sysTrapKeyResetDoubleTap => "A2A3";
+use constant sysTrapKeyRates => "A2A4";
+use constant sysTrapKeySleep => "A2A5";
+use constant sysTrapKeyWake => "A2A6";
+use constant sysTrapDlkControl => "A2A7";
+use constant sysTrapDlkStartServer => "A2A8";
+use constant sysTrapDlkGetSyncInfo => "A2A9";
+use constant sysTrapDlkSetLogEntry => "A2AA";
+use constant sysTrapIntlDispatch => "A2AB";
+use constant sysTrapSysLibLoad => "A2AC";
+use constant sysTrapSndPlaySmf => "A2AD";
+use constant sysTrapSndCreateMidiList => "A2AE";
+use constant sysTrapAbtShowAbout => "A2AF";
+use constant sysTrapMdmDial => "A2B0";
+use constant sysTrapMdmHangUp => "A2B1";
+use constant sysTrapDmSearchRecord => "A2B2";
+use constant sysTrapSysInsertionSort => "A2B3";
+use constant sysTrapDmInsertionSort => "A2B4";
+use constant sysTrapLstSetTopItem => "A2B5";
+use constant sysTrapSclSetScrollBar => "A2B6";
+use constant sysTrapSclDrawScrollBar => "A2B7";
+use constant sysTrapSclHandleEvent => "A2B8";
+use constant sysTrapSysMailboxCreate => "A2B9";
+use constant sysTrapSysMailboxDelete => "A2BA";
+use constant sysTrapSysMailboxFlush => "A2BB";
+use constant sysTrapSysMailboxSend => "A2BC";
+use constant sysTrapSysMailboxWait => "A2BD";
+use constant sysTrapSysTaskWait => "A2BE";
+use constant sysTrapSysTaskWake => "A2BF";
+use constant sysTrapSysTaskWaitClr => "A2C0";
+use constant sysTrapSysTaskSuspend => "A2C1";
+use constant sysTrapSysTaskResume => "A2C2";
+use constant sysTrapCategoryCreateList => "A2C3";
+use constant sysTrapCategoryFreeList => "A2C4";
+use constant sysTrapCategoryEditV20 => "A2C5";
+use constant sysTrapCategorySelect => "A2C6";
+use constant sysTrapDmDeleteCategory => "A2C7";
+use constant sysTrapSysEvGroupCreate => "A2C8";
+use constant sysTrapSysEvGroupSignal => "A2C9";
+use constant sysTrapSysEvGroupRead => "A2CA";
+use constant sysTrapSysEvGroupWait => "A2CB";
+use constant sysTrapEvtEventAvail => "A2CC";
+use constant sysTrapEvtSysEventAvail => "A2CD";
+use constant sysTrapStrNCopy => "A2CE";
+use constant sysTrapKeySetMask => "A2CF";
+use constant sysTrapSelectDay => "A2D0";
+use constant sysTrapPrefGetPreference => "A2D1";
+use constant sysTrapPrefSetPreference => "A2D2";
+use constant sysTrapPrefGetAppPreferences => "A2D3";
+use constant sysTrapPrefSetAppPreferences => "A2D4";
+use constant sysTrapFrmPointInTitle => "A2D5";
+use constant sysTrapStrNCat => "A2D6";
+use constant sysTrapMemCmp => "A2D7";
+use constant sysTrapTblSetColumnEditIndicator => "A2D8";
+use constant sysTrapFntWordWrap => "A2D9";
+use constant sysTrapFldGetScrollValues => "A2DA";
+use constant sysTrapSysCreateDataBaseList => "A2DB";
+use constant sysTrapSysCreatePanelList => "A2DC";
+use constant sysTrapDlkDispatchRequest => "A2DD";
+use constant sysTrapStrPrintF => "A2DE";
+use constant sysTrapStrVPrintF => "A2DF";
+use constant sysTrapPrefOpenPreferenceDB => "A2E0";
+use constant sysTrapSysGraffitiReferenceDialog => "A2E1";
+use constant sysTrapSysKeyboardDialog => "A2E2";
+use constant sysTrapFntWordWrapReverseNLines => "A2E3";
+use constant sysTrapFntGetScrollValues => "A2E4";
+use constant sysTrapTblSetRowStaticHeight => "A2E5";
+use constant sysTrapTblHasScrollBar => "A2E6";
+use constant sysTrapSclGetScrollBar => "A2E7";
+use constant sysTrapFldGetNumberOfBlankLines => "A2E8";
+use constant sysTrapSysTicksPerSecond => "A2E9";
+use constant sysTrapHwrBacklightV33 => "A2EA";
+use constant sysTrapDmDatabaseProtect => "A2EB";
+use constant sysTrapTblSetBounds => "A2EC";
+use constant sysTrapStrNCompare => "A2ED";
+use constant sysTrapStrNCaselessCompare => "A2EE";
+use constant sysTrapPhoneNumberLookup => "A2EF";
+use constant sysTrapFrmSetMenu => "A2F0";
+use constant sysTrapEncDigestMD5 => "A2F1";
+use constant sysTrapDmFindSortPosition => "A2F2";
+use constant sysTrapSysBinarySearch => "A2F3";
+use constant sysTrapSysErrString => "A2F4";
+use constant sysTrapSysStringByIndex => "A2F5";
+use constant sysTrapEvtAddUniqueEventToQueue => "A2F6";
+use constant sysTrapStrLocalizeNumber => "A2F7";
+use constant sysTrapStrDelocalizeNumber => "A2F8";
+use constant sysTrapLocGetNumberSeparators => "A2F9";
+use constant sysTrapMenuSetActiveMenuRscID => "A2FA";
+use constant sysTrapLstScrollList => "A2FB";
+use constant sysTrapCategoryInitialize => "A2FC";
+use constant sysTrapEncDigestMD4 => "A2FD";
+use constant sysTrapEncDES => "A2FE";
+use constant sysTrapLstGetVisibleItems => "A2FF";
+use constant sysTrapWinSetWindowBounds => "A300";
+use constant sysTrapCategorySetName => "A301";
+use constant sysTrapFldSetInsertionPoint => "A302";
+use constant sysTrapFrmSetObjectBounds => "A303";
+use constant sysTrapWinSetColors => "A304";
+use constant sysTrapFlpDispatch => "A305";
+use constant sysTrapFlpEmDispatch => "A306";
+use constant sysTrapExgInit => "A307";
+use constant sysTrapExgConnect => "A308";
+use constant sysTrapExgPut => "A309";
+use constant sysTrapExgGet => "A30A";
+use constant sysTrapExgAccept => "A30B";
+use constant sysTrapExgDisconnect => "A30C";
+use constant sysTrapExgSend => "A30D";
+use constant sysTrapExgReceive => "A30E";
+use constant sysTrapExgRegisterData => "A30F";
+use constant sysTrapExgNotifyReceive => "A310";
+use constant sysTrapExgControl => "A311";
+use constant sysTrapPrgStartDialogV31 => "A312";
+use constant sysTrapPrgStopDialog => "A313";
+use constant sysTrapPrgUpdateDialog => "A314";
+use constant sysTrapPrgHandleEvent => "A315";
+use constant sysTrapImcReadFieldNoSemicolon => "A316";
+use constant sysTrapImcReadFieldQuotablePrintable => "A317";
+use constant sysTrapImcReadPropertyParameter => "A318";
+use constant sysTrapImcSkipAllPropertyParameters => "A319";
+use constant sysTrapImcReadWhiteSpace => "A31A";
+use constant sysTrapImcWriteQuotedPrintable => "A31B";
+use constant sysTrapImcWriteNoSemicolon => "A31C";
+use constant sysTrapImcStringIsAscii => "A31D";
+use constant sysTrapTblGetItemFont => "A31E";
+use constant sysTrapTblSetItemFont => "A31F";
+use constant sysTrapFontSelect => "A320";
+use constant sysTrapFntDefineFont => "A321";
+use constant sysTrapCategoryEdit => "A322";
+use constant sysTrapSysGetOSVersionString => "A323";
+use constant sysTrapSysBatteryInfo => "A324";
+use constant sysTrapSysUIBusy => "A325";
+use constant sysTrapWinValidateHandle => "A326";
+use constant sysTrapFrmValidatePtr => "A327";
+use constant sysTrapCtlValidatePointer => "A328";
+use constant sysTrapWinMoveWindowAddr => "A329";
+use constant sysTrapFrmAddSpaceForObject => "A32A";
+use constant sysTrapFrmNewForm => "A32B";
+use constant sysTrapCtlNewControl => "A32C";
+use constant sysTrapFldNewField => "A32D";
+use constant sysTrapLstNewList => "A32E";
+use constant sysTrapFrmNewLabel => "A32F";
+use constant sysTrapFrmNewBitmap => "A330";
+use constant sysTrapFrmNewGadget => "A331";
+use constant sysTrapFileOpen => "A332";
+use constant sysTrapFileClose => "A333";
+use constant sysTrapFileDelete => "A334";
+use constant sysTrapFileReadLow => "A335";
+use constant sysTrapFileWrite => "A336";
+use constant sysTrapFileSeek => "A337";
+use constant sysTrapFileTell => "A338";
+use constant sysTrapFileTruncate => "A339";
+use constant sysTrapFileControl => "A33A";
+use constant sysTrapFrmActiveState => "A33B";
+use constant sysTrapSysGetAppInfo => "A33C";
+use constant sysTrapSysGetStackInfo => "A33D";
+use constant sysTrapWinScreenMode => "A33E";
+use constant sysTrapHwrLCDGetDepthV33 => "A33F";
+use constant sysTrapHwrGetROMToken => "A340";
+use constant sysTrapDbgControl => "A341";
+use constant sysTrapExgDBRead => "A342";
+use constant sysTrapExgDBWrite => "A343";
+use constant sysTrapHostControl => "A344";
+use constant sysTrapFrmRemoveObject => "A345";
+use constant sysTrapSysReserved1 => "A346";
+use constant sysTrapSysReserved2 => "A347";
+use constant sysTrapSysReserved3 => "A348";
+use constant sysTrapOEMDispatch => "A349";
+use constant sysTrapHwrLCDContrastV33 => "A34A";
+use constant sysTrapSysLCDContrast => "A34B";
+use constant sysTrapUIContrastAdjust => "A34C";
+use constant sysTrapHwrDockStatus => "A34D";
+use constant sysTrapFntWidthToOffset => "A34E";
+use constant sysTrapSelectOneTime => "A34F";
+use constant sysTrapWinDrawChar => "A350";
+use constant sysTrapWinDrawTruncChars => "A351";
+use constant sysTrapSysNotifyInit => "A352";
+use constant sysTrapSysNotifyRegister => "A353";
+use constant sysTrapSysNotifyUnregister => "A354";
+use constant sysTrapSysNotifyBroadcast => "A355";
+use constant sysTrapSysNotifyBroadcastDeferred => "A356";
+use constant sysTrapSysNotifyDatabaseAdded => "A357";
+use constant sysTrapSysNotifyDatabaseRemoved => "A358";
+use constant sysTrapSysWantEvent => "A359";
+use constant sysTrapFtrPtrNew => "A35A";
+use constant sysTrapFtrPtrFree => "A35B";
+use constant sysTrapFtrPtrResize => "A35C";
+use constant sysTrapSysReserved5 => "A35D";
+use constant sysTrapHwrNVPrefSet => "A35E";
+use constant sysTrapHwrNVPrefGet => "A35F";
+use constant sysTrapFlashInit => "A360";
+use constant sysTrapFlashCompress => "A361";
+use constant sysTrapFlashErase => "A362";
+use constant sysTrapFlashProgram => "A363";
+use constant sysTrapAlmTimeChange => "A364";
+use constant sysTrapErrAlertCustom => "A365";
+use constant sysTrapPrgStartDialog => "A366";
+use constant sysTrapSerialDispatch => "A367";
+use constant sysTrapHwrBattery => "A368";
+use constant sysTrapDmGetDatabaseLockState => "A369";
+use constant sysTrapCncGetProfileList => "A36A";
+use constant sysTrapCncGetProfileInfo => "A36B";
+use constant sysTrapCncAddProfile => "A36C";
+use constant sysTrapCncDeleteProfile => "A36D";
+use constant sysTrapSndPlaySmfResource => "A36E";
+use constant sysTrapMemPtrDataStorage => "A36F";
+use constant sysTrapClipboardAppendItem => "A370";
+use constant sysTrapWiCmdV32 => "A371";
+use constant sysTrapHwrDisplayAttributes => "A372";
+use constant sysTrapHwrDisplayDoze => "A373";
+use constant sysTrapHwrDisplayPalette => "A374";
+use constant sysTrapBltFindIndexes => "A375";
+use constant sysTrapBltGetBitsAddr => "A376";
+use constant sysTrapBltCopyRectangle => "A377";
+use constant sysTrapBltDrawChars => "A378";
+use constant sysTrapBltLineRoutine => "A379";
+use constant sysTrapBltRectangleRoutine => "A37A";
+use constant sysTrapScrCompress => "A37B";
+use constant sysTrapScrDecompress => "A37C";
+use constant sysTrapSysLCDBrightness => "A37D";
+use constant sysTrapWinPaintChar => "A37E";
+use constant sysTrapWinPaintChars => "A37F";
+use constant sysTrapWinPaintBitmap => "A380";
+use constant sysTrapWinGetPixel => "A381";
+use constant sysTrapWinPaintPixel => "A382";
+use constant sysTrapWinDrawPixel => "A383";
+use constant sysTrapWinErasePixel => "A384";
+use constant sysTrapWinInvertPixel => "A385";
+use constant sysTrapWinPaintPixels => "A386";
+use constant sysTrapWinPaintLines => "A387";
+use constant sysTrapWinPaintLine => "A388";
+use constant sysTrapWinPaintRectangle => "A389";
+use constant sysTrapWinPaintRectangleFrame => "A38A";
+use constant sysTrapWinPaintPolygon => "A38B";
+use constant sysTrapWinDrawPolygon => "A38C";
+use constant sysTrapWinErasePolygon => "A38D";
+use constant sysTrapWinInvertPolygon => "A38E";
+use constant sysTrapWinFillPolygon => "A38F";
+use constant sysTrapWinPaintArc => "A390";
+use constant sysTrapWinDrawArc => "A391";
+use constant sysTrapWinEraseArc => "A392";
+use constant sysTrapWinInvertArc => "A393";
+use constant sysTrapWinFillArc => "A394";
+use constant sysTrapWinPushDrawState => "A395";
+use constant sysTrapWinPopDrawState => "A396";
+use constant sysTrapWinSetDrawMode => "A397";
+use constant sysTrapWinSetForeColor => "A398";
+use constant sysTrapWinSetBackColor => "A399";
+use constant sysTrapWinSetTextColor => "A39A";
+use constant sysTrapWinGetPatternType => "A39B";
+use constant sysTrapWinSetPatternType => "A39C";
+use constant sysTrapWinPalette => "A39D";
+use constant sysTrapWinRGBToIndex => "A39E";
+use constant sysTrapWinIndexToRGB => "A39F";
+use constant sysTrapWinScreenLock => "A3A0";
+use constant sysTrapWinScreenUnlock => "A3A1";
+use constant sysTrapWinGetBitmap => "A3A2";
+use constant sysTrapUIColorInit => "A3A3";
+use constant sysTrapUIColorGetTableEntryIndex => "A3A4";
+use constant sysTrapUIColorGetTableEntryRGB => "A3A5";
+use constant sysTrapUIColorSetTableEntry => "A3A6";
+use constant sysTrapUIColorPushTable => "A3A7";
+use constant sysTrapUIColorPopTable => "A3A8";
+use constant sysTrapCtlNewGraphicControl => "A3A9";
+use constant sysTrapTblGetItemPtr => "A3AA";
+use constant sysTrapUIBrightnessAdjust => "A3AB";
+use constant sysTrapUIPickColor => "A3AC";
+use constant sysTrapEvtSetAutoOffTimer => "A3AD";
+use constant sysTrapTsmDispatch => "A3AE";
+use constant sysTrapOmDispatch => "A3AF";
+use constant sysTrapDmOpenDBNoOverlay => "A3B0";
+use constant sysTrapDmOpenDBWithLocale => "A3B1";
+use constant sysTrapResLoadConstant => "A3B2";
+use constant sysTrapHwrPreDebugInit => "A3B3";
+use constant sysTrapHwrResetNMI => "A3B4";
+use constant sysTrapHwrResetPWM => "A3B5";
+use constant sysTrapKeyBootKeys => "A3B6";
+use constant sysTrapDbgSerDrvOpen => "A3B7";
+use constant sysTrapDbgSerDrvClose => "A3B8";
+use constant sysTrapDbgSerDrvControl => "A3B9";
+use constant sysTrapDbgSerDrvStatus => "A3BA";
+use constant sysTrapDbgSerDrvWriteChar => "A3BB";
+use constant sysTrapDbgSerDrvReadChar => "A3BC";
+use constant sysTrapHwrPostDebugInit => "A3BD";
+use constant sysTrapHwrIdentifyFeatures => "A3BE";
+use constant sysTrapHwrModelSpecificInit => "A3BF";
+use constant sysTrapHwrModelInitStage2 => "A3C0";
+use constant sysTrapHwrInterruptsInit => "A3C1";
+use constant sysTrapHwrSoundOn => "A3C2";
+use constant sysTrapHwrSoundOff => "A3C3";
+use constant sysTrapSysKernelClockTick => "A3C4";
+use constant sysTrapMenuEraseMenu => "A3C5";
+use constant sysTrapSelectTime => "A3C6";
+use constant sysTrapMenuCmdBarAddButton => "A3C7";
+use constant sysTrapMenuCmdBarGetButtonData => "A3C8";
+use constant sysTrapMenuCmdBarDisplay => "A3C9";
+use constant sysTrapHwrGetSilkscreenID => "A3CA";
+use constant sysTrapEvtGetSilkscreenAreaList => "A3CB";
+use constant sysTrapSysFatalAlertInit => "A3CC";
+use constant sysTrapDateTemplateToAscii => "A3CD";
+use constant sysTrapSecVerifyPW => "A3CE";
+use constant sysTrapSecSelectViewStatus => "A3CF";
+use constant sysTrapTblSetColumnMasked => "A3D0";
+use constant sysTrapTblSetRowMasked => "A3D1";
+use constant sysTrapTblRowMasked => "A3D2";
+use constant sysTrapFrmCustomResponseAlert => "A3D3";
+use constant sysTrapFrmNewGsi => "A3D4";
+use constant sysTrapMenuShowItem => "A3D5";
+use constant sysTrapMenuHideItem => "A3D6";
+use constant sysTrapMenuAddItem => "A3D7";
+use constant sysTrapFrmSetGadgetHandler => "A3D8";
+use constant sysTrapCtlSetGraphics => "A3D9";
+use constant sysTrapCtlGetSliderValues => "A3DA";
+use constant sysTrapCtlSetSliderValues => "A3DB";
+use constant sysTrapCtlNewSliderControl => "A3DC";
+use constant sysTrapLastTrapNumber => "A3DD";
+
+1;
diff --git a/Scripting/Perl/EmUtils.pm b/Scripting/Perl/EmUtils.pm
new file mode 100644
index 0000000..625da89
--- /dev/null
+++ b/Scripting/Perl/EmUtils.pm
@@ -0,0 +1,228 @@
+########################################################################
+#
+# File: EmUtils.pm
+#
+# Purpose: High-level utilities for scripting the Palm OS
+# Emulator
+#
+# Description: This file contains the following useful utilities:
+#
+# Wait
+# Wait for a signal from the Emulator.
+#
+# TapPen
+# Tap the pen at the given x,y location.
+#
+# TapButton
+# Tap the pen on the button with the given name.
+#
+# ClipperGoToURL
+# Launches the web clipping application with a given URL.
+#
+########################################################################
+
+package EmUtils;
+
+use strict;
+use vars qw(@ISA @EXPORT);
+
+use EmFunctions; # EvtEnqueuePenPoint, etc.
+use HostControl; # HostSignalWait, HostSignalResume, etc.
+
+use Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(
+ Wait
+ Resume
+ TapPen TapPenSync
+ TapButton TapButtonSync
+ EnterKey EnterKeySync
+ ClipperGoToURL
+
+);
+
+
+########################################################################
+#
+# FUNCTION: Wait
+#
+# DESCRIPTION: Wait for a signal from the Palm OS Emulator.
+#
+# PARAMETERS: timeout in milliseconds.
+#
+# RETURNED: List containing the HostSignalResume error code
+# and the number of the signalled event.
+#
+########################################################################
+
+sub Wait
+{
+ my $timeout = $_[0];
+ if (not defined $timeout)
+ {
+ $timeout = 0x7fffffff;
+ }
+
+ my ($err, $signal) = HostSignalWait ($timeout);
+ die "Didn't hear back from Poser, stopped" if ($err != 0);
+
+ ($err, $signal);
+}
+
+
+########################################################################
+#
+# FUNCTION: Resume
+#
+# DESCRIPTION: Resume the Palm OS Emulator after it paused itself
+# after sending a signal.
+#
+# PARAMETERS: none.
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub Resume
+{
+ HostSignalResume ();
+}
+
+
+########################################################################
+#
+# FUNCTION: TapPen
+#
+# DESCRIPTION: Simulate a tap at the given location, then wait for
+# the next null event.
+#
+# PARAMETERS: x, y coordinates.
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub TapPen
+{
+ EvtEnqueuePenPoint ({x => 256 - $_[0], y => 256 - $_[1]});
+ EvtEnqueuePenPoint ({x => -1, y => -1});
+}
+
+sub TapPenSync
+{
+ Wait ();
+ TapPen (@_);
+ Resume ();
+}
+
+
+########################################################################
+#
+# FUNCTION: TapButton
+#
+# DESCRIPTION: Simulate a tap on the named button, then wait for
+# the next null event.
+#
+# PARAMETERS: Name of the button to tap on.
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub TapButton
+{
+ my ($button_name) = @_;
+ my($ii);
+
+ my ($form) = FrmGetActiveForm();
+ my ($num_objects) = FrmGetNumberOfObjects($form);
+
+ for $ii (0..$num_objects - 1)
+ {
+ my ($object_type) = FrmGetObjectType($form, $ii);
+
+ if ($object_type == EmFunctions::frmControlObj)
+ {
+ my ($obj_ptr) = FrmGetObjectPtr ($form, $ii);
+ my ($address, $label) = CtlGetLabel($obj_ptr);
+
+ if ($label eq $button_name)
+ {
+ my (%bounds) = FrmGetObjectBounds($form, $ii);
+
+ my ($x, $y) = ( $bounds{left} + $bounds{width} / 2,
+ $bounds{top} + $bounds{height} / 2);
+
+ ($x, $y) = WinWindowToDisplayPt ($x, $y);
+
+ TapPen ($x, $y);
+
+ last; # break out of the for loop.
+ }
+ }
+ }
+}
+
+sub TapButtonSync
+{
+ Wait ();
+ TapButton (@_);
+ Resume ();
+}
+
+########################################################################
+#
+# FUNCTION: EnterKey
+#
+# DESCRIPTION: Enter a key, then wait for the next null event.
+#
+# PARAMETERS: WChar asciiChar, UInt16 keycode, UInt16 modifiers
+#
+# RETURNED: Nothing.
+#
+########################################################################
+
+sub EnterKey
+{
+ EvtEnqueueKey($_[0], $_[1], $_[2]);
+}
+
+sub EnterKeySync
+{
+ Wait ();
+ EnterKey (@_);
+ Resume ();
+}
+
+########################################################################
+#
+# FUNCTION: ClipperGoToURL
+#
+# AUTHOR: Flash Sheridan, based on C code by David Fedor
+#
+# DESCRIPTION: Launches Clipper to view the given URL.
+#
+# PARAMETERS: URL string
+#
+# RETURNS: An OS error code; zero means no error.
+#
+########################################################################
+
+sub ClipperGoToURL
+{
+ my $url = $_[0] . "\0";
+ my $sysAppLaunchCmdGoToURL = 54;
+ my($ClipperID);
+#ifndef PUBLIC_STUFF_STRIPPED
+ $ClipperID = (DmFindDatabase (0, "Web Browser"));
+#endif // PUBLIC_STUFF_STRIPPED
+ $ClipperID = DmFindDatabase (0, "Clipper") if not $ClipperID;
+ die "Clipper not found" unless $ClipperID;
+
+ my $cmdPB = MemPtrNew (length ($url));
+ EmRPC::WriteBlock ($cmdPB, $url);
+ MemPtrSetOwner($cmdPB, 0);
+ SysUIAppSwitch (0, $ClipperID, $sysAppLaunchCmdGoToURL, $cmdPB);
+}
+
+1;
diff --git a/Scripting/Perl/FormSpy.pl b/Scripting/Perl/FormSpy.pl
new file mode 100755
index 0000000..f4d2a19
--- /dev/null
+++ b/Scripting/Perl/FormSpy.pl
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -w
+########################################################################
+#
+# File: FormSpy.pl
+#
+# Purpose: Examine the current active form.
+#
+# Description: This script gets the current active form, iterates
+# over its contents, and prints out information on
+# all of the form objects. For each object, it prints
+#
+# * The object's index number (starting from zero)
+# * The object's type (frmTitleObj, etc.)
+# * Text associated with the object (only for title,
+# label, and control objects)
+# * The object's bounds
+#
+########################################################################
+
+use EmRPC; # EmRPC::OpenConnection, CloseConnection
+use EmFunctions;
+
+EmRPC::OpenConnection(6415, "localhost");
+
+ #=====================================================================
+ # Get the current form and the number objects on that form.
+ #=====================================================================
+
+ my ($form) = FrmGetActiveForm();
+ my ($num_objects) = FrmGetNumberOfObjects($form);
+
+ #=====================================================================
+ # Iterate over all the objects on the form.
+ #=====================================================================
+
+ for $ii (0..$num_objects - 1)
+ {
+ #=====================================================================
+ # Start generating the line to print. Start with the object's index.
+ #=====================================================================
+
+ my ($line) = "$ii. ";
+
+ #=====================================================================
+ # Add the object's type (frmTitleObj, etc.) to the line.
+ #=====================================================================
+
+ my ($object_type) = FrmGetObjectType($form, $ii);
+
+ my ($type) = ("frmFieldObj", "frmControlObj", "frmListObj", "frmTableObj",
+ "frmBitmapObj", "frmLineObj", "frmFrameObj", "frmRectangleObj",
+ "frmLabelObj", "frmTitleObj", "frmPopupObj", "frmGraffitiStateObj",
+ "frmGadgetObj", "frmScrollBarObj")[$object_type];
+
+ $line .= " $type";
+
+ #=====================================================================
+ # If the object is a frmControlObj, frmLabelObj, or frmTitleObj,
+ # get the text associated with the object and add it to our line.
+ #=====================================================================
+
+ if ($object_type == frmControlObj)
+ {
+ my ($obj_ptr) = FrmGetObjectPtr ($form, $ii);
+ my ($address, $label) = CtlGetLabel($obj_ptr);
+ $line .= " \"$label\"";
+ }
+ elsif ($object_type == frmLabelObj)
+ {
+ my ($label_id) = FrmGetObjectId ($form, $ii);
+ my ($address, $label) = FrmGetLabel($form, $label_id);
+ $line .= " \"$label\"";
+ }
+ elsif ($object_type == frmTitleObj)
+ {
+ my ($address, $title) = FrmGetTitle($form,);
+ $line .= " \"$title\"";
+ }
+ else
+ {
+ $line .= " <no label>";
+ }
+
+ #=====================================================================
+ # Add the object's bounds to the line.
+ #=====================================================================
+
+ my (%bounds) = FrmGetObjectBounds($form, $ii);
+ $line .= " ($bounds{left}, $bounds{top}, $bounds{right}, $bounds{bottom})";
+
+ #=====================================================================
+ # Print out the result.
+ #=====================================================================
+
+ print "$line\n";
+ }
+
+EmRPC::CloseConnection();
diff --git a/Scripting/Perl/HostControl.pm b/Scripting/Perl/HostControl.pm
new file mode 100644
index 0000000..4d481c8
--- /dev/null
+++ b/Scripting/Perl/HostControl.pm
@@ -0,0 +1,897 @@
+########################################################################
+#
+# File: HostControl.pm
+#
+# Purpose: Perl wrappers for Palm OS Emulator HostControl
+# functions.
+#
+# Description: This file contains Perl equivalents of Palm OS
+# Emulator Host Control functions, like HostGetHostID,
+# HostGetHostVersion, HostProfileStart etc...
+#
+# In general, functions follow the calling
+# conventions in the SDK headers. However, there
+# are exceptions. See the comments before each
+# subroutine for details.
+#
+########################################################################
+
+package HostControl;
+
+use EmRPC qw(DoRPC);
+use EmSysTraps;
+
+use strict;
+use vars qw(@ISA @EXPORT);
+
+use Exporter;
+@ISA = qw(Exporter);
+
+@EXPORT = qw(
+
+ HostGetHostVersion HostGetHostID HostGetHostPlatform
+ HostIsSelectorImplemented HostGestalt HostIsCallingTrap
+
+ HostProfileInit HostProfileStart HostProfileStop HostProfileDump
+ HostProfileCleanup HostProfileDetailFn
+
+ HostErrNo HostFClose HostFEOF HostFError HostFFlush HostFGetC
+ HostFGetPos HostFGetS HostFOpen HostFPrintF HostFPutC HostFPutS
+ HostFRead HostRemove HostRename HostFReopen HostFScanF HostFSeek
+ HostFSetPos HostFTell HostFWrite HostTmpFile HostTmpNam HostGetEnv
+
+ HostMalloc HostRealloc HostFree
+
+ HostGremlinIsRunning HostGremlinNumber HostGremlinCounter
+ HostGremlinLimit HostGremlinNew
+
+ HostImportFile HostExportFile
+
+ HostGetPreference HostSetPreference
+
+ HostLogFile HostSetLogFileSize
+
+ HostSessionCreate HostSessionOpen HostSessionClose HostSessionQuit
+ HostSignalSend HostSignalWait HostSignalResume
+
+ HostTraceInit HostTraceClose HostTraceOutputT HostTraceOutputTL
+ HostTraceOutputVT HostTraceOutputVTL HostTraceOutputB
+
+);
+
+#// HostControl.h functions.
+
+# Host information selectors
+use constant hostSelectorGetHostVersion => 0x0100;
+use constant hostSelectorGetHostID => 0x0101;
+use constant hostSelectorGetHostPlatform => 0x0102;
+use constant hostSelectorIsSelectorImplemented => 0x0103;
+use constant hostSelectorGestalt => 0x0104;
+use constant hostSelectorIsCallingTrap => 0x0105;
+
+# Profiler Selectors
+use constant hostSelectorProfileInit => 0x0200;
+use constant hostSelectorProfileStart => 0x0201;
+use constant hostSelectorProfileStop => 0x0202;
+use constant hostSelectorProfileDump => 0x0203;
+use constant hostSelectorProfileCleanup => 0x0204;
+use constant hostSelectorProfileDetailFn => 0x0205;
+
+# Std C Library wrapper selectors
+
+use constant hostSelectorErrNo => 0x0300;
+
+use constant hostSelectorFClose => 0x0301;
+use constant hostSelectorFEOF => 0x0302;
+use constant hostSelectorFError => 0x0303;
+use constant hostSelectorFFlush => 0x0304;
+use constant hostSelectorFGetC => 0x0305;
+use constant hostSelectorFGetPos => 0x0306;
+use constant hostSelectorFGetS => 0x0307;
+use constant hostSelectorFOpen => 0x0308;
+use constant hostSelectorFPrintF => 0x0309; # Floating point not yet supported in Poser
+use constant hostSelectorFPutC => 0x030A;
+use constant hostSelectorFPutS => 0x030B;
+use constant hostSelectorFRead => 0x030C;
+use constant hostSelectorRemove => 0x030D; # Not yet implemented in Poser
+use constant hostSelectorRename => 0x030E; # Not yet implemented in Poser
+use constant hostSelectorFReopen => 0x030F; # Not yet implemented in Poser
+use constant hostSelectorFScanF => 0x0310; # Not yet implemented in Poser
+use constant hostSelectorFSeek => 0x0311;
+use constant hostSelectorFSetPos => 0x0312;
+use constant hostSelectorFTell => 0x0313;
+use constant hostSelectorFWrite => 0x0314;
+use constant hostSelectorTmpFile => 0x0315;
+use constant hostSelectorTmpNam => 0x0316; # Not yet implemented in Poser
+use constant hostSelectorGetEnv => 0x0317;
+
+use constant hostSelectorMalloc => 0x0318; # Not yet implemented in Poser
+use constant hostSelectorRealloc => 0x0319; # Not yet implemented in Poser
+use constant hostSelectorFree => 0x031A; # Not yet implemented in Poser
+
+# Gremlin Selectors
+use constant hostSelectorGremlinIsRunning => 0x0400;
+use constant hostSelectorGremlinNumber => 0x0401;
+use constant hostSelectorGremlinCounter => 0x0402;
+use constant hostSelectorGremlinLimit => 0x0403;
+use constant hostSelectorGremlinNew => 0x0404;
+
+# Database Selectors
+use constant hostSelectorImportFile => 0x0500;
+use constant hostSelectorExportFile => 0x0501;
+
+# Preference Selectors
+use constant hostSelectorGetPreference => 0x0600;
+use constant hostSelectorSetPreference => 0x0601;
+
+# Logging Selectors
+use constant hostSelectorLogFile => 0x0700;
+use constant hostSelectorSetLogFileSize => 0x0701;
+
+# RPC Selectors
+use constant hostSelectorSessionCreate => 0x0800; # Not yet implemented in Poser
+use constant hostSelectorSessionOpen => 0x0801; # Not yet implemented in Poser
+use constant hostSelectorSessionClose => 0x0802;
+use constant hostSelectorSessionQuit => 0x0803;
+use constant hostSelectorSignalSend => 0x0804;
+use constant hostSelectorSignalWait => 0x0805;
+use constant hostSelectorSignalResume => 0x0806;
+
+# External tracing tool support
+use constant hostSelectorTraceInit => 0x0900;
+use constant hostSelectorTraceClose => 0x0901;
+use constant hostSelectorTraceOutputT => 0x0902;
+use constant hostSelectorTraceOutputTL => 0x0903;
+use constant hostSelectorTraceOutputVT => 0x0904;
+use constant hostSelectorTraceOutputVTL => 0x0905;
+use constant hostSelectorTraceOutputB => 0x0906;
+
+use constant hostSelectorLastTrapNumber => 0x0907;
+
+
+#/* ==================================================================== */
+#/* Host environment-related calls */
+#/* ==================================================================== */
+
+########################################################################
+#
+# FUNCTION: HostGetHostVersion
+#
+# DESCRIPTION: Get the version number of the host (Palm OS Emulator).
+#
+# PARAMETERS: None
+#
+# RETURNS: Version number of Poser in Palm OS version format.
+#
+########################################################################
+
+sub HostGetHostVersion
+{
+ # long HostGetHostVersion(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGetHostVersion, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGetHostID
+#
+# DESCRIPTION: Get the ID of the debugging host.
+#
+# PARAMETERS: None
+#
+# RETURNS: hostIDPalmOS, hostIDPalmOSEmulator, hostIDPalmOSSimulator
+# etc...
+#
+########################################################################
+
+sub HostGetHostID
+{
+ # HostID HostGetHostID(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGetHostID, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGetHostPlatform
+#
+# DESCRIPTION: Get the host platform ID.
+# hostPlatformPalmOS, hostPlatformWindows,
+# hostPlatformMacintosh, hostPlatformUnix etc...
+#
+# PARAMETERS: None
+#
+# RETURNS: hostPlatformPalmOS, hostPlatformWindows,
+# hostPlatformMacintosh, hostPlatformUnix etc...
+#
+########################################################################
+
+sub HostGetHostPlatform
+{
+ # HostPlatform HostGetHostPlatform(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGetHostPlatform, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostIsSelectorImplemented
+#
+# DESCRIPTION: Determines if the particular selector is implemented.
+#
+# PARAMETERS: None
+#
+# RETURNS: True or False.
+#
+########################################################################
+
+sub HostIsSelectorImplemented
+{
+ # HostBool HostIsSelectorImplemented(long selector)
+
+ my ($return, $format) = ("int32", "int16 int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorIsSelectorImplemented, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGestalt
+#
+# DESCRIPTION: Return queries about the Runtime environment.
+#
+# PARAMETERS: None
+#
+# RETURNS: Runtime environment info.
+#
+########################################################################
+
+sub HostGestalt
+{
+ # HostErr HostGestalt(long gestSel, long* response)
+
+ my ($return, $format) = ("HostErr", "int16 int32 rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGestalt, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostIsCallingTrap
+#
+# DESCRIPTION: Determines if the Palm OS Emulator is currently
+# calling a trap. True if so, false if not.
+#
+# PARAMETERS: None
+#
+# RETURNS: True if trap is being called, false if not.
+#
+########################################################################
+
+sub HostIsCallingTrap
+{
+ # HostBool HostIsCallingTrap(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorIsCallingTrap, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/* ==================================================================== */
+#/* Profiling-related calls */
+#/* ==================================================================== */
+
+
+########################################################################
+#
+# FUNCTION: HostProfileInit
+#
+# DESCRIPTION: Initializes and enables profiling in debugging host.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileInit
+{
+ # HostErr HostProfileInit(long maxCalls, long maxDepth)
+
+ my ($return, $format) = ("HostErr", "int16 int32 int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileInit, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostProfileDetailFn
+#
+# DESCRIPTION: Profiles the function that contains the specified
+# address.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileDetailFn
+{
+ # HostErr HostProfileDetailFn(void* addr, HostBool logDetails)
+
+ my ($return, $format) = ("HostErr", "int16 rptr int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileDetailFn, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostProfileStart
+#
+# DESCRIPTION: Turns Profiling on.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileStart
+{
+ # HostErr HostProfileStart(void)
+
+ my ($return, $format) = ("HostErr", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileStart, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostProfileStop
+#
+# DESCRIPTION: Initializes and enables profiling in debugging host.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileStop
+{
+ # HostErr HostProfileStop(void)
+
+ my ($return, $format) = ("HostErr", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileStop, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostProfileDump
+#
+# DESCRIPTION: Writes the current profiling information to the
+# named file.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileDump
+{
+ # HostErr HostProfileDump(const char* filename)
+
+ my ($return, $format) = ("HostErr", "int16 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileDump, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostProfileCleanup
+#
+# DESCRIPTION: Initializes and enables profiling in debugging host.
+#
+# PARAMETERS: None
+#
+# RETURNS: Returns zero if successful, non-zero otherwise.
+#
+########################################################################
+
+sub HostProfileCleanup
+{
+ # HostErr HostProfileCleanup(void)
+
+ my ($return, $format) = ("HostErr", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorProfileCleanup, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/* ==================================================================== */
+#/* Std C Library-related calls */
+#/* ADD LATER!!! */
+#/* ==================================================================== */
+
+
+#/* ==================================================================== */
+#/* Gremlin-related calls */
+#/* ==================================================================== */
+
+
+########################################################################
+#
+# FUNCTION: HostGremlinIsRunning
+#
+# DESCRIPTION: Determines if Gremlin is currently running.
+#
+# PARAMETERS: None
+#
+# RETURNS: True if a gremlin is currently running, False otherwise.
+#
+########################################################################
+
+sub HostGremlinIsRunning
+{
+ # HostBool HostGremlinIsRunning(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGremlinIsRunning, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGremlinNumber
+#
+# DESCRIPTION: Retrieves the number of the currently running gremlin.
+#
+# PARAMETERS: None
+#
+# RETURNS: The number of the current gremlin.
+# Only valid if a gremlin is currently executing.
+#
+########################################################################
+
+sub HostGremlinNumber
+{
+ # long HostGremlinNumber(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGremlinNumber, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGremlinCounter
+#
+# DESCRIPTION: Returns the current event counter of the currently
+# running gremlin.
+#
+# PARAMETERS: None
+#
+# RETURNS: Current event counter.
+# Only valid if a gremlin is currently executing.
+#
+########################################################################
+
+sub HostGremlinCounter
+{
+ # long HostGremlinCounter(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGremlinCounter, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGremlinLimit
+#
+# DESCRIPTION: Retrieves the limit value of the currently running gremlin.
+#
+# PARAMETERS: None
+#
+# RETURNS: Limit value of the currently running gremlin.
+# Only valid if a gremlin is currently executing.
+#
+########################################################################
+
+sub HostGremlinLimit
+{
+ # long HostGremlinLimit(void)
+
+ my ($return, $format) = ("int32", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGremlinLimit, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGremlinNew
+#
+# DESCRIPTION: Start a new Gremlin Horde.
+#
+# PARAMETERS: Starting Gremlin number.
+# Ending Gremlin number.
+# Frequency (in terms of Gremlin events) at which
+# states are automatically saved.
+# Switching depth (number of events generated before
+# switching to a different Gremlin).
+# Max depth (maximum number of events generated
+# for each Gremlin).
+# List of application names on which to run Gremlins.
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostGremlinNew
+{
+ # HostErr HostGremlinNew(const HostGremlinInfo*)
+
+ my($start, $stop, $save_freq, $switch_depth, $max_depth, @apps) = @_;
+
+ my ($app_string) = join (",", @apps);
+
+ my ($struct) = pack("NNNNN", $start, $stop, $save_freq, $switch_depth, $max_depth) . $app_string;
+
+ my ($return, $format) = ("HostErr", "int16 block");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGremlinNew, $struct);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/* ==================================================================== */
+#/* Import/export-related calls */
+#/* ==================================================================== */
+
+
+########################################################################
+#
+# FUNCTION: HostImportFile
+#
+# DESCRIPTION: Path to file on desktop
+# Card to import file to.
+#
+# PARAMETERS: None
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostImportFile
+{
+ # HostErr HostImportFile(const char* fileName, long cardNum)
+
+ my ($return, $format) = ("HostErr", "int16 string int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorImportFile, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostExportFile
+#
+# DESCRIPTION: Export a db from Emulator to the host.
+#
+# PARAMETERS: None
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostExportFile
+{
+ # HostErr HostExportFile(const char* fileName, long cardNum, const char* dbName)
+
+ my ($return, $format) = ("HostErr", "int16 string int32 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorExportFile, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/* ==================================================================== */
+#/* Logging-related calls */
+#/* ==================================================================== */
+
+
+########################################################################
+#
+# FUNCTION: HostSetPreference
+#
+# DESCRIPTION: Set a preference.
+#
+# PARAMETERS: prefName, The name of the preference whose value you
+# are setting.
+# prefValue, The new value of the preference.
+#
+# RETURNS: Nothing.
+#
+########################################################################
+
+sub HostSetPreference
+{
+ # void HostSetPreference(const char*, const char*)
+
+ my ($return, $format) = ("void", "int16 string string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSetPreference, @_);
+ #//EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostGetPreference
+#
+# DESCRIPTION: Export a db from Emulator to the host.
+#
+# PARAMETERS: prefName, The name of the preference whose value you
+# want to retrieve.
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostGetPreference
+{
+ # HostBool HostGetPreference(const char*, char*)
+
+ my ($return, $format) = ("int32", "int16 string string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorGetPreference, $_[0], "");
+ ($D0, prefName => $params[1],
+ prefValue => $params[2]);
+}
+
+
+
+
+########################################################################
+#
+# FUNCTION: HostSetLogFileSize
+#
+# DESCRIPTION: Determines the size of the log file the Palm OS
+# Emulator is using. By default the Palm OS Emulator
+# Uses a 1 MB log file to record the last 1 MB of
+# Log Data information.
+#
+# PARAMETERS: Size, The new size for the logging file in bytes.
+#
+# RETURNS: None.
+#
+#
+########################################################################
+
+sub HostSetLogFileSize
+{
+ # void HostSetLogFileSize(long)
+
+ my ($return, $format) = ("int16", "int16 int32");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSetLogFileSize, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+#/* ==================================================================== */
+#/* RPC-related calls */
+#/* ==================================================================== */
+
+
+########################################################################
+#
+# FUNCTION: HostSessionCreate
+#
+# DESCRIPTION: Create a new session.
+#
+# PARAMETERS: Name of device to emulate. Choices are: "Pilot",
+# "PalmPilot", "Palm III", "Palm IIIx",
+# "Palm V", "Palm VII".
+# RAM size (in K) to emulate.
+# Path to ROM to use.
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostSessionCreate
+{
+ # HostErr HostSessionCreate(const char* device, long ramSize, const char* romPath)
+
+ my ($return, $format) = ("HostErr", "int16 string int32 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSessionCreate, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSessionOpen
+#
+# DESCRIPTION: Open a previously create session file.
+#
+# PARAMETERS: Path to session file to open.
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostSessionOpen
+{
+ # HostErr HostSessionOpen(const char* psfFileName)
+
+ my ($return, $format) = ("HostErr", "int16 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSessionOpen, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSessionClose
+#
+# DESCRIPTION: Close the current session, optionally saving it.
+#
+# PARAMETERS: Name of session file to create. Can be null.
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostSessionClose
+{
+ # HostErr HostSessionClose(const char* saveFileName)
+
+ my ($return, $format) = ("HostErr", "int16 string");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSessionClose, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSessionQuit
+#
+# DESCRIPTION: Ask Palm OS Emulator to quit.
+#
+# PARAMETERS: None
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostSessionQuit
+{
+ # HostErr HostSessionQuit(void)
+
+ my ($return, $format) = ("HostErr", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSessionQuit, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSignalSend
+#
+# DESCRIPTION: Sends a signal to any script that has host signal
+# wait calls pending.
+#
+# PARAMETERS: signalNumber, The signal you want to wait for.
+#
+# RETURNS: List containing the error code and the numeric
+# signal value returned from the Emulator.
+#
+########################################################################
+
+sub HostSignalSend
+{
+ # HostErr HostSignalSend(HostSignal signalNumber)
+
+ my ($return, $format) = ("HostErr", "int16 int32*");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSignalSend, $_[0], 0);
+
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSignalWait
+#
+# DESCRIPTION: Wait for a signal from the Palm OS Emulator.
+#
+# PARAMETERS: timeout (in milliseconds)
+#
+# RETURNS: List containing the error code and the numeric
+# signal value returned from the Emulator.
+#
+########################################################################
+
+sub HostSignalWait
+{
+ # HostErr HostSignalWait(long timeout, HostSignal* signalNumber)
+
+ my ($return, $format) = ("HostErr", "int16 int32 rptr");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSignalWait, $_[0], 0);
+
+ ($D0, $params[2]); # 0 = selector, 1 = timeout, 2 = signal number
+}
+
+
+########################################################################
+#
+# FUNCTION: HostSignalResume
+#
+# DESCRIPTION: Tell the Emulator to resume after it has sent us
+# a signal.
+#
+# PARAMETERS: None
+#
+# RETURNS: Error code.
+#
+########################################################################
+
+sub HostSignalResume
+{
+ # HostErr HostSignalResume(void)
+
+ my ($return, $format) = ("HostErr", "int16");
+ my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
+ hostSelectorSignalResume, @_);
+ EmRPC::ReturnValue ($return, $D0, $A0, @params);
+}
diff --git a/Scripting/Perl/HostControlTest.pl b/Scripting/Perl/HostControlTest.pl
new file mode 100644
index 0000000..ab751e3
--- /dev/null
+++ b/Scripting/Perl/HostControlTest.pl
@@ -0,0 +1,87 @@
+#@INC = push (@INC, "D:/Emulator");
+#@INC = push (@INC, "D:/Emulator/Scripting/Perl");
+#print $INC;
+
+use EmRPC; # EmRPC::OpenConnection, CloseConnection
+use HostControl;
+use EmFunctions;
+use EmUtils; # TapPenSync, TapButtonSync
+
+print "Start HostControlTest.pl\n";
+
+
+
+EmRPC::OpenConnection(6415, "localhost");
+
+
+my ($hostVers) = HostGetHostVersion();
+print "HostGetHostVersion = $hostVers\n";
+
+my ($hostID) = HostGetHostID();
+print "HostGetHostID = $hostID\n";
+
+my ($hostPlatform) = HostGetHostPlatform();
+print "HostGetHostPlatform = $hostPlatform\n";
+
+my ($hostSelector1) = HostIsSelectorImplemented(hostSelectorGetHostVersion);
+print "HostIsSelectorImplemented (hostSelectorGetHostVersion) = $hostSelector1\n";
+
+my ($hostSelector2) = HostIsSelectorImplemented(hostSelectorGetHostID);
+print "HostIsSelectorImplemented (hostSelectorGetHostID) = $hostSelector2\n";
+
+my ($hostSelector3) = HostIsSelectorImplemented(hostSelectorProfileInit);
+print "HostIsSelectorImplemented (hostSelectorProfileInit) = $hostSelector3\n";
+
+my ($hostGestalt) = HostGestalt(1000);
+print ("HostGestalt 1000 = $hostGestalt\n");
+
+my ($hostIsCallingTrap) = HostIsCallingTrap();
+print ("HostIsCallingTrap = $hostIsCallingTrap\n");
+
+
+#// Profiling Calls
+my ($profileInit) = HostProfileInit(1000, 1000);
+print ("HostProfileInit = $profileInit\n");
+
+#my ($profileDetailFn) = HostProfileDetailFn();
+#print ("HostProfileDetailFn = $profileDetailFn\n");
+
+#// profileStart crashed the Emulator Profiler 3.0a5e3.
+my ($profileStart) = HostProfileStart();
+print ("HostProfileStart = $profileStart\n");
+
+ my ($gremlinResponse) = HostGremlinNew(0, 0, 10000, 1000, 10000, "Address");
+ print ("HostGremlinNew = $gremlinResponse\n");
+
+ my ($gremlinResponse) = HostGremlinLimit();
+ print ("HostGremlinLimit = $gremlinResponse\n");
+
+ my ($gremlinResponse) = HostGremlinNumber();
+ print ("HostGremlinNumber = $gremlinResponse\n");
+
+ my ($gremlinResponse) = HostGremlinLimit();
+ print ("HostGremlinLimit = $gremlinResponse\n");
+
+ my ($gremlinResponse) = HostGremlinIsRunning();
+ print ("HostGremlinIsRunning = $gremlinResponse\n");
+
+ my ($gremlinResponse) = HostGremlinCounter();
+ print ("HostGremlinCounter = $gremlinResponse\n");
+
+
+#// profileStart crashed the Emulator Profiler 3.0a5e3.
+#// x outside of string at d:\Emulator\Scripting\Perl/EmRPC.pm line 594
+my ($profileResponse) = HostProfileStop();
+print ("HostProfileStop = $profileResponse\n");
+
+my ($profileResponse) = HostProfileDump("D:\Emulator\Dump.txt");
+print ("HostProfileDump = $profileResponse\n");
+
+my ($profileResponse) = HostProfileCleanup();
+print ("HostProfileCleanup = $profileResponse\n");
+
+
+
+
+
+EmRPC::CloseConnection();
diff --git a/Scripting/Perl/ListDatabases.pl b/Scripting/Perl/ListDatabases.pl
new file mode 100755
index 0000000..97914ae
--- /dev/null
+++ b/Scripting/Perl/ListDatabases.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl -w
+#
+# 2001-11-08 John Marshall <jmarshall@acm.org>
+
+use strict;
+use Getopt::Std;
+
+use EmRPC;
+use EmFunctions;
+
+my %opt;
+getopt ('', \%opt);
+
+EmRPC::OpenConnection (@ARGV);
+
+my ($cardNo, $i, $lid);
+
+print "card/LocalID\ttype\tcrid\tname\n" unless defined $opt{q};
+
+for $cardNo (0 .. MemNumCards () - 1) {
+ for $i (0 .. DmNumDatabases ($cardNo) - 1) {
+ my $localID = DmGetDatabase ($cardNo, $i);
+ my ($err, %r) = DmDatabaseInfo ($cardNo, $localID);
+ printf "%d 0x%08x\t%s\t%s\t%s\n",
+ $cardNo, $localID,
+ pack ("N", $r{type}), pack ("N", $r{creator}), $r{name};
+ }
+ }
+
+EmRPC::CloseConnection ();
diff --git a/Scripting/Perl/ListOpenDatabases.pl b/Scripting/Perl/ListOpenDatabases.pl
new file mode 100755
index 0000000..dec547e
--- /dev/null
+++ b/Scripting/Perl/ListOpenDatabases.pl
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+# Lists all databases open in the current thread, topmost first. Obscure
+# fields are open count (#) and the mode with which the db was opened (see
+# &openflags below).
+#
+# 2001-10-25 John Marshall <jmarshall@acm.org>
+
+use strict;
+
+use EmRPC;
+use EmFunctions;
+
+EmRPC::OpenConnection (@ARGV);
+
+sub openflags {
+ my ($f) = @_;
+ local $_ = "";
+ $_ .= "R" if $f & dmModeReadOnly;
+ $_ .= "W" if $f & dmModeWrite;
+ $_ .= "L" if $f & dmModeLeaveOpen;
+ $_ .= "E" if $f & dmModeExclusive;
+ $_ .= "S" if $f & dmModeShowSecret;
+ return $_;
+ }
+
+print "DmOpenRef card/LocalID # mode r/type/crid name\n";
+
+my $db = 0;
+while (($db = DmNextOpenDatabase ($db)) != 0) {
+ printf "0x%08x ", $db;
+
+ my ($err, %r) = DmOpenDatabaseInfo ($db);
+
+ if ($err == 0) {
+ printf "%d 0x%08x%3d %-5s %s ",
+ $r{cardNo}, $r{dbID}, $r{openCount}, openflags($r{mode}),
+ $r{resDB}? "R" : "D";
+
+ my ($err, %r) = DmDatabaseInfo ($r{cardNo}, $r{dbID});
+
+ if ($err == 0) {
+ $_ = pack "NcN", $r{type}, ord " ", $r{creator};
+ s/[[:^print:]]/./g;
+ print "$_ $r{name}";
+ }
+ else { printf "[DmDatabaseInfo failed: 0x%x]", $err; }
+ }
+ else { printf "[DmOpenDatabaseInfo failed: 0x%x]", $err; }
+
+ print "\n";
+ }
+
+EmRPC::CloseConnection ();
diff --git a/Scripting/Perl/MakeSysTraps.pl b/Scripting/Perl/MakeSysTraps.pl
new file mode 100644
index 0000000..a70029f
--- /dev/null
+++ b/Scripting/Perl/MakeSysTraps.pl
@@ -0,0 +1,88 @@
+#Usage for #define format is `perl MakeSysTraps.pl -d /path/to/systrap.h'.
+
+use strict;
+
+if (@ARGV == 0)
+{
+ print <<EOF;
+Usage: $0 [-cds] file...
+Generates an annotated list of systraps from the named files.
+ <default> Produces output suitable for the build-prc data file.
+ -s Produces an asm include file.
+ -d Produces a bunch of #defines.
+ -c Produces a list of Perl constants.
+EOF
+ exit;
+}
+
+my ($format, $forConst);
+$forConst = 0;
+
+if ($ARGV[0] eq "-s")
+{
+ shift;
+ $format = "\t.equ %s,%s\n";
+ print <<EOF;
+/* DO NOT EDIT! This file was automatically produced by $0
+ from @ARGV */
+
+ .macro systrap trapname
+ trap #15
+ .word \\trapname
+ .endm
+
+EOF
+ }
+elsif ($ARGV[0] eq "-d")
+{
+ shift;
+ $format = "#define _P_sysTrap%s\t%s\n";
+ print <<EOF;
+/* DO NOT EDIT! This section was automatically produced by $0
+ from @ARGV */
+
+EOF
+}
+elsif ($ARGV[0] eq "-c")
+{
+ shift;
+ $format = "use constant sysTrap%s\t=> %s;\n";
+ $forConst = 1;
+ print <<EOF;
+# DO NOT EDIT! This section was automatically produced by $0
+# from @ARGV
+
+EOF
+}
+else
+{
+ $format = "<%s>\t%s\n";
+ print <<EOF;
+DO NOT EDIT! This file was automatically produced by $0
+from @ARGV
+
+EOF
+}
+
+my $num = 0;
+
+while (<>)
+{
+ s"//.*$""; # eat C++-style comments
+ s"/\*[^/]*\*/""g; # eat simple C-style comments (just in case)
+
+ if (/define\W+sysTrapBase\W+((0[xX][\da-fA-F]+)|(\d+))/)
+ {
+ $num = $1;
+ $num = oct $num if $num =~ /^0/;
+ }
+
+ next unless /=.*sysTrapBase.*,/ .. /}.*SysTrapNumber.*;/;
+
+ printf $format, $1, sprintf("\"%lX\"", $num++) if /sysTrap(\w+)\b/;
+}
+
+if ($forConst != 0)
+{
+ print "\n", "1;", "\n";
+}
diff --git a/Scripting/Perl/PoserRPC.pl b/Scripting/Perl/PoserRPC.pl
new file mode 100755
index 0000000..6141667
--- /dev/null
+++ b/Scripting/Perl/PoserRPC.pl
@@ -0,0 +1,313 @@
+#!/usr/bin/perl
+########################################################################
+#
+# File: PoserRPC.pl
+#
+# Purpose: Scrap file for testing Poser's RPC mechanism
+#
+# Description: This file contains a hodgepodge of scripts and
+# commands used to test out parts of Poser's RPC.
+# Don't take anything in this file too seriously;
+# it's provided only for completeness' sake.
+#
+########################################################################
+
+use EmRPC; # EmRPC::OpenConnection, CloseConnection
+use EmFunctions;
+use EmUtils; # Wait, TapPen, TapButton
+
+use constant hostSignalReserved => 0;
+use constant hostSignalIdle => 1;
+use constant hostSignalQuit => 2;
+use constant hostSignalSessionStarted => 3;
+use constant hostSignalSessionStopped => 4;
+
+EmRPC::OpenConnection(6415, "localhost");
+
+if (1)
+{
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispType, "xxxx");
+ print "hwrDispType", ($err ? ": err = $err" : (" = ", $result)), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispRev, "xx");
+ print "hwrDispRev", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispVers, "xx");
+ print "hwrDispVers", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispAllDepths, "xx");
+ print "hwrDispAllDepths", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispMaxDepth, "xx");
+ print "hwrDispMaxDepth", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispBootDepth, "xx");
+ print "hwrDispBootDepth", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispMaxGrays, "xx");
+ print "hwrDispMaxGrays", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispHorizontal, "xx");
+ print "hwrDispHorizontal", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispVertical, "xx");
+ print "hwrDispVertical", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispVRAMBaseAddr, "xxxx");
+ print "hwrDispVRAMBaseAddr", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispVRAMSize, "xxxx");
+ print "hwrDispVRAMSize", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispColor, "xx");
+ print "hwrDispColor", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispName, pack ("x32"));
+ print "hwrDispName", ($err ? ": err = $err" : (" = ", $result)), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispBaseAddr, "xxxx");
+ print "hwrDispBaseAddr", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispDepth, "xx");
+ print "hwrDispDepth", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispWidth, "xx");
+ print "hwrDispWidth", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispHeight, "xx");
+ print "hwrDispHeight", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispRowBytes, "xx");
+ print "hwrDispRowBytes", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispBacklight, "x");
+ print "hwrDispBacklight", ($err ? ": err = $err" : (" = ", unpack ("c", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispBrightness, "x");
+ print "hwrDispBrightness", ($err ? ": err = $err" : (" = ", unpack ("c", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispContrast, "x");
+ print "hwrDispContrast", ($err ? ": err = $err" : (" = ", unpack ("c", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispDbgIndicator, "xx");
+ print "hwrDispDbgIndicator", ($err ? ": err = $err" : (" = ", unpack ("n", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispEndAddr, "xxxx");
+ print "hwrDispEndAddr", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispBufferMask, "xxxx");
+ print "hwrDispBufferMask", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispResolutionX, "xxxx");
+ print "hwrDispResolutionX", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispResolutionY, "xxxx");
+ print "hwrDispResolutionY", ($err ? ": err = $err" : (" = ", unpack ("N", $result))), "\n";
+
+ my ($err, $result) = HwrDisplayAttributes (0, hwrDispMemAccessOK, "x");
+ print "hwrDispMemAccessOK", ($err ? ": err = $err" : (" = ", unpack ("c", $result))), "\n";
+}
+
+if (0)
+{
+ TapButtonSync("OK");
+}
+
+if (0)
+{
+ Wait();
+ $err = HostSessionClose (""); # Don't save
+ die "$err" if $err;
+ $err = HostSessionQuit ();
+ die "$err" if $err;
+}
+
+
+if (0)
+{
+ my ($err, $signal);
+
+ ########################################################################
+ print "Waiting for idle\n";
+
+ do {
+ ($err, $signal) = HostSignalWait (0x7fffffff);
+ if ($err)
+ {
+ HostSignalResume ();
+ die "Error $err while waiting for hostSignalIdle";
+ }
+ } while ($signal != hostSignalIdle);
+
+ ########################################################################
+ print "Closing session\n";
+
+ $err = HostSessionClose (""); # Don't save
+
+ ########################################################################
+ print "Waiting for session to close\n";
+
+ do {
+ ($err, $signal) = HostSignalWait (0x7fffffff);
+ if ($err)
+ {
+ HostSignalResume ();
+ die "Error $err while waiting for hostSignalSessionStopped";
+ }
+ } while ($signal != hostSignalSessionStopped);
+
+ ########################################################################
+ print "Creating session\n";
+
+ $err = HostSessionCreate ("PalmIII", 1024, "C:\\ROMs\\spp\\rom30dbg.rom");
+
+ ########################################################################
+ print "Waiting for session to start\n";
+
+ do {
+ ($err, $signal) = HostSignalWait (0x7fffffff);
+ if ($err)
+ {
+ HostSignalResume ();
+ die "Error $err while waiting for hostSignalSessionStarted";
+ }
+ } while ($signal != hostSignalSessionStarted);
+
+ ########################################################################
+ print "Closing session\n";
+
+ $err = HostSessionClose (""); # Don't save
+
+ ########################################################################
+ print "Waiting for session to close\n";
+
+ do {
+ ($err, $signal) = HostSignalWait (0x7fffffff);
+ if ($err)
+ {
+ HostSignalResume ();
+ die "Error $err while waiting for hostSignalSessionStopped";
+ }
+ } while ($signal != hostSignalSessionStopped);
+
+ ########################################################################
+
+ HostSignalResume ();
+ print "Done!\n";
+}
+
+if (0)
+{
+ $addr = MemPtrNew (100);
+ printf ("0x%08X\n", $addr);
+ EmRPC::WriteBlock ($addr, "1234567890");
+ $str = EmRPC::ReadBlock ($addr, 10);
+ print $str, "\n";
+ MemPtrFree ($addr);
+}
+
+if (0)
+{
+ TapPen (100, 100);
+}
+
+if (0)
+{
+ $vers = HostGetHostVersion ();
+ printf ("HostGetHostVersion() = 0x%08X\n", $vers);
+}
+
+if (0)
+{
+ $num = DmNumDatabases (0);
+ print "DmNumDatabases(0) = ", $num, "\n";
+
+ $localID = DmFindDatabase (0, "MemoDB");
+ printf ("DmFindDatabase(0, \"MemoDB\") = 0x%08X\n", $localID);
+
+ ($err, %results) = DmDatabaseInfo (0, $localID);
+ printf ("DmDatabaseInfo(0, 0x%08X) = 0x%08X\n", $localID, $err);
+ print ("results: \n");
+ print ("\tname = ", $results{name}, "\n");
+ print ("\tattributes = ", $results{attributes}, "\n");
+ print ("\tversion = ", $results{version}, "\n");
+ print ("\tcrDate = ", $results{crDate}, "\n");
+ print ("\tmodDate = ", $results{modDate}, "\n");
+ print ("\tbckUpDate = ", $results{bckUpDate}, "\n");
+ print ("\tmodNum = ", $results{modNum}, "\n");
+ print ("\tappInfoID = ", $results{appInfoID}, "\n");
+ print ("\tsortInfoID = ", $results{sortInfoID}, "\n");
+ print ("\ttype = ", $results{type}, "\n");
+ print ("\tcreator = ", $results{creator}, "\n");
+}
+
+if (0)
+{
+ $block = EmRPC::ReadBlock (0, 256);
+ EmRPC::PrintString ($block);
+}
+
+if (0)
+{
+ my ($form) = FrmGetActiveForm();
+ my ($num_objects) = FrmGetNumberOfObjects($form);
+
+ for $ii (0..$num_objects - 1)
+ {
+ my ($line) = "$ii. ";
+ my ($object_type) = FrmGetObjectType($form, $ii);
+
+ my ($type) = ("frmFieldObj", "frmControlObj", "frmListObj", "frmTableObj",
+ "frmBitmapObj", "frmLineObj", "frmFrameObj", "frmRectangleObj",
+ "frmLabelObj", "frmTitleObj", "frmPopupObj", "frmGraffitiStateObj",
+ "frmGadgetObj", "frmScrollBarObj")[$object_type];
+
+ $line .= " $type";
+
+ if ($object_type == frmControlObj)
+ {
+ my ($obj_ptr) = FrmGetObjectPtr ($form, $ii);
+ my ($address, $label) = CtlGetLabel($obj_ptr);
+ $line .= " \"$label\"";
+ }
+ elsif ($object_type == frmLabelObj)
+ {
+ my ($label_id) = FrmGetObjectId ($form, $ii);
+ my ($address, $label) = FrmGetLabel($form, $label_id);
+ $line .= " \"$label\"";
+ }
+ elsif ($object_type == frmTitleObj)
+ {
+ my ($address, $title) = FrmGetTitle($form,);
+ $line .= " \"$title\"";
+ }
+ else
+ {
+ $line .= " <no label>";
+ }
+
+ my (%bounds) = FrmGetObjectBounds($form, $ii);
+ $line .= " ($bounds{left}, $bounds{top}, $bounds{right}, $bounds{bottom})";
+
+ print "$line\n";
+ }
+}
+
+if (0)
+{
+ $err = HostSessionClose ("");
+ printf ("HostSessionClose() = 0x%08X\n", $err);
+
+ $err = HostSessionQuit ();
+ printf ("HostSessionQuit() = 0x%08X\n", $err);
+}
+
+if (0)
+{
+ HostGremlinNew (0, 3, 0, -1, 10000, "Memo Pad") == 0 || die "HostGremlinNew failed, stopped";
+}
+
+EmRPC::CloseConnection();
+
+
+
diff --git a/Scripting/Perl/SkipStartup.pl b/Scripting/Perl/SkipStartup.pl
new file mode 100755
index 0000000..2844c51
--- /dev/null
+++ b/Scripting/Perl/SkipStartup.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+########################################################################
+#
+# File: SkipStartup.pl
+#
+# Purpose: Skip the Palm V startup application.
+#
+# Description: Run this script to skip past the application that
+# automatically starts when cold-booting a Palm V
+# (or Palm IIIx). It generates the appropriate
+# pen events to "tap past" the initial forms.
+#
+########################################################################
+
+use EmRPC; # EmRPC::OpenConnection, CloseConnection
+use EmFunctions;
+use EmUtils; # TapPenSync, TapButtonSync
+
+
+EmRPC::OpenConnection(6415, "localhost");
+
+ TapPenSync (100, 100); # Tap past first setup screen
+ TapPenSync (100, 100); # Tap past second setup screen
+
+ TapPenSync (10, 10); # First tap in pen calibration screen
+ TapPenSync (160-10, 160-10); # Second tap in pen calibration screen
+ TapPenSync (80, 60); # Confirmation tap in pen calibration screen
+
+ Wait();
+ Resume();
+ my ($titleptr, $title) = FrmGetTitle (FrmGetActiveForm ());
+
+ if ($title eq "Select Language")
+ {
+ # Tap past the extra screens in a 4.0 EFIGS ROM
+ TapButtonSync ("OK");
+ TapButtonSync ("Yes");
+ }
+
+ TapButtonSync ("Next"); # Tap Next button
+ TapButtonSync ("Done"); # Tap Done button
+
+EmRPC::CloseConnection();
diff --git a/Scripting/Python/Poser.py b/Scripting/Python/Poser.py
new file mode 100644
index 0000000..0febf45
--- /dev/null
+++ b/Scripting/Python/Poser.py
@@ -0,0 +1,471 @@
+# ======================================================================================
+# Copyright (c) 1999-2001 Palm, Inc. or its subsidiaries.
+# All rights reserved.
+# ======================================================================================
+#
+# File: Poser.py
+# Author: David Creemer
+# Created: Thu Jul 29 17:05:33 PDT 1999
+
+""" This module implements a connection to the PalmOS Emulator
+POSER. It provides a socket for client - poser communications, and an
+hierarchy of classes for formatting poser RPC and other SysPackets
+calls. """
+
+import sys
+import socket
+from struct import pack, unpack
+from string import upper,atoi
+
+# -----------------------------------------------------------------------------
+# Utility functions
+
+def _memdump( baseaddr, len, data ):
+ """return a string that is a nicely formatted hex and ascii dump of a range of bytes"""
+
+ base = "Addr=0x%08X " % (baseaddr)
+ base = base + "Len=0x%04X (%d) " % (len, len)
+ for i in range(len):
+ if (i % 8) == 0:
+ base = base + "\n %08X " % (baseaddr + i)
+ base = base + " %02X" % ( ord(data[i]) )
+ return base
+
+# -----------------------------------------------------------------------------
+class ProtocolException:
+
+ def __init__( self, msg ):
+ self._message = msg
+
+# -----------------------------------------------------------------------------
+
+class Socket:
+ """defines the interface by which an application talks with a running poser"""
+
+ # packet header signatures
+ _HeaderSignature1 = 0xBEEF
+ _HeaderSignature2 = 0xED
+
+ def __init__( self ):
+ self._sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ self._transid = 1
+ self._src = 1
+ self._type = 0
+
+ # ----------------------------------------------------------------
+ # public API
+ # ----------------------------------------------------------------
+
+ def connect( self, addr="localhost", port=6414 ):
+ """connect to the running poser at the given host and port"""
+ self._sock.connect( addr, port )
+
+ def close( self ):
+ """terminate communication with the connected poser"""
+ self._sock.close()
+
+ def call( self, pkt ):
+ """call the connected poser with the given sysCall packet"""
+ # get the raw packet data
+ pkt._marshal()
+ # prepare the header
+ shdr = pack( ">HBBBBHB", Socket._HeaderSignature1, Socket._HeaderSignature2,
+ pkt._dest, self._src, self._type, len( pkt._data ), self._transid );
+ shdr = shdr + pack( ">B", self._calcHeaderChecksum( shdr ) )
+ # send the packet pieces
+ spkt = shdr + pkt._data + pack( ">H", self._calcFooterChecksum( pkt._data ) )
+ self._sock.send( spkt )
+ # read the header
+ rhdr = self._sock.recv( 10 )
+ ( h1, b1, rsrc, rdest, rtype, rlen, rtid, rhcs ) = unpack( ">HBBBBHBB", rhdr )
+ # read in the body
+ pkt._data = self._sock.recv( rlen )
+ # read in the footer
+ rftr = self._sock.recv( 2 )
+ (rbcs) = unpack( ">H", rftr )
+ # bump the transaction id
+ self._transid = self._transid + 1
+ pkt._unmarshal()
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _calcHeaderChecksum( self, bytes ):
+ """calculate the checksum for the packet header"""
+ cs = 0
+ for c in bytes:
+ cs = cs + ord( c )
+ if ( cs > 255 ):
+ cs = cs - 256
+ return cs
+
+ def _calcFooterChecksum( self, body ):
+ """calculate the checksum for the packet body"""
+ # TBD
+ return 0
+
+ def __repr__( self ):
+ return "<poser socket, tid=" + str( self._transid ) + ", sock=" + \
+ str( self._sock ) + ">"
+
+#-----------------------------------------------------------------------------
+# Abstract base class for all SysPackets
+#-----------------------------------------------------------------------------
+
+class SysPacket:
+ """abstract base class for all poser SysPacket messages"""
+
+ def __init__( self ):
+ self._data = None
+ self._command = 0x00
+ self._dest = 0
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _marshal( self ):
+ """pack the packet data into a binary stream"""
+ return pack( ">BB", self._command, 0 )
+
+ def _unmarshal( self ):
+ """pull the packet data from the binary stream"""
+ ( self._command, dummy ) = unpack( ">BB", self._data[0:2] )
+ self._data = self._data[2:]
+
+ def __repr__( self ):
+ return "cmd=0x%02X" % ( self._command )
+
+
+
+#-----------------------------------------------------------------------------
+# Memory Reading and Writing SysPackets
+#-----------------------------------------------------------------------------
+
+class SysPacketMem( SysPacket ):
+ """ abstract parent class of mem read/write packet classes"""
+
+ def __init__( self, addr, length ):
+ """instantiate generic memory sys packet"""
+ SysPacket.__init__( self )
+ self._dest = 1
+ self._memAddr = addr
+ self._memLength = length
+ self._memory = None
+
+ # ----------------------------------------------------------------
+ # public API
+ # ----------------------------------------------------------------
+
+ def getMemory( self ):
+ """return the memory read"""
+ return self._memory
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def __repr__( self ):
+ return SysPacket.__repr__( self ) + ", " + _memdump( self._memAddr, self._memLength, self._memory )
+
+#-----------------------------------------------------------------------------
+
+class SysPacketReadMem( SysPacketMem ):
+ """A poser sysPacket which reads PalmOS memory"""
+
+ def __init__( self, addr, length ):
+ """instantiate read memory packet"""
+ SysPacketMem.__init__( self, addr, length )
+ self._command = 0x01
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _marshal( self ):
+ """marshal the RPC information & parameters into a flat byte stream"""
+ self._data = SysPacket._marshal( self ) + pack( ">LH",
+ self._memAddr,
+ self._memLength )
+
+ def _unmarshal( self ):
+ """unmarshal the RPC information & parameters from the flat byte stream"""
+ SysPacket._unmarshal( self )
+ self._memory = self._data[0:self._memLength]
+
+#-----------------------------------------------------------------------------
+
+class SysPacketWriteMem( SysPacketMem ):
+ """A poser sysPacket which writes PalmOS memory"""
+
+ def __init__( self, addr, data, length ):
+ """instantiate write memory"""
+ SysPacketMem.__init__( self, addr, length )
+ self._command = 0x02
+ self._memory = data
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _marshal( self ):
+ """marshal the RPC information & parameters into a flat byte stream"""
+ fmt = ">LH" + str(self._memLength) + "s"
+ self._data = SysPacket._marshal( self ) + pack( fmt,
+ self._memAddr,
+ self._memLength,
+ self._memory )
+
+#-----------------------------------------------------------------------------
+# OS Trap RPC SysPackets
+#-----------------------------------------------------------------------------
+
+class SysPacketRPC( SysPacket ):
+ """A poser sysPacket which implements a RPC call/respone PalmOS Trap call"""
+
+ def __init__( self, trap ):
+ """instantiate new RPC call with the trap word to be called"""
+ SysPacket.__init__( self )
+ self._dest = 1
+ self._command = 0x0A
+ self._trap = trap
+ self._params = {}
+ self._paramnames = [] # used to preserver order
+ self._a0 = 0
+ self._d0 = 0
+
+ # ----------------------------------------------------------------
+ # public API
+ # ----------------------------------------------------------------
+
+ def __len__( self ):
+ # return # of params + A0 and D0 registers
+ return len( self._paramnames ) + 2
+
+ def keys( self ):
+ return self._paramnames + [ 'A0' , 'D0' ]
+
+ def __setitem__( self, key, param ):
+ if upper( key ) == 'A0':
+ self._a0 = param
+ elif upper( key ) == 'D0':
+ self._d0 = param
+ else:
+ self._params[ key ] = param
+ self._paramnames.insert( 0, key )
+
+ def __getitem__( self, key ):
+ if upper( key ) == 'A0':
+ return self._a0
+ elif upper( key ) == 'D0':
+ return self._d0
+ else:
+ return self._params[ key ]._getvalue()
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _marshal( self ):
+ """marshal the RPC information & parameters into a flat byte stream"""
+ self._data = SysPacket._marshal( self ) + pack( ">HLLH",
+ self._trap,
+ self._d0,
+ self._a0,
+ len( self._params ) )
+ for pname in self._paramnames:
+ self._data = self._data + self._params[ pname ]._data
+
+ def _unmarshal( self ):
+ """unmarshal the RPC information & parameters from the flat byte stream"""
+ SysPacket._unmarshal( self )
+
+ ( self._trap, self._d0, self._a0, pcount ) = unpack( ">HLLH", self._data[0:12] )
+ self._data = self._data[12:]
+
+ if pcount != len( self._paramnames ):
+ raise ProtocolException, "Unexpected number of return parameters"
+
+ for i in range( pcount ):
+ pname = self._paramnames[i]
+ ( dummy, size ) = unpack( ">BB", self._data[0:2] )
+ self._params[ pname ]._data = self._data[0:size+2]
+ self._data = self._data[size+2:]
+ self._params[ pname ]._unmarshal()
+
+ def __repr__( self ):
+ base = "<sysPacketRPC, " + SysPacket.__repr__( self )
+ base = base + ", trap=0x%04X, " % ( self._trap )
+ base = base + "a0=0x%08X, " % (self._a0)
+ base = base + "d0=0x%08X(%d), " % (self._d0, self._d0)
+ base = base + "Params("
+ for pname in self._paramnames:
+ base = base + " " + pname + "=" + str( self._params[ pname ] )
+ return base + " ) >"
+
+#-----------------------------------------------------------------------------
+
+class SysPacketRPC2( SysPacketRPC ):
+
+ def __init__( self, trap ):
+ """instantiate a new RPC2 call with the trap word to be called"""
+ SysPacketRPC.__init__( self, trap )
+ self._dest = 14
+ self._command = 0x70
+ self._registers = {} # for A0,A1...,D0,D1...
+ self._exception = 0
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ # register list. order is important: don't change it
+ _reglist = [ 'D7','D6','D5','D4','D3','D2','D1','D0','A7','A6','A5','A4','A3','A2','A1','A0' ]
+ _reglistrev = [ 'A0','A1','A2','A3','A4','A5','A6','A7','D0','D1','D2','D3','D4','D5','D6','D7' ]
+
+ def _isRegister( self, key ):
+ return upper( key ) in SysPacketRPC2._reglist
+
+ def _makeRegMask( self ):
+ mask = 0
+ for r in SysPacketRPC2._reglist:
+ mask = mask << 1
+ if self._registers.has_key( r ):
+ mask = mask | 1
+ return mask
+
+ def __setitem__( self, key, param ):
+ if self._isRegister( key ):
+ self._registers[ upper( key ) ] = param
+ else:
+ self._params[ key ] = param
+ self._paramnames.insert( 0, key )
+
+ def __getitem__( self, key ):
+ if upper( key ) == 'A0':
+ return self._a0
+ elif upper( key ) == 'D0':
+ return self._d0
+ elif self._isRegister( key ):
+ # this may throw an exception. That's ok.
+ return self._registers[ upper( key ) ]
+ elif upper( key ) == 'exception':
+ return self._exception
+ else:
+ return self._params[ key ]._getvalue()
+
+ def _marshal( self ):
+ """marshal the RPC information & parameters into a flat byte stream"""
+ self._data = SysPacket._marshal( self ) + pack( ">HLLHH",
+ self._trap,
+ self._d0,
+ self._a0,
+ self._exception,
+ self._makeRegMask() )
+ # add registers
+ for r in self._registers.keys():
+ self._data = self._data + pack( ">L", self._registers[ r ] )
+
+ # add parameters
+ self._data = self._data + pack( ">H", len( self._params ) )
+ for pname in self._paramnames:
+ self._data = self._data + self._params[ pname ]._data
+
+ def _unmarshal( self ):
+ """unmarshal the RPC information & parameters from the flat byte stream"""
+ SysPacket._unmarshal( self )
+ ( self._trap, self._d0, self._a0, self._exception, regmask ) = unpack( ">HLLHH",
+ self._data[0:14] )
+ self._data = self._data[14:]
+
+ # extract the registers ( if any )
+ for r in SysPacketRPC2._reglistrev:
+ # if the mask bit is set
+ if regmask & 0x0001:
+ # extract register value & trim unmarshalled data
+ ( self._registers[ r ], ) = unpack( ">L", self._data )
+ self._data = self._data[4:]
+ # go onto next bit in mask
+ regmask = regmask >> 1
+
+ # extract parameter count
+ ( pcount, ) = unpack( ">H", self._data[0:2] )
+ self._data = self._data[2:]
+
+ # extract paramters
+ if pcount != len( self._paramnames ):
+ raise ProtocolException, "Unexpected number of return parameters"
+
+ for i in range( pcount ):
+ pname = self._paramnames[i]
+ ( dummy, size ) = unpack( ">BB", self._data[0:2] )
+ self._params[ pname ]._data = self._data[0:size+2]
+ self._data = self._data[size+2:]
+ self._params[ pname ]._unmarshal()
+
+ def __repr__( self ):
+ base = "<sysPacketRPC2, " + SysPacket.__repr__( self )
+ base = base + ", trap=0x%04X, " % ( self._trap )
+ base = base + "a0=0x%08X, " % (self._a0)
+ base = base + "d0=0x%08X(%d), " % (self._d0, self._d0)
+ base = base + "exception=0x%04X, " % (self._exception)
+ base = base + "registers=" + str(self._registers)
+ base = base + "Params("
+ for pname in self._paramnames:
+ base = base + " " + pname + "=" + str( self._params[ pname ] )
+ return base + " ) >"
+
+#-----------------------------------------------------------------------------
+
+class RPCParam:
+ """a parameter to a poser SysPacketRPC(2) call"""
+
+ def __init__( self, byref, type, value ):
+ """instantiate new RPC parameter of a given type and value"""
+ self._type = type
+ self._value = value
+ if byref:
+ self._byref = 1
+ else:
+ self._byref = 0
+ self._data = None
+ self._calcSize()
+ self._marshal()
+
+ # ----------------------------------------------------------------
+ # implementation methods
+ # ----------------------------------------------------------------
+
+ def _getvalue( self ):
+ """return the value of the param as received from the wire"""
+ self._unmarshal()
+ return self._value
+
+ def _calcSize( self ):
+ """calculate the size of the parameter based on its type"""
+ t = upper( self._type[ -1 ] )
+ if t == 'B':
+ self._size = 1
+ elif t == 'H':
+ self._size = 2
+ elif t == 'L':
+ self._size = 4
+ elif t == 'S':
+ # string with specified size ('32s')
+ self._size = atoi( self._type[:-1] )
+
+ def _marshal( self ):
+ """flatten the RPC param into a binary stream"""
+ self._data = pack( ">BB" + self._type,
+ self._byref, self._size, self._value )
+
+ def _unmarshal( self ):
+ """pull the RPC param data from the binary stream"""
+ ( self._byref, self._size ) = unpack( ">BB", self._data[0:2] )
+ ( self._value, ) = unpack( ">" + self._type, self._data[2:] )
+
+ def __repr__( self ):
+ return "<sysPacketRPC param, byref=" + str( self._byref ) + ", type=" + \
+ str( self._type ) + ", size=" + str( self._size ) + ", value=" + \
+ str( self._value ) + ">"
diff --git a/Scripting/Python/SysTraps.py b/Scripting/Python/SysTraps.py
new file mode 100644
index 0000000..fa8f238
--- /dev/null
+++ b/Scripting/Python/SysTraps.py
@@ -0,0 +1,895 @@
+# ======================================================================================
+# Copyright (c) 1999-2001 Palm, Inc. or its subsidiaries.
+# All rights reserved.
+# ======================================================================================
+#
+# File: SysTraps.py
+# Author: David Creemer
+# Created: Thu Jul 29 17:05:33 PDT 1999
+
+# PalmOS Trap table (not complete)
+
+sysTraps = {}
+sysTraps['sysTrapMemInit'] = 0xA000
+sysTraps['sysTrapMemInitHeapTable'] = 0xA001
+sysTraps['sysTrapMemStoreInit'] = 0xA002
+sysTraps['sysTrapMemCardFormat'] = 0xA003
+sysTraps['sysTrapMemCardInfo'] = 0xA004
+sysTraps['sysTrapMemStoreInfo'] = 0xA005
+sysTraps['sysTrapMemStoreSetInfo'] = 0xA006
+sysTraps['sysTrapMemNumHeaps'] = 0xA007
+sysTraps['sysTrapMemNumRAMHeaps'] = 0xA008
+sysTraps['sysTrapMemHeapID'] = 0xA009
+sysTraps['sysTrapMemHeapPtr'] = 0xA00A
+sysTraps['sysTrapMemHeapFreeBytes'] = 0xA00B
+sysTraps['sysTrapMemHeapSize'] = 0xA00C
+sysTraps['sysTrapMemHeapFlags'] = 0xA00D
+sysTraps['sysTrapMemHeapCompact'] = 0xA00E
+sysTraps['sysTrapMemHeapInit'] = 0xA00F
+sysTraps['sysTrapMemHeapFreeByOwnerID'] = 0xA010
+sysTraps['sysTrapMemChunkNew'] = 0xA011
+sysTraps['sysTrapMemChunkFree'] = 0xA012
+sysTraps['sysTrapMemPtrNew'] = 0xA013
+sysTraps['sysTrapMemPtrRecoverHandle'] = 0xA014
+sysTraps['sysTrapMemPtrFlags'] = 0xA015
+sysTraps['sysTrapMemPtrSize'] = 0xA016
+sysTraps['sysTrapMemPtrOwner'] = 0xA017
+sysTraps['sysTrapMemPtrHeapID'] = 0xA018
+sysTraps['sysTrapMemPtrCardNo'] = 0xA019
+sysTraps['sysTrapMemPtrToLocalID'] = 0xA01A
+sysTraps['sysTrapMemPtrSetOwner'] = 0xA01B
+sysTraps['sysTrapMemPtrResize'] = 0xA01C
+sysTraps['sysTrapMemPtrResetLock'] = 0xA01D
+sysTraps['sysTrapMemHandleNew'] = 0xA01E
+sysTraps['sysTrapMemHandleLockCount'] = 0xA01F
+sysTraps['sysTrapMemHandleToLocalID'] = 0xA020
+sysTraps['sysTrapMemHandleLock'] = 0xA021
+sysTraps['sysTrapMemHandleUnlock'] = 0xA022
+sysTraps['sysTrapMemLocalIDToGlobal'] = 0xA023
+sysTraps['sysTrapMemLocalIDKind'] = 0xA024
+sysTraps['sysTrapMemLocalIDToPtr'] = 0xA025
+sysTraps['sysTrapMemMove'] = 0xA026
+sysTraps['sysTrapMemSet'] = 0xA027
+sysTraps['sysTrapMemStoreSearch'] = 0xA028
+sysTraps['sysTrapReserved6'] = 0xA029
+sysTraps['sysTrapMemKernelInit'] = 0xA02A
+sysTraps['sysTrapMemHandleFree'] = 0xA02B
+sysTraps['sysTrapMemHandleFlags'] = 0xA02C
+sysTraps['sysTrapMemHandleSize'] = 0xA02D
+sysTraps['sysTrapMemHandleOwner'] = 0xA02E
+sysTraps['sysTrapMemHandleHeapID'] = 0xA02F
+sysTraps['sysTrapMemHandleDataStorage'] = 0xA030
+sysTraps['sysTrapMemHandleCardNo'] = 0xA031
+sysTraps['sysTrapMemHandleSetOwner'] = 0xA032
+sysTraps['sysTrapMemHandleResize'] = 0xA033
+sysTraps['sysTrapMemHandleResetLock'] = 0xA034
+sysTraps['sysTrapMemPtrUnlock'] = 0xA035
+sysTraps['sysTrapMemLocalIDToLockedPtr'] = 0xA036
+sysTraps['sysTrapMemSetDebugMode'] = 0xA037
+sysTraps['sysTrapMemHeapScramble'] = 0xA038
+sysTraps['sysTrapMemHeapCheck'] = 0xA039
+sysTraps['sysTrapMemNumCards'] = 0xA03A
+sysTraps['sysTrapMemDebugMode'] = 0xA03B
+sysTraps['sysTrapMemSemaphoreReserve'] = 0xA03C
+sysTraps['sysTrapMemSemaphoreRelease'] = 0xA03D
+sysTraps['sysTrapMemHeapDynamic'] = 0xA03E
+sysTraps['sysTrapMemNVParams'] = 0xA03F
+sysTraps['sysTrapDmInit'] = 0xA040
+sysTraps['sysTrapDmCreateDatabase'] = 0xA041
+sysTraps['sysTrapDmDeleteDatabase'] = 0xA042
+sysTraps['sysTrapDmNumDatabases'] = 0xA043
+sysTraps['sysTrapDmGetDatabase'] = 0xA044
+sysTraps['sysTrapDmFindDatabase'] = 0xA045
+sysTraps['sysTrapDmDatabaseInfo'] = 0xA046
+sysTraps['sysTrapDmSetDatabaseInfo'] = 0xA047
+sysTraps['sysTrapDmDatabaseSize'] = 0xA048
+sysTraps['sysTrapDmOpenDatabase'] = 0xA049
+sysTraps['sysTrapDmCloseDatabase'] = 0xA04A
+sysTraps['sysTrapDmNextOpenDatabase'] = 0xA04B
+sysTraps['sysTrapDmOpenDatabaseInfo'] = 0xA04C
+sysTraps['sysTrapDmResetRecordStates'] = 0xA04D
+sysTraps['sysTrapDmGetLastErr'] = 0xA04E
+sysTraps['sysTrapDmNumRecords'] = 0xA04F
+sysTraps['sysTrapDmRecordInfo'] = 0xA050
+sysTraps['sysTrapDmSetRecordInfo'] = 0xA051
+sysTraps['sysTrapDmAttachRecord'] = 0xA052
+sysTraps['sysTrapDmDetachRecord'] = 0xA053
+sysTraps['sysTrapDmMoveRecord'] = 0xA054
+sysTraps['sysTrapDmNewRecord'] = 0xA055
+sysTraps['sysTrapDmRemoveRecord'] = 0xA056
+sysTraps['sysTrapDmDeleteRecord'] = 0xA057
+sysTraps['sysTrapDmArchiveRecord'] = 0xA058
+sysTraps['sysTrapDmNewHandle'] = 0xA059
+sysTraps['sysTrapDmRemoveSecretRecords'] = 0xA05A
+sysTraps['sysTrapDmQueryRecord'] = 0xA05B
+sysTraps['sysTrapDmGetRecord'] = 0xA05C
+sysTraps['sysTrapDmResizeRecord'] = 0xA05D
+sysTraps['sysTrapDmReleaseRecord'] = 0xA05E
+sysTraps['sysTrapDmGetResource'] = 0xA05F
+sysTraps['sysTrapDmGet1Resource'] = 0xA060
+sysTraps['sysTrapDmReleaseResource'] = 0xA061
+sysTraps['sysTrapDmResizeResource'] = 0xA062
+sysTraps['sysTrapDmNextOpenResDatabase'] = 0xA063
+sysTraps['sysTrapDmFindResourceType'] = 0xA064
+sysTraps['sysTrapDmFindResource'] = 0xA065
+sysTraps['sysTrapDmSearchResource'] = 0xA066
+sysTraps['sysTrapDmNumResources'] = 0xA067
+sysTraps['sysTrapDmResourceInfo'] = 0xA068
+sysTraps['sysTrapDmSetResourceInfo'] = 0xA069
+sysTraps['sysTrapDmAttachResource'] = 0xA06A
+sysTraps['sysTrapDmDetachResource'] = 0xA06B
+sysTraps['sysTrapDmNewResource'] = 0xA06C
+sysTraps['sysTrapDmRemoveResource'] = 0xA06D
+sysTraps['sysTrapDmGetResourceIndex'] = 0xA06E
+sysTraps['sysTrapDmQuickSort'] = 0xA06F
+sysTraps['sysTrapDmQueryNextInCategory'] = 0xA070
+sysTraps['sysTrapDmNumRecordsInCategory'] = 0xA071
+sysTraps['sysTrapDmPositionInCategory'] = 0xA072
+sysTraps['sysTrapDmSeekRecordInCategory'] = 0xA073
+sysTraps['sysTrapDmMoveCategory'] = 0xA074
+sysTraps['sysTrapDmOpenDatabaseByTypeCreator'] = 0xA075
+sysTraps['sysTrapDmWrite'] = 0xA076
+sysTraps['sysTrapDmStrCopy'] = 0xA077
+sysTraps['sysTrapDmGetNextDatabaseByTypeCreator'] = 0xA078
+sysTraps['sysTrapDmWriteCheck'] = 0xA079
+sysTraps['sysTrapDmMoveOpenDBContext'] = 0xA07A
+sysTraps['sysTrapDmFindRecordByID'] = 0xA07B
+sysTraps['sysTrapDmGetAppInfoID'] = 0xA07C
+sysTraps['sysTrapDmFindSortPositionV10'] = 0xA07D
+sysTraps['sysTrapDmSet'] = 0xA07E
+sysTraps['sysTrapDmCreateDatabaseFromImage'] = 0xA07F
+sysTraps['sysTrapDbgSrcMessage'] = 0xA080
+sysTraps['sysTrapDbgMessage'] = 0xA081
+sysTraps['sysTrapDbgGetMessage'] = 0xA082
+sysTraps['sysTrapDbgCommSettings'] = 0xA083
+sysTraps['sysTrapErrDisplayFileLineMsg'] = 0xA084
+sysTraps['sysTrapErrSetJump'] = 0xA085
+sysTraps['sysTrapErrLongJump'] = 0xA086
+sysTraps['sysTrapErrThrow'] = 0xA087
+sysTraps['sysTrapErrExceptionList'] = 0xA088
+sysTraps['sysTrapSysBroadcastActionCode'] = 0xA089
+sysTraps['sysTrapSysUnimplemented'] = 0xA08A
+sysTraps['sysTrapSysColdBoot'] = 0xA08B
+sysTraps['sysTrapSysReset'] = 0xA08C
+sysTraps['sysTrapSysDoze'] = 0xA08D
+sysTraps['sysTrapSysAppLaunch'] = 0xA08E
+sysTraps['sysTrapSysAppStartup'] = 0xA08F
+sysTraps['sysTrapSysAppExit'] = 0xA090
+sysTraps['sysTrapSysSetA5'] = 0xA091
+sysTraps['sysTrapSysSetTrapAddress'] = 0xA092
+sysTraps['sysTrapSysGetTrapAddress'] = 0xA093
+sysTraps['sysTrapSysTranslateKernelErr'] = 0xA094
+sysTraps['sysTrapSysSemaphoreCreate'] = 0xA095
+sysTraps['sysTrapSysSemaphoreDelete'] = 0xA096
+sysTraps['sysTrapSysSemaphoreWait'] = 0xA097
+sysTraps['sysTrapSysSemaphoreSignal'] = 0xA098
+sysTraps['sysTrapSysTimerCreate'] = 0xA099
+sysTraps['sysTrapSysTimerWrite'] = 0xA09A
+sysTraps['sysTrapSysTaskCreate'] = 0xA09B
+sysTraps['sysTrapSysTaskDelete'] = 0xA09C
+sysTraps['sysTrapSysTaskTrigger'] = 0xA09D
+sysTraps['sysTrapSysTaskID'] = 0xA09E
+sysTraps['sysTrapSysTaskUserInfoPtr'] = 0xA09F
+sysTraps['sysTrapSysTaskDelay'] = 0xA0A0
+sysTraps['sysTrapSysTaskSetTermProc'] = 0xA0A1
+sysTraps['sysTrapSysUILaunch'] = 0xA0A2
+sysTraps['sysTrapSysNewOwnerID'] = 0xA0A3
+sysTraps['sysTrapSysSemaphoreSet'] = 0xA0A4
+sysTraps['sysTrapSysDisableInts'] = 0xA0A5
+sysTraps['sysTrapSysRestoreStatus'] = 0xA0A6
+sysTraps['sysTrapSysUIAppSwitch'] = 0xA0A7
+sysTraps['sysTrapSysCurAppInfoPV20'] = 0xA0A8
+sysTraps['sysTrapSysHandleEvent'] = 0xA0A9
+sysTraps['sysTrapSysInit'] = 0xA0AA
+sysTraps['sysTrapSysQSort'] = 0xA0AB
+sysTraps['sysTrapSysCurAppDatabase'] = 0xA0AC
+sysTraps['sysTrapSysFatalAlert'] = 0xA0AD
+sysTraps['sysTrapSysResSemaphoreCreate'] = 0xA0AE
+sysTraps['sysTrapSysResSemaphoreDelete'] = 0xA0AF
+sysTraps['sysTrapSysResSemaphoreReserve'] = 0xA0B0
+sysTraps['sysTrapSysResSemaphoreRelease'] = 0xA0B1
+sysTraps['sysTrapSysSleep'] = 0xA0B2
+sysTraps['sysTrapSysKeyboardDialogV10'] = 0xA0B3
+sysTraps['sysTrapSysAppLauncherDialog'] = 0xA0B4
+sysTraps['sysTrapSysSetPerformance'] = 0xA0B5
+sysTraps['sysTrapSysBatteryInfoV20'] = 0xA0B6
+sysTraps['sysTrapSysLibInstall'] = 0xA0B7
+sysTraps['sysTrapSysLibRemove'] = 0xA0B8
+sysTraps['sysTrapSysLibTblEntry'] = 0xA0B9
+sysTraps['sysTrapSysLibFind'] = 0xA0BA
+sysTraps['sysTrapSysBatteryDialog'] = 0xA0BB
+sysTraps['sysTrapSysCopyStringResource'] = 0xA0BC
+sysTraps['sysTrapSysKernelInfo'] = 0xA0BD
+sysTraps['sysTrapSysLaunchConsole'] = 0xA0BE
+sysTraps['sysTrapSysTimerDelete'] = 0xA0BF
+sysTraps['sysTrapSysSetAutoOffTime'] = 0xA0C0
+sysTraps['sysTrapSysFormPointerArrayToStrings'] = 0xA0C1
+sysTraps['sysTrapSysRandom'] = 0xA0C2
+sysTraps['sysTrapSysTaskSwitching'] = 0xA0C3
+sysTraps['sysTrapSysTimerRead'] = 0xA0C4
+sysTraps['sysTrapStrCopy'] = 0xA0C5
+sysTraps['sysTrapStrCat'] = 0xA0C6
+sysTraps['sysTrapStrLen'] = 0xA0C7
+sysTraps['sysTrapStrCompare'] = 0xA0C8
+sysTraps['sysTrapStrIToA'] = 0xA0C9
+sysTraps['sysTrapStrCaselessCompare'] = 0xA0CA
+sysTraps['sysTrapStrIToH'] = 0xA0CB
+sysTraps['sysTrapStrChr'] = 0xA0CC
+sysTraps['sysTrapStrStr'] = 0xA0CD
+sysTraps['sysTrapStrAToI'] = 0xA0CE
+sysTraps['sysTrapStrToLower'] = 0xA0CF
+sysTraps['sysTrapSerReceiveISP'] = 0xA0D0
+sysTraps['sysTrapSlkOpen'] = 0xA0D1
+sysTraps['sysTrapSlkClose'] = 0xA0D2
+sysTraps['sysTrapSlkOpenSocket'] = 0xA0D3
+sysTraps['sysTrapSlkCloseSocket'] = 0xA0D4
+sysTraps['sysTrapSlkSocketRefNum'] = 0xA0D5
+sysTraps['sysTrapSlkSocketSetTimeout'] = 0xA0D6
+sysTraps['sysTrapSlkFlushSocket'] = 0xA0D7
+sysTraps['sysTrapSlkSetSocketListener'] = 0xA0D8
+sysTraps['sysTrapSlkSendPacket'] = 0xA0D9
+sysTraps['sysTrapSlkReceivePacket'] = 0xA0DA
+sysTraps['sysTrapSlkSysPktDefaultResponse'] = 0xA0DB
+sysTraps['sysTrapSlkProcessRPC'] = 0xA0DC
+sysTraps['sysTrapConPutS'] = 0xA0DD
+sysTraps['sysTrapConGetS'] = 0xA0DE
+sysTraps['sysTrapFplInit'] = 0xA0DF
+sysTraps['sysTrapFplFree'] = 0xA0E0
+sysTraps['sysTrapFplFToA'] = 0xA0E1
+sysTraps['sysTrapFplAToF'] = 0xA0E2
+sysTraps['sysTrapFplBase10Info'] = 0xA0E3
+sysTraps['sysTrapFplLongToFloat'] = 0xA0E4
+sysTraps['sysTrapFplFloatToLong'] = 0xA0E5
+sysTraps['sysTrapFplFloatToULong'] = 0xA0E6
+sysTraps['sysTrapFplMul'] = 0xA0E7
+sysTraps['sysTrapFplAdd'] = 0xA0E8
+sysTraps['sysTrapFplSub'] = 0xA0E9
+sysTraps['sysTrapFplDiv'] = 0xA0EA
+sysTraps['sysTrapScrInit'] = 0xA0EB
+sysTraps['sysTrapScrCopyRectangle'] = 0xA0EC
+sysTraps['sysTrapScrDrawChars'] = 0xA0ED
+sysTraps['sysTrapScrLineRoutine'] = 0xA0EE
+sysTraps['sysTrapScrRectangleRoutine'] = 0xA0EF
+sysTraps['sysTrapScrScreenInfo'] = 0xA0F0
+sysTraps['sysTrapScrDrawNotify'] = 0xA0F1
+sysTraps['sysTrapScrSendUpdateArea'] = 0xA0F2
+sysTraps['sysTrapScrCompressScanLine'] = 0xA0F3
+sysTraps['sysTrapScrDeCompressScanLine'] = 0xA0F4
+sysTraps['sysTrapTimGetSeconds'] = 0xA0F5
+sysTraps['sysTrapTimSetSeconds'] = 0xA0F6
+sysTraps['sysTrapTimGetTicks'] = 0xA0F7
+sysTraps['sysTrapTimInit'] = 0xA0F8
+sysTraps['sysTrapTimSetAlarm'] = 0xA0F9
+sysTraps['sysTrapTimGetAlarm'] = 0xA0FA
+sysTraps['sysTrapTimHandleInterrupt'] = 0xA0FB
+sysTraps['sysTrapTimSecondsToDateTime'] = 0xA0FC
+sysTraps['sysTrapTimDateTimeToSeconds'] = 0xA0FD
+sysTraps['sysTrapTimAdjust'] = 0xA0FE
+sysTraps['sysTrapTimSleep'] = 0xA0FF
+sysTraps['sysTrapTimWake'] = 0xA100
+sysTraps['sysTrapCategoryCreateListV10'] = 0xA101
+sysTraps['sysTrapCategoryFreeListV10'] = 0xA102
+sysTraps['sysTrapCategoryFind'] = 0xA103
+sysTraps['sysTrapCategoryGetName'] = 0xA104
+sysTraps['sysTrapCategoryEditV10'] = 0xA105
+sysTraps['sysTrapCategorySelectV10'] = 0xA106
+sysTraps['sysTrapCategoryGetNext'] = 0xA107
+sysTraps['sysTrapCategorySetTriggerLabel'] = 0xA108
+sysTraps['sysTrapCategoryTruncateName'] = 0xA109
+sysTraps['sysTrapClipboardAddItem'] = 0xA10A
+sysTraps['sysTrapClipboardCheckIfItemExist'] = 0xA10B
+sysTraps['sysTrapClipboardGetItem'] = 0xA10C
+sysTraps['sysTrapCtlDrawControl'] = 0xA10D
+sysTraps['sysTrapCtlEraseControl'] = 0xA10E
+sysTraps['sysTrapCtlHideControl'] = 0xA10F
+sysTraps['sysTrapCtlShowControl'] = 0xA110
+sysTraps['sysTrapCtlGetValue'] = 0xA111
+sysTraps['sysTrapCtlSetValue'] = 0xA112
+sysTraps['sysTrapCtlGetLabel'] = 0xA113
+sysTraps['sysTrapCtlSetLabel'] = 0xA114
+sysTraps['sysTrapCtlHandleEvent'] = 0xA115
+sysTraps['sysTrapCtlHitControl'] = 0xA116
+sysTraps['sysTrapCtlSetEnabled'] = 0xA117
+sysTraps['sysTrapCtlSetUsable'] = 0xA118
+sysTraps['sysTrapCtlEnabled'] = 0xA119
+sysTraps['sysTrapEvtInitialize'] = 0xA11A
+sysTraps['sysTrapEvtAddEventToQueue'] = 0xA11B
+sysTraps['sysTrapEvtCopyEvent'] = 0xA11C
+sysTraps['sysTrapEvtGetEvent'] = 0xA11D
+sysTraps['sysTrapEvtGetPen'] = 0xA11E
+sysTraps['sysTrapEvtSysInit'] = 0xA11F
+sysTraps['sysTrapEvtGetSysEvent'] = 0xA120
+sysTraps['sysTrapEvtProcessSoftKeyStroke'] = 0xA121
+sysTraps['sysTrapEvtGetPenBtnList'] = 0xA122
+sysTraps['sysTrapEvtSetPenQueuePtr'] = 0xA123
+sysTraps['sysTrapEvtPenQueueSize'] = 0xA124
+sysTraps['sysTrapEvtFlushPenQueue'] = 0xA125
+sysTraps['sysTrapEvtEnqueuePenPoint'] = 0xA126
+sysTraps['sysTrapEvtDequeuePenStrokeInfo'] = 0xA127
+sysTraps['sysTrapEvtDequeuePenPoint'] = 0xA128
+sysTraps['sysTrapEvtFlushNextPenStroke'] = 0xA129
+sysTraps['sysTrapEvtSetKeyQueuePtr'] = 0xA12A
+sysTraps['sysTrapEvtKeyQueueSize'] = 0xA12B
+sysTraps['sysTrapEvtFlushKeyQueue'] = 0xA12C
+sysTraps['sysTrapEvtEnqueueKey'] = 0xA12D
+sysTraps['sysTrapEvtDequeueKeyEvent'] = 0xA12E
+sysTraps['sysTrapEvtWakeup'] = 0xA12F
+sysTraps['sysTrapEvtResetAutoOffTimer'] = 0xA130
+sysTraps['sysTrapEvtKeyQueueEmpty'] = 0xA131
+sysTraps['sysTrapEvtEnableGraffiti'] = 0xA132
+sysTraps['sysTrapFldCopy'] = 0xA133
+sysTraps['sysTrapFldCut'] = 0xA134
+sysTraps['sysTrapFldDrawField'] = 0xA135
+sysTraps['sysTrapFldEraseField'] = 0xA136
+sysTraps['sysTrapFldFreeMemory'] = 0xA137
+sysTraps['sysTrapFldGetBounds'] = 0xA138
+sysTraps['sysTrapFldGetTextPtr'] = 0xA139
+sysTraps['sysTrapFldGetSelection'] = 0xA13A
+sysTraps['sysTrapFldHandleEvent'] = 0xA13B
+sysTraps['sysTrapFldPaste'] = 0xA13C
+sysTraps['sysTrapFldRecalculateField'] = 0xA13D
+sysTraps['sysTrapFldSetBounds'] = 0xA13E
+sysTraps['sysTrapFldSetText'] = 0xA13F
+sysTraps['sysTrapFldGetFont'] = 0xA140
+sysTraps['sysTrapFldSetFont'] = 0xA141
+sysTraps['sysTrapFldSetSelection'] = 0xA142
+sysTraps['sysTrapFldGrabFocus'] = 0xA143
+sysTraps['sysTrapFldReleaseFocus'] = 0xA144
+sysTraps['sysTrapFldGetInsPtPosition'] = 0xA145
+sysTraps['sysTrapFldSetInsPtPosition'] = 0xA146
+sysTraps['sysTrapFldSetScrollPosition'] = 0xA147
+sysTraps['sysTrapFldGetScrollPosition'] = 0xA148
+sysTraps['sysTrapFldGetTextHeight'] = 0xA149
+sysTraps['sysTrapFldGetTextAllocatedSize'] = 0xA14A
+sysTraps['sysTrapFldGetTextLength'] = 0xA14B
+sysTraps['sysTrapFldScrollField'] = 0xA14C
+sysTraps['sysTrapFldScrollable'] = 0xA14D
+sysTraps['sysTrapFldGetVisibleLines'] = 0xA14E
+sysTraps['sysTrapFldGetAttributes'] = 0xA14F
+sysTraps['sysTrapFldSetAttributes'] = 0xA150
+sysTraps['sysTrapFldSendChangeNotification'] = 0xA151
+sysTraps['sysTrapFldCalcFieldHeight'] = 0xA152
+sysTraps['sysTrapFldGetTextHandle'] = 0xA153
+sysTraps['sysTrapFldCompactText'] = 0xA154
+sysTraps['sysTrapFldDirty'] = 0xA155
+sysTraps['sysTrapFldWordWrap'] = 0xA156
+sysTraps['sysTrapFldSetTextAllocatedSize'] = 0xA157
+sysTraps['sysTrapFldSetTextHandle'] = 0xA158
+sysTraps['sysTrapFldSetTextPtr'] = 0xA159
+sysTraps['sysTrapFldGetMaxChars'] = 0xA15A
+sysTraps['sysTrapFldSetMaxChars'] = 0xA15B
+sysTraps['sysTrapFldSetUsable'] = 0xA15C
+sysTraps['sysTrapFldInsert'] = 0xA15D
+sysTraps['sysTrapFldDelete'] = 0xA15E
+sysTraps['sysTrapFldUndo'] = 0xA15F
+sysTraps['sysTrapFldSetDirty'] = 0xA160
+sysTraps['sysTrapFldSendHeightChangeNotification'] = 0xA161
+sysTraps['sysTrapFldMakeFullyVisible'] = 0xA162
+sysTraps['sysTrapFntGetFont'] = 0xA163
+sysTraps['sysTrapFntSetFont'] = 0xA164
+sysTraps['sysTrapFntGetFontPtr'] = 0xA165
+sysTraps['sysTrapFntBaseLine'] = 0xA166
+sysTraps['sysTrapFntCharHeight'] = 0xA167
+sysTraps['sysTrapFntLineHeight'] = 0xA168
+sysTraps['sysTrapFntAverageCharWidth'] = 0xA169
+sysTraps['sysTrapFntCharWidth'] = 0xA16A
+sysTraps['sysTrapFntCharsWidth'] = 0xA16B
+sysTraps['sysTrapFntDescenderHeight'] = 0xA16C
+sysTraps['sysTrapFntCharsInWidth'] = 0xA16D
+sysTraps['sysTrapFntLineWidth'] = 0xA16E
+sysTraps['sysTrapFrmInitForm'] = 0xA16F
+sysTraps['sysTrapFrmDeleteForm'] = 0xA170
+sysTraps['sysTrapFrmDrawForm'] = 0xA171
+sysTraps['sysTrapFrmEraseForm'] = 0xA172
+sysTraps['sysTrapFrmGetActiveForm'] = 0xA173
+sysTraps['sysTrapFrmSetActiveForm'] = 0xA174
+sysTraps['sysTrapFrmGetActiveFormID'] = 0xA175
+sysTraps['sysTrapFrmGetUserModifiedState'] = 0xA176
+sysTraps['sysTrapFrmSetNotUserModified'] = 0xA177
+sysTraps['sysTrapFrmGetFocus'] = 0xA178
+sysTraps['sysTrapFrmSetFocus'] = 0xA179
+sysTraps['sysTrapFrmHandleEvent'] = 0xA17A
+sysTraps['sysTrapFrmGetFormBounds'] = 0xA17B
+sysTraps['sysTrapFrmGetWindowHandle'] = 0xA17C
+sysTraps['sysTrapFrmGetFormId'] = 0xA17D
+sysTraps['sysTrapFrmGetFormPtr'] = 0xA17E
+sysTraps['sysTrapFrmGetNumberOfObjects'] = 0xA17F
+sysTraps['sysTrapFrmGetObjectIndex'] = 0xA180
+sysTraps['sysTrapFrmGetObjectId'] = 0xA181
+sysTraps['sysTrapFrmGetObjectType'] = 0xA182
+sysTraps['sysTrapFrmGetObjectPtr'] = 0xA183
+sysTraps['sysTrapFrmHideObject'] = 0xA184
+sysTraps['sysTrapFrmShowObject'] = 0xA185
+sysTraps['sysTrapFrmGetObjectPosition'] = 0xA186
+sysTraps['sysTrapFrmSetObjectPosition'] = 0xA187
+sysTraps['sysTrapFrmGetControlValue'] = 0xA188
+sysTraps['sysTrapFrmSetControlValue'] = 0xA189
+sysTraps['sysTrapFrmGetControlGroupSelection'] = 0xA18A
+sysTraps['sysTrapFrmSetControlGroupSelection'] = 0xA18B
+sysTraps['sysTrapFrmCopyLabel'] = 0xA18C
+sysTraps['sysTrapFrmSetLabel'] = 0xA18D
+sysTraps['sysTrapFrmGetLabel'] = 0xA18E
+sysTraps['sysTrapFrmSetCategoryLabel'] = 0xA18F
+sysTraps['sysTrapFrmGetTitle'] = 0xA190
+sysTraps['sysTrapFrmSetTitle'] = 0xA191
+sysTraps['sysTrapFrmAlert'] = 0xA192
+sysTraps['sysTrapFrmDoDialog'] = 0xA193
+sysTraps['sysTrapFrmCustomAlert'] = 0xA194
+sysTraps['sysTrapFrmHelp'] = 0xA195
+sysTraps['sysTrapFrmUpdateScrollers'] = 0xA196
+sysTraps['sysTrapFrmGetFirstForm'] = 0xA197
+sysTraps['sysTrapFrmVisible'] = 0xA198
+sysTraps['sysTrapFrmGetObjectBounds'] = 0xA199
+sysTraps['sysTrapFrmCopyTitle'] = 0xA19A
+sysTraps['sysTrapFrmGotoForm'] = 0xA19B
+sysTraps['sysTrapFrmPopupForm'] = 0xA19C
+sysTraps['sysTrapFrmUpdateForm'] = 0xA19D
+sysTraps['sysTrapFrmReturnToForm'] = 0xA19E
+sysTraps['sysTrapFrmSetEventHandler'] = 0xA19F
+sysTraps['sysTrapFrmDispatchEvent'] = 0xA1A0
+sysTraps['sysTrapFrmCloseAllForms'] = 0xA1A1
+sysTraps['sysTrapFrmSaveAllForms'] = 0xA1A2
+sysTraps['sysTrapFrmGetGadgetData'] = 0xA1A3
+sysTraps['sysTrapFrmSetGadgetData'] = 0xA1A4
+sysTraps['sysTrapFrmSetCategoryTrigger'] = 0xA1A5
+sysTraps['sysTrapUIInitialize'] = 0xA1A6
+sysTraps['sysTrapUIReset'] = 0xA1A7
+sysTraps['sysTrapInsPtInitialize'] = 0xA1A8
+sysTraps['sysTrapInsPtSetLocation'] = 0xA1A9
+sysTraps['sysTrapInsPtGetLocation'] = 0xA1AA
+sysTraps['sysTrapInsPtEnable'] = 0xA1AB
+sysTraps['sysTrapInsPtEnabled'] = 0xA1AC
+sysTraps['sysTrapInsPtSetHeight'] = 0xA1AD
+sysTraps['sysTrapInsPtGetHeight'] = 0xA1AE
+sysTraps['sysTrapInsPtCheckBlink'] = 0xA1AF
+sysTraps['sysTrapLstSetDrawFunction'] = 0xA1B0
+sysTraps['sysTrapLstDrawList'] = 0xA1B1
+sysTraps['sysTrapLstEraseList'] = 0xA1B2
+sysTraps['sysTrapLstGetSelection'] = 0xA1B3
+sysTraps['sysTrapLstGetSelectionText'] = 0xA1B4
+sysTraps['sysTrapLstHandleEvent'] = 0xA1B5
+sysTraps['sysTrapLstSetHeight'] = 0xA1B6
+sysTraps['sysTrapLstSetSelection'] = 0xA1B7
+sysTraps['sysTrapLstSetListChoices'] = 0xA1B8
+sysTraps['sysTrapLstMakeItemVisible'] = 0xA1B9
+sysTraps['sysTrapLstGetNumberOfItems'] = 0xA1BA
+sysTraps['sysTrapLstPopupList'] = 0xA1BB
+sysTraps['sysTrapLstSetPosition'] = 0xA1BC
+sysTraps['sysTrapMenuInit'] = 0xA1BD
+sysTraps['sysTrapMenuDispose'] = 0xA1BE
+sysTraps['sysTrapMenuHandleEvent'] = 0xA1BF
+sysTraps['sysTrapMenuDrawMenu'] = 0xA1C0
+sysTraps['sysTrapMenuEraseStatus'] = 0xA1C1
+sysTraps['sysTrapMenuGetActiveMenu'] = 0xA1C2
+sysTraps['sysTrapMenuSetActiveMenu'] = 0xA1C3
+sysTraps['sysTrapRctSetRectangle'] = 0xA1C4
+sysTraps['sysTrapRctCopyRectangle'] = 0xA1C5
+sysTraps['sysTrapRctInsetRectangle'] = 0xA1C6
+sysTraps['sysTrapRctOffsetRectangle'] = 0xA1C7
+sysTraps['sysTrapRctPtInRectangle'] = 0xA1C8
+sysTraps['sysTrapRctGetIntersection'] = 0xA1C9
+sysTraps['sysTrapTblDrawTable'] = 0xA1CA
+sysTraps['sysTrapTblEraseTable'] = 0xA1CB
+sysTraps['sysTrapTblHandleEvent'] = 0xA1CC
+sysTraps['sysTrapTblGetItemBounds'] = 0xA1CD
+sysTraps['sysTrapTblSelectItem'] = 0xA1CE
+sysTraps['sysTrapTblGetItemInt'] = 0xA1CF
+sysTraps['sysTrapTblSetItemInt'] = 0xA1D0
+sysTraps['sysTrapTblSetItemStyle'] = 0xA1D1
+sysTraps['sysTrapTblUnhighlightSelection'] = 0xA1D2
+sysTraps['sysTrapTblSetRowUsable'] = 0xA1D3
+sysTraps['sysTrapTblGetNumberOfRows'] = 0xA1D4
+sysTraps['sysTrapTblSetCustomDrawProcedure'] = 0xA1D5
+sysTraps['sysTrapTblSetRowSelectable'] = 0xA1D6
+sysTraps['sysTrapTblRowSelectable'] = 0xA1D7
+sysTraps['sysTrapTblSetLoadDataProcedure'] = 0xA1D8
+sysTraps['sysTrapTblSetSaveDataProcedure'] = 0xA1D9
+sysTraps['sysTrapTblGetBounds'] = 0xA1DA
+sysTraps['sysTrapTblSetRowHeight'] = 0xA1DB
+sysTraps['sysTrapTblGetColumnWidth'] = 0xA1DC
+sysTraps['sysTrapTblGetRowID'] = 0xA1DD
+sysTraps['sysTrapTblSetRowID'] = 0xA1DE
+sysTraps['sysTrapTblMarkRowInvalid'] = 0xA1DF
+sysTraps['sysTrapTblMarkTableInvalid'] = 0xA1E0
+sysTraps['sysTrapTblGetSelection'] = 0xA1E1
+sysTraps['sysTrapTblInsertRow'] = 0xA1E2
+sysTraps['sysTrapTblRemoveRow'] = 0xA1E3
+sysTraps['sysTrapTblRowInvalid'] = 0xA1E4
+sysTraps['sysTrapTblRedrawTable'] = 0xA1E5
+sysTraps['sysTrapTblRowUsable'] = 0xA1E6
+sysTraps['sysTrapTblReleaseFocus'] = 0xA1E7
+sysTraps['sysTrapTblEditing'] = 0xA1E8
+sysTraps['sysTrapTblGetCurrentField'] = 0xA1E9
+sysTraps['sysTrapTblSetColumnUsable'] = 0xA1EA
+sysTraps['sysTrapTblGetRowHeight'] = 0xA1EB
+sysTraps['sysTrapTblSetColumnWidth'] = 0xA1EC
+sysTraps['sysTrapTblGrabFocus'] = 0xA1ED
+sysTraps['sysTrapTblSetItemPtr'] = 0xA1EE
+sysTraps['sysTrapTblFindRowID'] = 0xA1EF
+sysTraps['sysTrapTblGetLastUsableRow'] = 0xA1F0
+sysTraps['sysTrapTblGetColumnSpacing'] = 0xA1F1
+sysTraps['sysTrapTblFindRowData'] = 0xA1F2
+sysTraps['sysTrapTblGetRowData'] = 0xA1F3
+sysTraps['sysTrapTblSetRowData'] = 0xA1F4
+sysTraps['sysTrapTblSetColumnSpacing'] = 0xA1F5
+sysTraps['sysTrapWinCreateWindow'] = 0xA1F6
+sysTraps['sysTrapWinCreateOffscreenWindow'] = 0xA1F7
+sysTraps['sysTrapWinDeleteWindow'] = 0xA1F8
+sysTraps['sysTrapWinInitializeWindow'] = 0xA1F9
+sysTraps['sysTrapWinAddWindow'] = 0xA1FA
+sysTraps['sysTrapWinRemoveWindow'] = 0xA1FB
+sysTraps['sysTrapWinSetActiveWindow'] = 0xA1FC
+sysTraps['sysTrapWinSetDrawWindow'] = 0xA1FD
+sysTraps['sysTrapWinGetDrawWindow'] = 0xA1FE
+sysTraps['sysTrapWinGetActiveWindow'] = 0xA1FF
+sysTraps['sysTrapWinGetDisplayWindow'] = 0xA200
+sysTraps['sysTrapWinGetFirstWindow'] = 0xA201
+sysTraps['sysTrapWinEnableWindow'] = 0xA202
+sysTraps['sysTrapWinDisableWindow'] = 0xA203
+sysTraps['sysTrapWinGetWindowFrameRect'] = 0xA204
+sysTraps['sysTrapWinDrawWindowFrame'] = 0xA205
+sysTraps['sysTrapWinEraseWindow'] = 0xA206
+sysTraps['sysTrapWinSaveBits'] = 0xA207
+sysTraps['sysTrapWinRestoreBits'] = 0xA208
+sysTraps['sysTrapWinCopyRectangle'] = 0xA209
+sysTraps['sysTrapWinScrollRectangle'] = 0xA20A
+sysTraps['sysTrapWinGetDisplayExtent'] = 0xA20B
+sysTraps['sysTrapWinGetWindowExtent'] = 0xA20C
+sysTraps['sysTrapWinDisplayToWindowPt'] = 0xA20D
+sysTraps['sysTrapWinWindowToDisplayPt'] = 0xA20E
+sysTraps['sysTrapWinGetClip'] = 0xA20F
+sysTraps['sysTrapWinSetClip'] = 0xA210
+sysTraps['sysTrapWinResetClip'] = 0xA211
+sysTraps['sysTrapWinClipRectangle'] = 0xA212
+sysTraps['sysTrapWinDrawLine'] = 0xA213
+sysTraps['sysTrapWinDrawGrayLine'] = 0xA214
+sysTraps['sysTrapWinEraseLine'] = 0xA215
+sysTraps['sysTrapWinInvertLine'] = 0xA216
+sysTraps['sysTrapWinFillLine'] = 0xA217
+sysTraps['sysTrapWinDrawRectangle'] = 0xA218
+sysTraps['sysTrapWinEraseRectangle'] = 0xA219
+sysTraps['sysTrapWinInvertRectangle'] = 0xA21A
+sysTraps['sysTrapWinDrawRectangleFrame'] = 0xA21B
+sysTraps['sysTrapWinDrawGrayRectangleFrame'] = 0xA21C
+sysTraps['sysTrapWinEraseRectangleFrame'] = 0xA21D
+sysTraps['sysTrapWinInvertRectangleFrame'] = 0xA21E
+sysTraps['sysTrapWinGetFramesRectangle'] = 0xA21F
+sysTraps['sysTrapWinDrawChars'] = 0xA220
+sysTraps['sysTrapWinEraseChars'] = 0xA221
+sysTraps['sysTrapWinInvertChars'] = 0xA222
+sysTraps['sysTrapWinGetPattern'] = 0xA223
+sysTraps['sysTrapWinSetPattern'] = 0xA224
+sysTraps['sysTrapWinSetUnderlineMode'] = 0xA225
+sysTraps['sysTrapWinDrawBitmap'] = 0xA226
+sysTraps['sysTrapWinModal'] = 0xA227
+sysTraps['sysTrapWinGetWindowBounds'] = 0xA228
+sysTraps['sysTrapWinFillRectangle'] = 0xA229
+sysTraps['sysTrapWinDrawInvertedChars'] = 0xA22A
+sysTraps['sysTrapPrefOpenPreferenceDBV10'] = 0xA22B
+sysTraps['sysTrapPrefGetPreferences'] = 0xA22C
+sysTraps['sysTrapPrefSetPreferences'] = 0xA22D
+sysTraps['sysTrapPrefGetAppPreferencesV10'] = 0xA22E
+sysTraps['sysTrapPrefSetAppPreferencesV10'] = 0xA22F
+sysTraps['sysTrapSndInit'] = 0xA230
+sysTraps['sysTrapSndSetDefaultVolume'] = 0xA231
+sysTraps['sysTrapSndGetDefaultVolume'] = 0xA232
+sysTraps['sysTrapSndDoCmd'] = 0xA233
+sysTraps['sysTrapSndPlaySystemSound'] = 0xA234
+sysTraps['sysTrapAlmInit'] = 0xA235
+sysTraps['sysTrapAlmCancelAll'] = 0xA236
+sysTraps['sysTrapAlmAlarmCallback'] = 0xA237
+sysTraps['sysTrapAlmSetAlarm'] = 0xA238
+sysTraps['sysTrapAlmGetAlarm'] = 0xA239
+sysTraps['sysTrapAlmDisplayAlarm'] = 0xA23A
+sysTraps['sysTrapAlmEnableNotification'] = 0xA23B
+sysTraps['sysTrapHwrGetRAMMapping'] = 0xA23C
+sysTraps['sysTrapHwrMemWritable'] = 0xA23D
+sysTraps['sysTrapHwrMemReadable'] = 0xA23E
+sysTraps['sysTrapHwrDoze'] = 0xA23F
+sysTraps['sysTrapHwrSleep'] = 0xA240
+sysTraps['sysTrapHwrWake'] = 0xA241
+sysTraps['sysTrapHwrSetSystemClock'] = 0xA242
+sysTraps['sysTrapHwrSetCPUDutyCycle'] = 0xA243
+sysTraps['sysTrapHwrLCDInit'] = 0xA244
+sysTraps['sysTrapHwrLCDSleep'] = 0xA245
+sysTraps['sysTrapHwrTimerInit'] = 0xA246
+sysTraps['sysTrapHwrCursor'] = 0xA247
+sysTraps['sysTrapHwrBatteryLevel'] = 0xA248
+sysTraps['sysTrapHwrDelay'] = 0xA249
+sysTraps['sysTrapHwrEnableDataWrites'] = 0xA24A
+sysTraps['sysTrapHwrDisableDataWrites'] = 0xA24B
+sysTraps['sysTrapHwrLCDBaseAddr'] = 0xA24C
+sysTraps['sysTrapHwrLCDDrawBitmap'] = 0xA24D
+sysTraps['sysTrapHwrTimerSleep'] = 0xA24E
+sysTraps['sysTrapHwrTimerWake'] = 0xA24F
+sysTraps['sysTrapHwrLCDWake'] = 0xA250
+sysTraps['sysTrapHwrIRQ1Handler'] = 0xA251
+sysTraps['sysTrapHwrIRQ2Handler'] = 0xA252
+sysTraps['sysTrapHwrIRQ3Handler'] = 0xA253
+sysTraps['sysTrapHwrIRQ4Handler'] = 0xA254
+sysTraps['sysTrapHwrIRQ5Handler'] = 0xA255
+sysTraps['sysTrapHwrIRQ6Handler'] = 0xA256
+sysTraps['sysTrapHwrDockSignals'] = 0xA257
+sysTraps['sysTrapHwrPluggedIn'] = 0xA258
+sysTraps['sysTrapCrc16CalcBlock'] = 0xA259
+sysTraps['sysTrapSelectDayV10'] = 0xA25A
+sysTraps['sysTrapSelectTime'] = 0xA25B
+sysTraps['sysTrapDayDrawDaySelector'] = 0xA25C
+sysTraps['sysTrapDayHandleEvent'] = 0xA25D
+sysTraps['sysTrapDayDrawDays'] = 0xA25E
+sysTraps['sysTrapDayOfWeek'] = 0xA25F
+sysTraps['sysTrapDaysInMonth'] = 0xA260
+sysTraps['sysTrapDayOfMonth'] = 0xA261
+sysTraps['sysTrapDateDaysToDate'] = 0xA262
+sysTraps['sysTrapDateToDays'] = 0xA263
+sysTraps['sysTrapDateAdjust'] = 0xA264
+sysTraps['sysTrapDateSecondsToDate'] = 0xA265
+sysTraps['sysTrapDateToAscii'] = 0xA266
+sysTraps['sysTrapDateToDOWDMFormat'] = 0xA267
+sysTraps['sysTrapTimeToAscii'] = 0xA268
+sysTraps['sysTrapFind'] = 0xA269
+sysTraps['sysTrapFindStrInStr'] = 0xA26A
+sysTraps['sysTrapFindSaveMatch'] = 0xA26B
+sysTraps['sysTrapFindGetLineBounds'] = 0xA26C
+sysTraps['sysTrapFindDrawHeader'] = 0xA26D
+sysTraps['sysTrapPenOpen'] = 0xA26E
+sysTraps['sysTrapPenClose'] = 0xA26F
+sysTraps['sysTrapPenGetRawPen'] = 0xA270
+sysTraps['sysTrapPenCalibrate'] = 0xA271
+sysTraps['sysTrapPenRawToScreen'] = 0xA272
+sysTraps['sysTrapPenScreenToRaw'] = 0xA273
+sysTraps['sysTrapPenResetCalibration'] = 0xA274
+sysTraps['sysTrapPenSleep'] = 0xA275
+sysTraps['sysTrapPenWake'] = 0xA276
+sysTraps['sysTrapResLoadForm'] = 0xA277
+sysTraps['sysTrapResLoadMenu'] = 0xA278
+sysTraps['sysTrapFtrInit'] = 0xA279
+sysTraps['sysTrapFtrUnregister'] = 0xA27A
+sysTraps['sysTrapFtrGet'] = 0xA27B
+sysTraps['sysTrapFtrSet'] = 0xA27C
+sysTraps['sysTrapFtrGetByIndex'] = 0xA27D
+sysTraps['sysTrapGrfInit'] = 0xA27E
+sysTraps['sysTrapGrfFree'] = 0xA27F
+sysTraps['sysTrapGrfGetState'] = 0xA280
+sysTraps['sysTrapGrfSetState'] = 0xA281
+sysTraps['sysTrapGrfFlushPoints'] = 0xA282
+sysTraps['sysTrapGrfAddPoint'] = 0xA283
+sysTraps['sysTrapGrfInitState'] = 0xA284
+sysTraps['sysTrapGrfCleanState'] = 0xA285
+sysTraps['sysTrapGrfMatch'] = 0xA286
+sysTraps['sysTrapGrfGetMacro'] = 0xA287
+sysTraps['sysTrapGrfFilterPoints'] = 0xA288
+sysTraps['sysTrapGrfGetNumPoints'] = 0xA289
+sysTraps['sysTrapGrfGetPoint'] = 0xA28A
+sysTraps['sysTrapGrfFindBranch'] = 0xA28B
+sysTraps['sysTrapGrfMatchGlyph'] = 0xA28C
+sysTraps['sysTrapGrfGetGlyphMapping'] = 0xA28D
+sysTraps['sysTrapGrfGetMacroName'] = 0xA28E
+sysTraps['sysTrapGrfDeleteMacro'] = 0xA28F
+sysTraps['sysTrapGrfAddMacro'] = 0xA290
+sysTraps['sysTrapGrfGetAndExpandMacro'] = 0xA291
+sysTraps['sysTrapGrfProcessStroke'] = 0xA292
+sysTraps['sysTrapGrfFieldChange'] = 0xA293
+sysTraps['sysTrapGetCharSortValue'] = 0xA294
+sysTraps['sysTrapGetCharAttr'] = 0xA295
+sysTraps['sysTrapGetCharCaselessValue'] = 0xA296
+sysTraps['sysTrapPwdExists'] = 0xA297
+sysTraps['sysTrapPwdVerify'] = 0xA298
+sysTraps['sysTrapPwdSet'] = 0xA299
+sysTraps['sysTrapPwdRemove'] = 0xA29A
+sysTraps['sysTrapGsiInitialize'] = 0xA29B
+sysTraps['sysTrapGsiSetLocation'] = 0xA29C
+sysTraps['sysTrapGsiEnable'] = 0xA29D
+sysTraps['sysTrapGsiEnabled'] = 0xA29E
+sysTraps['sysTrapGsiSetShiftState'] = 0xA29F
+sysTraps['sysTrapKeyInit'] = 0xA2A0
+sysTraps['sysTrapKeyHandleInterrupt'] = 0xA2A1
+sysTraps['sysTrapKeyCurrentState'] = 0xA2A2
+sysTraps['sysTrapKeyResetDoubleTap'] = 0xA2A3
+sysTraps['sysTrapKeyRates'] = 0xA2A4
+sysTraps['sysTrapKeySleep'] = 0xA2A5
+sysTraps['sysTrapKeyWake'] = 0xA2A6
+sysTraps['sysTrapDlkControl'] = 0xA2A7
+sysTraps['sysTrapDlkStartServer'] = 0xA2A8
+sysTraps['sysTrapDlkGetSyncInfo'] = 0xA2A9
+sysTraps['sysTrapDlkSetLogEntry'] = 0xA2AA
+sysTraps['sysTrapIntlDispatch'] = 0xA2AB
+sysTraps['sysTrapSysLibLoad'] = 0xA2AC
+sysTraps['sysTrapSndPlaySmf'] = 0xA2AD
+sysTraps['sysTrapSndCreateMidiList'] = 0xA2AE
+sysTraps['sysTrapAbtShowAbout'] = 0xA2AF
+sysTraps['sysTrapMdmDial'] = 0xA2B0
+sysTraps['sysTrapMdmHangUp'] = 0xA2B1
+sysTraps['sysTrapDmSearchRecord'] = 0xA2B2
+sysTraps['sysTrapSysInsertionSort'] = 0xA2B3
+sysTraps['sysTrapDmInsertionSort'] = 0xA2B4
+sysTraps['sysTrapLstSetTopItem'] = 0xA2B5
+sysTraps['sysTrapSclSetScrollBar'] = 0xA2B6
+sysTraps['sysTrapSclDrawScrollBar'] = 0xA2B7
+sysTraps['sysTrapSclHandleEvent'] = 0xA2B8
+sysTraps['sysTrapSysMailboxCreate'] = 0xA2B9
+sysTraps['sysTrapSysMailboxDelete'] = 0xA2BA
+sysTraps['sysTrapSysMailboxFlush'] = 0xA2BB
+sysTraps['sysTrapSysMailboxSend'] = 0xA2BC
+sysTraps['sysTrapSysMailboxWait'] = 0xA2BD
+sysTraps['sysTrapSysTaskWait'] = 0xA2BE
+sysTraps['sysTrapSysTaskWake'] = 0xA2BF
+sysTraps['sysTrapSysTaskWaitClr'] = 0xA2C0
+sysTraps['sysTrapSysTaskSuspend'] = 0xA2C1
+sysTraps['sysTrapSysTaskResume'] = 0xA2C2
+sysTraps['sysTrapCategoryCreateList'] = 0xA2C3
+sysTraps['sysTrapCategoryFreeList'] = 0xA2C4
+sysTraps['sysTrapCategoryEditV20'] = 0xA2C5
+sysTraps['sysTrapCategorySelect'] = 0xA2C6
+sysTraps['sysTrapDmDeleteCategory'] = 0xA2C7
+sysTraps['sysTrapSysEvGroupCreate'] = 0xA2C8
+sysTraps['sysTrapSysEvGroupSignal'] = 0xA2C9
+sysTraps['sysTrapSysEvGroupRead'] = 0xA2CA
+sysTraps['sysTrapSysEvGroupWait'] = 0xA2CB
+sysTraps['sysTrapEvtEventAvail'] = 0xA2CC
+sysTraps['sysTrapEvtSysEventAvail'] = 0xA2CD
+sysTraps['sysTrapStrNCopy'] = 0xA2CE
+sysTraps['sysTrapKeySetMask'] = 0xA2CF
+sysTraps['sysTrapSelectDay'] = 0xA2D0
+sysTraps['sysTrapPrefGetPreference'] = 0xA2D1
+sysTraps['sysTrapPrefSetPreference'] = 0xA2D2
+sysTraps['sysTrapPrefGetAppPreferences'] = 0xA2D3
+sysTraps['sysTrapPrefSetAppPreferences'] = 0xA2D4
+sysTraps['sysTrapFrmPointInTitle'] = 0xA2D5
+sysTraps['sysTrapStrNCat'] = 0xA2D6
+sysTraps['sysTrapMemCmp'] = 0xA2D7
+sysTraps['sysTrapTblSetColumnEditIndicator'] = 0xA2D8
+sysTraps['sysTrapFntWordWrap'] = 0xA2D9
+sysTraps['sysTrapFldGetScrollValues'] = 0xA2DA
+sysTraps['sysTrapSysCreateDataBaseList'] = 0xA2DB
+sysTraps['sysTrapSysCreatePanelList'] = 0xA2DC
+sysTraps['sysTrapDlkDispatchRequest'] = 0xA2DD
+sysTraps['sysTrapStrPrintF'] = 0xA2DE
+sysTraps['sysTrapStrVPrintF'] = 0xA2DF
+sysTraps['sysTrapPrefOpenPreferenceDB'] = 0xA2E0
+sysTraps['sysTrapSysGraffitiReferenceDialog'] = 0xA2E1
+sysTraps['sysTrapSysKeyboardDialog'] = 0xA2E2
+sysTraps['sysTrapFntWordWrapReverseNLines'] = 0xA2E3
+sysTraps['sysTrapFntGetScrollValues'] = 0xA2E4
+sysTraps['sysTrapTblSetRowStaticHeight'] = 0xA2E5
+sysTraps['sysTrapTblHasScrollBar'] = 0xA2E6
+sysTraps['sysTrapSclGetScrollBar'] = 0xA2E7
+sysTraps['sysTrapFldGetNumberOfBlankLines'] = 0xA2E8
+sysTraps['sysTrapSysTicksPerSecond'] = 0xA2E9
+sysTraps['sysTrapHwrBacklight'] = 0xA2EA
+sysTraps['sysTrapDmDatabaseProtect'] = 0xA2EB
+sysTraps['sysTrapTblSetBounds'] = 0xA2EC
+sysTraps['sysTrapStrNCompare'] = 0xA2ED
+sysTraps['sysTrapStrNCaselessCompare'] = 0xA2EE
+sysTraps['sysTrapPhoneNumberLookup'] = 0xA2EF
+sysTraps['sysTrapFrmSetMenu'] = 0xA2F0
+sysTraps['sysTrapEncDigestMD5'] = 0xA2F1
+sysTraps['sysTrapDmFindSortPosition'] = 0xA2F2
+sysTraps['sysTrapSysBinarySearch'] = 0xA2F3
+sysTraps['sysTrapSysErrString'] = 0xA2F4
+sysTraps['sysTrapSysStringByIndex'] = 0xA2F5
+sysTraps['sysTrapEvtAddUniqueEventToQueue'] = 0xA2F6
+sysTraps['sysTrapStrLocalizeNumber'] = 0xA2F7
+sysTraps['sysTrapStrDelocalizeNumber'] = 0xA2F8
+sysTraps['sysTrapLocGetNumberSeparators'] = 0xA2F9
+sysTraps['sysTrapMenuSetActiveMenuRscID'] = 0xA2FA
+sysTraps['sysTrapLstScrollList'] = 0xA2FB
+sysTraps['sysTrapCategoryInitialize'] = 0xA2FC
+sysTraps['sysTrapEncDigestMD4'] = 0xA2FD
+sysTraps['sysTrapEncDES'] = 0xA2FE
+sysTraps['sysTrapLstGetVisibleItems'] = 0xA2FF
+sysTraps['sysTrapWinSetWindowBounds'] = 0xA300
+sysTraps['sysTrapCategorySetName'] = 0xA301
+sysTraps['sysTrapFldSetInsertionPoint'] = 0xA302
+sysTraps['sysTrapFrmSetObjectBounds'] = 0xA303
+sysTraps['sysTrapWinSetColors'] = 0xA304
+sysTraps['sysTrapFlpDispatch'] = 0xA305
+sysTraps['sysTrapFlpEmDispatch'] = 0xA306
+sysTraps['sysTrapExgInit'] = 0xA307
+sysTraps['sysTrapExgConnect'] = 0xA308
+sysTraps['sysTrapExgPut'] = 0xA309
+sysTraps['sysTrapExgGet'] = 0xA30A
+sysTraps['sysTrapExgAccept'] = 0xA30B
+sysTraps['sysTrapExgDisconnect'] = 0xA30C
+sysTraps['sysTrapExgSend'] = 0xA30D
+sysTraps['sysTrapExgReceive'] = 0xA30E
+sysTraps['sysTrapExgRegisterData'] = 0xA30F
+sysTraps['sysTrapExgNotifyReceive'] = 0xA310
+sysTraps['sysTrapExgControl'] = 0xA311
+sysTraps['sysTrapPrgStartDialogV31'] = 0xA312
+sysTraps['sysTrapPrgStopDialog'] = 0xA313
+sysTraps['sysTrapPrgUpdateDialog'] = 0xA314
+sysTraps['sysTrapPrgHandleEvent'] = 0xA315
+sysTraps['sysTrapImcReadFieldNoSemicolon'] = 0xA316
+sysTraps['sysTrapImcReadFieldQuotablePrintable'] = 0xA317
+sysTraps['sysTrapImcReadPropertyParameter'] = 0xA318
+sysTraps['sysTrapImcSkipAllPropertyParameters'] = 0xA319
+sysTraps['sysTrapImcReadWhiteSpace'] = 0xA31A
+sysTraps['sysTrapImcWriteQuotedPrintable'] = 0xA31B
+sysTraps['sysTrapImcWriteNoSemicolon'] = 0xA31C
+sysTraps['sysTrapImcStringIsAscii'] = 0xA31D
+sysTraps['sysTrapTblGetItemFont'] = 0xA31E
+sysTraps['sysTrapTblSetItemFont'] = 0xA31F
+sysTraps['sysTrapFontSelect'] = 0xA320
+sysTraps['sysTrapFntDefineFont'] = 0xA321
+sysTraps['sysTrapCategoryEdit'] = 0xA322
+sysTraps['sysTrapSysGetOSVersionString'] = 0xA323
+sysTraps['sysTrapSysBatteryInfo'] = 0xA324
+sysTraps['sysTrapSysUIBusy'] = 0xA325
+sysTraps['sysTrapWinValidateHandle'] = 0xA326
+sysTraps['sysTrapFrmValidatePtr'] = 0xA327
+sysTraps['sysTrapCtlValidatePointer'] = 0xA328
+sysTraps['sysTrapWinMoveWindowAddr'] = 0xA329
+sysTraps['sysTrapFrmAddSpaceForObject'] = 0xA32A
+sysTraps['sysTrapFrmNewForm'] = 0xA32B
+sysTraps['sysTrapCtlNewControl'] = 0xA32C
+sysTraps['sysTrapFldNewField'] = 0xA32D
+sysTraps['sysTrapLstNewList'] = 0xA32E
+sysTraps['sysTrapFrmNewLabel'] = 0xA32F
+sysTraps['sysTrapFrmNewBitmap'] = 0xA330
+sysTraps['sysTrapFrmNewGadget'] = 0xA331
+sysTraps['sysTrapFileOpen'] = 0xA332
+sysTraps['sysTrapFileClose'] = 0xA333
+sysTraps['sysTrapFileDelete'] = 0xA334
+sysTraps['sysTrapFileReadLow'] = 0xA335
+sysTraps['sysTrapFileWrite'] = 0xA336
+sysTraps['sysTrapFileSeek'] = 0xA337
+sysTraps['sysTrapFileTell'] = 0xA338
+sysTraps['sysTrapFileTruncate'] = 0xA339
+sysTraps['sysTrapFileControl'] = 0xA33A
+sysTraps['sysTrapFrmActiveState'] = 0xA33B
+sysTraps['sysTrapSysGetAppInfo'] = 0xA33C
+sysTraps['sysTrapSysGetStackInfo'] = 0xA33D
+sysTraps['sysTrapScrDisplayMode'] = 0xA33E
+sysTraps['sysTrapHwrLCDGetDepth'] = 0xA33F
+sysTraps['sysTrapHwrGetROMToken'] = 0xA340
+sysTraps['sysTrapDbgControl'] = 0xA341
+sysTraps['sysTrapExgDBRead'] = 0xA342
+sysTraps['sysTrapExgDBWrite'] = 0xA343
+sysTraps['sysTrapHostControl'] = 0xA344
+sysTraps['sysTrapFrmRemoveObject'] = 0xA345
+sysTraps['sysTrapSysReserved1'] = 0xA346
+sysTraps['sysTrapSysReserved2'] = 0xA347
+sysTraps['sysTrapSysReserved3'] = 0xA348
+sysTraps['sysTrapSysReserved4'] = 0xA349
+sysTraps['sysTrapHwrLCDContrast'] = 0xA34A
+sysTraps['sysTrapSysLCDContrast'] = 0xA34B
+sysTraps['sysTrapContrastAdjust'] = 0xA34C
+sysTraps['sysTrapHwrDockStatus'] = 0xA34D
+sysTraps['sysTrapFntWidthToOffset'] = 0xA34E
+sysTraps['sysTrapSelectOneTime'] = 0xA34F
+sysTraps['sysTrapWinDrawChar'] = 0xA350
+sysTraps['sysTrapWinDrawTruncChars'] = 0xA351
+sysTraps['sysTrapNotifyInit'] = 0xA352
+sysTraps['sysTrapNotifyRegister'] = 0xA353
+sysTraps['sysTrapNotifyUnregister'] = 0xA354
+sysTraps['sysTrapNotifyBroadcast'] = 0xA355
+sysTraps['sysTrapNotifyBroadcastDeferred'] = 0xA356
+sysTraps['sysTrapNotifyDatabaseAdded'] = 0xA357
+sysTraps['sysTrapNotifyDatabaseRemoved'] = 0xA358
+sysTraps['sysTrapSysWantEvent'] = 0xA359
+sysTraps['sysTrapFtrPtrNew'] = 0xA35A
+sysTraps['sysTrapFtrPtrFree'] = 0xA35B
+sysTraps['sysTrapFtrPtrResize'] = 0xA35C
+sysTraps['sysTrapSysReserved5'] = 0xA35D
+sysTraps['sysTrapHwrNVPrefSet'] = 0xA35E
+sysTraps['sysTrapHwrNVPrefGet'] = 0xA35F
+sysTraps['sysTrapFlashInit'] = 0xA360
+sysTraps['sysTrapFlashCompress'] = 0xA361
+sysTraps['sysTrapFlashErase'] = 0xA362
+sysTraps['sysTrapFlashProgram'] = 0xA363
+sysTraps['sysTrapAlmTimeChange'] = 0xA364
+sysTraps['sysTrapErrAlertCustom'] = 0xA365
+sysTraps['sysTrapPrgStartDialog'] = 0xA366
+sysTraps['sysTrapSerialDispatch'] = 0xA367
+sysTraps['sysTrapHwrBattery'] = 0xA368
+sysTraps['sysTrapDmGetDatabaseLockState'] = 0xA369
+sysTraps['sysTrapCncGetProfileList'] = 0xA36A
+sysTraps['sysTrapCncGetProfileInfo'] = 0xA36B
+sysTraps['sysTrapCncAddProfile'] = 0xA36C
+sysTraps['sysTrapCncDeleteProfile'] = 0xA36D
+sysTraps['sysTrapSndPlaySmfResource'] = 0xA36E
+sysTraps['sysTrapMemPtrDataStorage'] = 0xA36F
+sysTraps['sysTrapClipboardAppendItem'] = 0xA370
+sysTraps['sysTrapWiCmd'] = 0xA371
+sysTraps['sysTrapLastTrapNumber'] = 0xA372
diff --git a/Scripting/Python/Test.py b/Scripting/Python/Test.py
new file mode 100644
index 0000000..4213b21
--- /dev/null
+++ b/Scripting/Python/Test.py
@@ -0,0 +1,132 @@
+# ======================================================================================
+# Copyright (c) 1999-2001 Palm, Inc. or its subsidiaries.
+# All rights reserved.
+# ======================================================================================
+#
+# File: Test.py
+# Author: David Creemer
+# Created: Thu Jul 29 17:05:33 PDT 1999
+
+# Test of the Python Poser RPC mechanism
+#
+# This file includes a number of PalmOS sample function wrappers. Each
+# wraps a PalmOS trap or hostcontrol function, and calls the lower
+# level Poser RPC layer. Each function takes 1 or more parameters. The
+# first parameter is a required Poser Socket (an object representing a
+# connection to a running Poser). All other parameters are optional
+# and specific to each function.
+#
+
+import sys
+import Poser
+from SysTraps import *
+
+def MemReadMemory( poserSocket, addr, len ):
+ msg = Poser.SysPacketReadMem( addr, len )
+ poserSocket.call( msg )
+ return msg.getMemory()
+
+def MemWriteMemory( poserSocket, addr, data, len ):
+ msg = Poser.SysPacketWriteMem( addr, data, len )
+ poserSocket.call( msg )
+
+def MemPtrNew( poserSocket, size ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapMemPtrNew'] )
+ msg[ 'size' ] = Poser.RPCParam( 0, 'L', size )
+ poserSocket.call( msg )
+ return msg[ 'A0' ]
+
+def SysTicksPerSecond( poserSocket ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapSysTicksPerSecond'] )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def DmNumDatabases( poserSocket, cardNo ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapDmNumDatabases'] )
+ msg[ 'cardNo' ] = Poser.RPCParam( 0, 'H', cardNo )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def DmGetDatabase( poserSocket, cardNo, index ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapDmGetDatabase'] )
+ msg[ 'cardNo' ] = Poser.RPCParam( 0, 'H', cardNo )
+ msg[ 'index' ] = Poser.RPCParam( 1, 'H', index )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def DmFindDatabase( poserSocket, cardNo, name ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapDmFindDatabase'] )
+ msg[ 'cardNo' ] = Poser.RPCParam( 0, 'H', cardNo )
+ msg[ 'name' ] = Poser.RPCParam( 1, '32s', name )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def DmDatabaseInfo( poserSocket, cardNo, dbId ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapDmDatabaseInfo'] )
+ msg[ 'cardNo' ] = Poser.RPCParam( 0, 'H', cardNo )
+ msg[ 'dbId' ] = Poser.RPCParam( 0, 'L', dbId )
+ msg[ 'name' ] = Poser.RPCParam( 1, '32s', "" )
+ msg[ 'attributes' ] = Poser.RPCParam( 1, 'H', 0 )
+ msg[ 'version' ] = Poser.RPCParam( 1, 'H', 0 )
+ msg[ 'crDate' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'modDate' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'bckUpDate' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'modNum' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'appInfoID' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'sortInfoID' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'type' ] = Poser.RPCParam( 1, 'L', 0 )
+ msg[ 'creator' ] = Poser.RPCParam( 1, 'L', 0 )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def DmGetLastError( poserSocket ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapDmGetLastErr'] )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+def EvtEnqueueKey( poserSocket, ascii, keycode=0, modifiers=0 ):
+ msg = Poser.SysPacketRPC2( sysTraps['sysTrapEvtEnqueueKey'] )
+ msg[ 'ascii' ] = Poser.RPCParam( 0, 'H', ascii )
+ msg[ 'keycode' ] = Poser.RPCParam( 0, 'H', keycode )
+ msg[ 'modifiers' ] = Poser.RPCParam( 0, 'H', modifiers )
+ poserSocket.call( msg )
+ return msg[ 'D0' ]
+
+#-----------------------------------------------------------------------------
+
+def test():
+ ps = Poser.Socket()
+ ps.connect()
+
+ print "Enqueuing 'Hello'..."
+ EvtEnqueueKey( ps, ord('H') )
+ EvtEnqueueKey( ps, ord('e') )
+ EvtEnqueueKey( ps, ord('l') )
+ EvtEnqueueKey( ps, ord('l') )
+ EvtEnqueueKey( ps, ord('o') )
+ print "SysTicksPerSecond() =", SysTicksPerSecond( ps )
+
+ addr = MemPtrNew( ps, 10 )
+ print "MemPtrNew(10) =", addr
+ print "MemWriteMemory(",addr,",'123456789',10)"
+ MemWriteMemory( ps, addr, "123456789\0", 10 )
+
+ data = MemReadMemory( ps, addr, 10 )
+ print "MemReadMemory(",addr,",10)= ", data
+
+ print "DmNumDatabase(0) =", DmNumDatabases( ps, 0 )
+
+ print "DmFindDatabase(0, 'AddressDB') =", DmFindDatabase( ps, 0, "AddressDB" )
+ localid = DmFindDatabase( ps, 0, "MemoDB" )
+ print "DmFindDatabase(0, 'MemoDB') =", localid
+ print "DmDatabaseInfo(0,", localid,") =", DmDatabaseInfo( ps, 0, localid )
+ print "DmGetLastError() =", DmGetLastError( ps )
+
+## close the socket
+ ps.close()
+ sys.exit(1)
+
+#-----------------------------------------------------------------------------
+
+if __name__ == '__main__':
+ test()