aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform/Incs/Core/System
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbarenblat@gmail.com>2021-11-23 23:13:26 -0500
committerGravatar Benjamin Barenblat <bbarenblat@gmail.com>2021-11-23 23:13:26 -0500
commite5df1aafb6d1346207343ccb858fa373e6b86301 (patch)
treefb26f0091dda7dd69d48d6b06169ea618332b99e /SrcShared/Palm/Platform/Incs/Core/System
Palm OS Emulator v3.5HEADmain
Check in the Palm OS Emulator, version 3.5 (2001). These files come from the tarball present in the Debian archives [1]. The SHA-256 digest of the tarball, c5e0d23424e88525bfba0ecdf0a432a8d93c885d04740df06a9eeee44e5f25e4, matches the digest preserved in the FreeBSD ports tree [2], giving further confidence that these files are as distributed by upstream. [1] http://archive.debian.org/debian/pool/contrib/p/pose/ [2] https://svnweb.freebsd.org/ports/head/palm/pose/distinfo?revision=271305&view=markup&pathrev=282162
Diffstat (limited to 'SrcShared/Palm/Platform/Incs/Core/System')
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h151
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h129
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Chars.h411
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Crc.h63
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h2433
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DLServer.h418
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h540
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/DateTime.h283
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h294
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h89
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Font.h150
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h113
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h76
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h230
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Localize.h54
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h341
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h135
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h1515
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h214
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h1258
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h98
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Preferences.h428
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Rect.h83
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h437
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h371
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h317
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h204
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h252
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h1191
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h430
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h346
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h411
-rw-r--r--SrcShared/Palm/Platform/Incs/Core/System/Window.h559
33 files changed, 14024 insertions, 0 deletions
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h b/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h
new file mode 100644
index 0000000..37623d3
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Bitmap.h
@@ -0,0 +1,151 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Bitmap.h
+ *
+ * Description:
+ * This file defines bitmap structures and routines.
+ *
+ * History:
+ * September, 1999 Created by Bertrand Simon
+ * Name Date Description
+ * ---- ---- -----------
+ * BS 9/99 Create
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __BITMAP_H__
+#define __BITMAP_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <PalmOptErrorCheckLevel.h> // #define ERROR_CHECK_LEVEL
+
+
+//-----------------------------------------------
+// The Bitmap Structure.
+//-----------------------------------------------
+
+// bitmap version numbers
+#define BitmapVersionZero 0
+#define BitmapVersionOne 1
+#define BitmapVersionTwo 2
+
+// Compression Types for BitMap BitmapVersionTwo.
+typedef enum {
+ BitmapCompressionTypeScanLine = 0,
+ BitmapCompressionTypeRLE,
+
+ BitmapCompressionTypeNone = 0xFF
+} BitmapCompressionType;
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef struct BitmapFlagsType {
+ UInt16 compressed:1; // Data format: 0=raw; 1=compressed
+ UInt16 hasColorTable:1; // if true, color table stored before bits[]
+ UInt16 hasTransparency:1; // true if transparency is used
+ UInt16 indirect:1; // true if bits are stored indirectly
+ UInt16 forScreen:1; // system use only
+ UInt16 reserved:11;
+} BitmapFlagsType;
+
+// this definition correspond to the 'Tbmp' and 'tAIB' resource types
+typedef struct BitmapType {
+ Int16 width;
+ Int16 height;
+ UInt16 rowBytes;
+ BitmapFlagsType flags;
+ UInt8 pixelSize; // bits/pixel
+ UInt8 version; // version of bitmap. This is vers 2
+ UInt16 nextDepthOffset; // # of DWords to next BitmapType
+ // from beginnning of this one
+ UInt8 transparentIndex; // v2 only, if flags.hasTransparency is true,
+ // index number of transparent color
+ UInt8 compressionType; // v2 only, if flags.compressed is true, this is
+ // the type, see BitmapCompressionType
+
+ UInt16 reserved; // for future use, must be zero!
+
+ // [colorTableType] pixels | pixels*
+ // If hasColorTable != 0, we have:
+ // ColorTableType followed by pixels.
+ // If hasColorTable == 0:
+ // this is the start of the pixels
+ // if indirect != 0 bits are stored indirectly.
+ // the address of bits is stored here
+ // In some cases the ColorTableType will
+ // have 0 entries and be 2 bytes long.
+} BitmapType;
+
+typedef BitmapType *BitmapPtr;
+
+
+// This is the structure of a color table. It maps pixel values into
+// RGB colors. Each element in the table corresponds to the next
+// index, starting at 0.
+
+typedef struct RGBColorType {
+ UInt8 index; // index of color or best match to cur CLUT or unused.
+ UInt8 r; // amount of red, 0->255
+ UInt8 g; // amount of green, 0->255
+ UInt8 b; // amount of blue, 0->255
+} RGBColorType;
+
+
+typedef struct ColorTableType {
+ // high bits (numEntries > 256) reserved
+ UInt16 numEntries; // number of entries in table
+ // RGBColorType entry[]; // array 0..numEntries-1 of colors
+ // starts immediately after numEntries
+} ColorTableType;
+
+
+// get start of color table entries aray given pointer to ColorTableType
+#define ColorTableEntries(ctP) ((RGBColorType *)((ColorTableType *)(ctP)+1))
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------
+// Routines relating to bitmap management
+//-----------------------------------------------
+
+extern BitmapType *BmpCreate (Coord width, Coord height, UInt8 depth,
+ ColorTableType *colortableP, UInt16 *error)
+ SYS_TRAP(sysTrapBmpCreate);
+
+extern Err BmpDelete (BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpDelete);
+
+extern Err BmpCompress(BitmapType *bitmapP, BitmapCompressionType compType )
+ SYS_TRAP(sysTrapBmpCompress);
+
+extern void *BmpGetBits(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpGetBits);
+
+extern ColorTableType *BmpGetColortable(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpGetColortable);
+
+extern UInt16 BmpSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpSize);
+
+extern UInt16 BmpBitsSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpBitsSize);
+
+extern UInt16 BmpColortableSize(BitmapType *bitmapP)
+ SYS_TRAP(sysTrapBmpColortableSize);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif //__BITMAP_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h b/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h
new file mode 100644
index 0000000..4797bdb
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/CharAttr.h
@@ -0,0 +1,129 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: CharAttr.h
+ *
+ * Description:
+ * This file defines character classification and character
+ * conversion macros
+ *
+ * History:
+ * April 21, 1995 Created by Art Lamb
+ *
+ *****************************************************************************/
+
+#ifndef __CHARATTR_H__
+#define __CHARATTR_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The
+// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this
+// reason it's safest to use the sizeOf7BitChar macro to document buffer size
+// and string length calcs. Note that this can only be used with low-ascii
+// characters, as anything else might be the high byte of a double-byte char.
+
+#define sizeOf7BitChar(c) 1
+
+#ifdef NON_INTERNATIONAL
+#define sizeofchar(c) sizeof((char) (c))
+#define lastAsciiChr 0x00FF
+#else
+#define sizeofchar(c) _Obsolete__use_sizeOf7BitChar
+#define lastAsciiChr _Obsolete__lastAsciiChr_does_not_work_for_Japanese
+#endif
+
+// Character attribute code bits.
+
+#define _XA 0x0200 // extra alphabetic
+#define _XS 0x0100 // extra space
+#define _BB 0x0080 // BEL, BS, etc.
+#define _CN 0x0040 // CR, FF, HT, NL, VT
+#define _DI 0x0020 // '0'-'9'
+#define _LO 0x0010 // 'a'-'z' and lowercase extended chars.
+#define _PU 0x0008 // punctuation
+#define _SP 0x0004 // space
+#define _UP 0x0002 // 'A'-'Z' and uppercase extended chars.
+#define _XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f'
+
+
+// These macros have all been deprecated and replaced by corresponding TxtCharXXXX
+// macros found in TextMgr.h. The main problem is that these all assume 8-bit character
+// codes, and thus won't work with Shift JIS and other multi-byte encodings.
+
+// Character classification macros.
+
+#ifdef NON_INTERNATIONAL
+#define IsAscii(c) (c <= 255)
+#define IsAlNum(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_UP|_XA))
+#define IsAlpha(attr,c) (attr[(UInt8)(c)] & (_LO|_UP|_XA))
+#define IsCntrl(attr,c) (attr[(UInt8)(c)] & (_BB|_CN))
+#define IsDigit(attr,c) (attr[(UInt8)(c)] & _DI)
+#define IsGraph(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_UP|_XA))
+#define IsLower(attr,c) (attr[(UInt8)(c)] & _LO)
+#define IsPrint(attr,c) (attr[(UInt8)(c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
+#define IsPunct(attr,c) (attr[(UInt8)(c)] & _PU)
+#define IsSpace(attr,c) (attr[(UInt8)(c)] & (_CN|_SP|_XS))
+#define IsUpper(attr,c) (attr[(UInt8)(c)] & _UP)
+#define IsHex(attr,c) (attr[(UInt8)(c)] & _XD)
+#define IsDelim(attr,c) (attr[(UInt8)(c)] & _SP|_PU)
+#else
+#define IsAscii(c) _Obsolete__use_TxtCharIsValid
+#define IsAlNum(attr,c) _Obsolete__use_TxtCharIsAlNum
+#define IsAlpha(attr,c) _Obsolete__use_TxtCharIsAlpha
+#define IsCntrl(attr,c) _Obsolete__use_TxtCharIsCntrl
+#define IsDigit(attr,c) _Obsolete__use_TxtCharIsDigit
+#define IsGraph(attr,c) _Obsolete__use_TxtCharIsGraph
+#define IsLower(attr,c) _Obsolete__use_TxtCharIsLower
+#define IsPrint(attr,c) _Obsolete__use_TxtCharIsPrint
+#define IsPunct(attr,c) _Obsolete__use_TxtCharIsPunct
+#define IsSpace(attr,c) _Obsolete__use_TxtCharIsSpace
+#define IsUpper(attr,c) _Obsolete__use_TxtCharIsUpper
+#define IsHex(attr,c) _Obsolete__use_TxtCharIsHex
+#define IsDelim(attr,c) _Obsolete__use_TxtCharIsDelim
+#endif
+
+// This macro is deprecated because it relies on character code ranges, versus checking
+// to ensure that the keydown event has the command bit set in the modifiers field. Use
+// the TxtCharIsHardKey macro found in TextMgr.h.
+
+#ifdef NON_INTERNATIONAL
+#define ChrIsHardKey(c) ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr))
+#else
+#define ChrIsHardKey(c) _Obsolete__use_TxtCharIsHardKey
+#endif
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// In 3.1 and later versions of Palm OS, these routines have all been replaced by new
+// Text Manager routines found in TextMgr.h
+
+#ifdef NON_INTERNATIONAL
+const UInt16 *GetCharAttr (void)
+ SYS_TRAP(sysTrapGetCharAttr);
+
+const UInt8 *GetCharSortValue (void)
+ SYS_TRAP(sysTrapGetCharSortValue);
+
+const UInt8 *GetCharCaselessValue (void)
+ SYS_TRAP(sysTrapGetCharCaselessValue);
+#else
+#define GetCharAttr() _Obsolete__use_TxtCharIs_macros
+#define GetCharSortValue() _Obsolete__use_TxtCompare
+#define GetCharCaselessValue() _Obsolete__use_TxtCaselessCompare
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif /* __CHARATTR_H__ */
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Chars.h b/SrcShared/Palm/Platform/Incs/Core/System/Chars.h
new file mode 100644
index 0000000..ada116b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Chars.h
@@ -0,0 +1,411 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Chars.h
+ *
+ * Description:
+ * This file defines the characters in fonts.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * 11/03/94 rsf Created by Roger Flores.
+ * 04/21/99 JFS Added list of virtual command key ranges reserved
+ * for use by licensees.
+ * 09/13/99 kwk Added vchrTsmMode.
+ * 10/28/99 kwk Defined vchrPageUp and vchrPageDown.
+ *
+ *****************************************************************************/
+
+#ifndef __CHARS_H__
+#define __CHARS_H__
+
+// Standard Unicode 2.0 names for the ascii characters. These exist in
+// all of the text fonts, no matter what character encoding is being
+// used by PalmOS.
+
+#define chrNull 0x0000
+#define chrStartOfHeading 0x0001
+#define chrStartOfText 0x0002
+#define chrEndOfText 0x0003
+#define chrEndOfTransmission 0x0004
+#define chrEnquiry 0x0005
+#define chrAcknowledge 0x0006
+#define chrBell 0x0007
+#define chrBackspace 0x0008
+#define chrHorizontalTabulation 0x0009
+#define chrLineFeed 0x000A
+#define chrVerticalTabulation 0x000B
+#define chrFormFeed 0x000C
+#define chrCarriageReturn 0x000D
+#define chrShiftOut 0x000E
+#define chrShiftIn 0x000F
+#define chrDataLinkEscape 0x0010
+#define chrDeviceControlOne 0x0011
+#define chrDeviceControlTwo 0x0012
+#define chrDeviceControlThree 0x0013
+#define chrDeviceControlFour 0x0014
+#define chrNegativeAcknowledge 0x0015
+#define chrSynchronousIdle 0x0016
+#define chrEndOfTransmissionBlock 0x0017
+#define chrCancel 0x0018
+#define chrEndOfMedium 0x0019
+#define chrSubstitute 0x001A
+#define chrEscape 0x001B
+#define chrFileSeparator 0x001C
+#define chrGroupSeparator 0x001D
+#define chrRecordSeparator 0x001E
+#define chrUnitSeparator 0x001F
+#define chrSpace 0x0020
+#define chrExclamationMark 0x0021
+#define chrQuotationMark 0x0022
+#define chrNumberSign 0x0023
+#define chrDollarSign 0x0024
+#define chrPercentSign 0x0025
+#define chrAmpersand 0x0026
+#define chrApostrophe 0x0027
+#define chrLeftParenthesis 0x0028
+#define chrRightParenthesis 0x0029
+#define chrAsterisk 0x002A
+#define chrPlusSign 0x002B
+#define chrComma 0x002C
+#define chrHyphenMinus 0x002D
+#define chrFullStop 0x002E
+#define chrSolidus 0x002F
+#define chrDigitZero 0x0030
+#define chrDigitOne 0x0031
+#define chrDigitTwo 0x0032
+#define chrDigitThree 0x0033
+#define chrDigitFour 0x0034
+#define chrDigitFive 0x0035
+#define chrDigitSix 0x0036
+#define chrDigitSeven 0x0037
+#define chrDigitEight 0x0038
+#define chrDigitNine 0x0039
+#define chrColon 0x003A
+#define chrSemicolon 0x003B
+#define chrLessThanSign 0x003C
+#define chrEqualsSign 0x003D
+#define chrGreaterThanSign 0x003E
+#define chrQuestionMark 0x003F
+#define chrCommercialAt 0x0040
+#define chrCapital_A 0x0041
+#define chrCapital_B 0x0042
+#define chrCapital_C 0x0043
+#define chrCapital_D 0x0044
+#define chrCapital_E 0x0045
+#define chrCapital_F 0x0046
+#define chrCapital_G 0x0047
+#define chrCapital_H 0x0048
+#define chrCapital_I 0x0049
+#define chrCapital_J 0x004A
+#define chrCapital_K 0x004B
+#define chrCapital_L 0x004C
+#define chrCapital_M 0x004D
+#define chrCapital_N 0x004E
+#define chrCapital_O 0x004F
+#define chrCapital_P 0x0050
+#define chrCapital_Q 0x0051
+#define chrCapital_R 0x0052
+#define chrCapital_S 0x0053
+#define chrCapital_T 0x0054
+#define chrCapital_U 0x0055
+#define chrCapital_V 0x0056
+#define chrCapital_W 0x0057
+#define chrCapital_X 0x0058
+#define chrCapital_Y 0x0059
+#define chrCapital_Z 0x005A
+#define chrLeftSquareBracket 0x005B
+// #define chrReverseSolidus 0x005C (not in Japanese fonts)
+#define chrRightSquareBracket 0x005D
+#define chrCircumflexAccent 0x005E
+#define chrLowLine 0x005F
+#define chrGraveAccent 0x0060
+#define chrSmall_A 0x0061
+#define chrSmall_B 0x0062
+#define chrSmall_C 0x0063
+#define chrSmall_D 0x0064
+#define chrSmall_E 0x0065
+#define chrSmall_F 0x0066
+#define chrSmall_G 0x0067
+#define chrSmall_H 0x0068
+#define chrSmall_I 0x0069
+#define chrSmall_J 0x006A
+#define chrSmall_K 0x006B
+#define chrSmall_L 0x006C
+#define chrSmall_M 0x006D
+#define chrSmall_N 0x006E
+#define chrSmall_O 0x006F
+#define chrSmall_P 0x0070
+#define chrSmall_Q 0x0071
+#define chrSmall_R 0x0072
+#define chrSmall_S 0x0073
+#define chrSmall_T 0x0074
+#define chrSmall_U 0x0075
+#define chrSmall_V 0x0076
+#define chrSmall_W 0x0077
+#define chrSmall_X 0x0078
+#define chrSmall_Y 0x0079
+#define chrSmall_Z 0x007A
+#define chrLeftCurlyBracket 0x007B
+#define chrVerticalLine 0x007C
+#define chrRightCurlyBracket 0x007D
+#define chrTilde 0x007E
+#define chrDelete 0x007F
+
+
+// Special meanings given to characters by the PalmOS
+#define vchrPageUp chrVerticalTabulation // 0x000B
+#define vchrPageDown chrFormFeed // 0x000C
+#define chrOtaSecure chrDeviceControlFour // 0x0014
+#define chrOta chrNegativeAcknowledge // 0x0015
+#define chrCommandStroke chrSynchronousIdle // 0x0016
+#define chrShortcutStroke chrEndOfTransmissionBlock // 0x0017
+#define chrEllipsis chrCancel // 0x0018
+#define chrNumericSpace chrEndOfMedium // 0x0019
+#define chrLeftArrow chrFileSeparator // 0x001C
+#define chrRightArrow chrGroupSeparator // 0x001D
+#define chrUpArrow chrRecordSeparator // 0x001E
+#define chrDownArrow chrUnitSeparator // 0x001F
+
+
+// The following are key codes used for virtual events, like
+// low battery warnings, etc. These keyboard events MUST
+// have the commandKeyMask bit set in the modifiers in order
+// to be recognized.
+#define vchrLowBattery 0x0101 // Display low battery dialog
+#define vchrEnterDebugger 0x0102 // Enter Debugger
+#define vchrNextField 0x0103 // Go to next field in form
+#define vchrStartConsole 0x0104 // Startup console task
+#define vchrMenu 0x0105 // Ctl-A
+#define vchrCommand 0x0106 // Ctl-C
+#define vchrConfirm 0x0107 // Ctl-D
+#define vchrLaunch 0x0108 // Ctl-E
+#define vchrKeyboard 0x0109 // Ctl-F popup the keyboard in appropriate mode
+#define vchrFind 0x010A
+#define vchrCalc 0x010B
+#define vchrPrevField 0x010C
+#define vchrAlarm 0x010D // sent before displaying an alarm
+#define vchrRonamatic 0x010E // stroke from graffiti area to top half of screen
+#define vchrGraffitiReference 0x010F // popup the Graffiti reference
+#define vchrKeyboardAlpha 0x0110 // popup the keyboard in alpha mode
+#define vchrKeyboardNumeric 0x0111 // popup the keyboard in number mode
+#define vchrLock 0x0112 // switch to the Security app and lock the device
+#define vchrBacklight 0x0113 // toggle state of backlight
+#define vchrAutoOff 0x0114 // power off due to inactivity timer
+// Added for PalmOS 3.0
+#define vchrExgTest 0x0115 // put exchange Manager into test mode (&.t)
+#define vchrSendData 0x0116 // Send data if possible
+#define vchrIrReceive 0x0117 // Initiate an Ir receive manually (&.i)
+// Added for PalmOS 3.1
+#define vchrTsm1 0x0118 // Text Services silk-screen button
+#define vchrTsm2 0x0119 // Text Services silk-screen button
+#define vchrTsm3 0x011A // Text Services silk-screen button
+#define vchrTsm4 0x011B // Text Services silk-screen button
+// Added for PalmOS 3.2
+#define vchrRadioCoverageOK 0x011C // Radio coverage check successful
+#define vchrRadioCoverageFail 0x011D // Radio coverage check failure
+#define vchrPowerOff 0x011E // Posted after autoOffChr or hardPowerChr
+ // to put system to sleep with SysSleep.
+// Added for PalmOS 3.5
+#define vchrResumeSleep 0x011F // Posted by NotifyMgr clients after they
+ // have deferred a sleep request in order
+ // to resume it.
+#define vchrLateWakeup 0x0120 // Posted by the system after waking up
+ // to broadcast a late wakeup notification.
+ // FOR SYSTEM USE ONLY
+#define vchrTsmMode 0x0121 // Posted by TSM to trigger mode change.
+#define vchrBrightness 0x0122 // Activates brightness adjust dialog
+#define vchrContrast 0x0123 // Activates contrast adjust dialog
+#define vchrExgIntData 0x01FF // Exchange Manager wakeup event
+
+// The application launching buttons generate the following
+// key codes and will also set the commandKeyMask bit in the
+// modifiers field
+#define vchrHardKeyMin 0x0200
+#define vchrHardKeyMax 0x02FF // 256 hard keys
+
+#define vchrHard1 0x0204
+#define vchrHard2 0x0205
+#define vchrHard3 0x0206
+#define vchrHard4 0x0207
+#define vchrHardPower 0x0208
+#define vchrHardCradle 0x0209 // Button on cradle pressed
+#define vchrHardCradle2 0x020A // Button on cradle pressed and hwrDockInGeneric1
+ // input on dock asserted (low).
+#define vchrHardContrast 0x020B // Sumo's Contrast button
+#define vchrHardAntenna 0x020C // Eleven's Antenna switch
+#define vchrHardBrightness 0x020D // Hypothetical Brightness button
+
+
+
+// The following keycode RANGES are reserved for use by licensees.
+// All have the commandKeyMask bit set in the event's modifiers field.
+// Note that ranges include the Min and Max values themselves (i.e. key
+// codes >= min and <= max are assigned to the following licensees).
+//
+// Qualcomm
+#define vchrThumperMin 0x0300
+#define vchrThumperMax 0x03FF // 256 command keys
+
+// Motorola
+#define vchrCessnaMin 0x14CD
+#define vchrCessnaMax 0x14CD // 1 command key
+
+// TRG
+#define vchrCFlashMin 0x1500
+#define vchrCFlashMax 0x150F // 16 command keys
+
+// Symbol
+#define vchrSPTMin 0x15A0
+#define vchrSPTMax 0x15AF // 16 command keys
+
+// Handspring
+#define vchrSlinkyMin 0x1600
+#define vchrSlinkyMax 0x16FF // 256 command keys
+
+
+
+// Old names for some of the characters.
+#define nullChr chrNull // 0x0000
+#define backspaceChr chrBackspace // 0x0008
+#define tabChr chrHorizontalTabulation // 0x0009
+#define linefeedChr chrLineFeed // 0x000A
+#define pageUpChr vchrPageUp // 0x000B
+#define chrPageUp vchrPageUp // 0x000B
+#define pageDownChr vchrPageDown // 0x000C
+#define chrPageDown vchrPageDown // 0x000C
+#define crChr chrCarriageReturn // 0x000D
+#define returnChr chrCarriageReturn // 0x000D
+#define otaSecureChr chrOtaSecure // 0x0014
+#define otaChr chrOta // 0x0015
+
+#define escapeChr chrEscape // 0x001B
+#define leftArrowChr chrLeftArrow // 0x001C
+#define rightArrowChr chrRightArrow // 0x001D
+#define upArrowChr chrUpArrow // 0x001E
+#define downArrowChr chrDownArrow // 0x001F
+#define spaceChr chrSpace // 0x0020
+#define quoteChr chrQuotationMark // 0x0022 '"'
+#define commaChr chrComma // 0x002C ','
+#define periodChr chrFullStop // 0x002E '.'
+#define colonChr chrColon // 0x003A ':'
+#define lowBatteryChr vchrLowBattery // 0x0101
+#define enterDebuggerChr vchrEnterDebugger // 0x0102
+#define nextFieldChr vchrNextField // 0x0103
+#define startConsoleChr vchrStartConsole // 0x0104
+#define menuChr vchrMenu // 0x0105
+#define commandChr vchrCommand // 0x0106
+#define confirmChr vchrConfirm // 0x0107
+#define launchChr vchrLaunch // 0x0108
+#define keyboardChr vchrKeyboard // 0x0109
+#define findChr vchrFind // 0x010A
+#define calcChr vchrCalc // 0x010B
+#define prevFieldChr vchrPrevField // 0x010C
+#define alarmChr vchrAlarm // 0x010D
+#define ronamaticChr vchrRonamatic // 0x010E
+#define graffitiReferenceChr vchrGraffitiReference // 0x010F
+#define keyboardAlphaChr vchrKeyboardAlpha // 0x0110
+#define keyboardNumericChr vchrKeyboardNumeric // 0x0111
+#define lockChr vchrLock // 0x0112
+#define backlightChr vchrBacklight // 0x0113
+#define autoOffChr vchrAutoOff // 0x0114
+#define exgTestChr vchrExgTest // 0x0115
+#define sendDataChr vchrSendData // 0x0116
+#define irReceiveChr vchrIrReceive // 0x0117
+#define radioCoverageOKChr vchrRadioCoverageOK // 0x011C
+#define radioCoverageFailChr vchrRadioCoverageFail // 0x011D
+#define powerOffChr vchrPowerOff // 0x011E
+#define resumeSleepChr vchrResumeSleep // 0x011F
+#define lateWakeupChr vchrLateWakeup // 0x0120
+#define brightnessChr vchrBrightness // 0x0121
+#define contrastChr vchrContrast // 0x0122
+#define hardKeyMin vchrHardKeyMin // 0x0200
+#define hardKeyMax vchrHardKeyMax // 0x02FF
+#define hard1Chr vchrHard1 // 0x0204
+#define hard2Chr vchrHard2 // 0x0205
+#define hard3Chr vchrHard3 // 0x0206
+#define hard4Chr vchrHard4 // 0x0207
+#define hardPowerChr vchrHardPower // 0x0208
+#define hardCradleChr vchrHardCradle // 0x0209
+#define hardCradle2Chr vchrHardCradle2 // 0x020A
+#define hardContrastChr vchrHardContrast // 0x020B
+#define hardAntennaChr vchrHardAntenna // 0x020C
+#define hardBrightnessChr vchrHardBrightness // 0x020D
+
+// Macros to determine correct character code to use for drawing numeric space
+// and horizontal ellipsis.
+
+#define ChrNumericSpace(chP) \
+ do { \
+ UInt32 attribute; \
+ if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \
+ && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \
+ *(chP) = chrNumericSpace; \
+ } else { \
+ *(chP) = 0x80; \
+ } \
+ } while (0)
+
+#define ChrHorizEllipsis(chP) \
+ do { \
+ UInt32 attribute; \
+ if ((FtrGet(sysFtrCreator, sysFtrNumROMVersion, &attribute) == 0) \
+ && (attribute >= sysMakeROMVersion(3, 1, 0, 0, 0))) { \
+ *(chP) = chrEllipsis; \
+ } else { \
+ *(chP) = 0x85; \
+ } \
+ } while (0)
+
+// Characters in the 9 point symbol font. Resource ID 9003
+enum symbolChars {
+ symbolLeftArrow = 3,
+ symbolRightArrow,
+ symbolUpArrow,
+ symbolDownArrow,
+ symbolSmallDownArrow,
+ symbolSmallUpArrow,
+ symbolMemo = 9,
+ symbolHelp,
+ symbolNote,
+ symbolNoteSelected,
+ symbolCapsLock,
+ symbolNumLock,
+ symbolShiftUpper,
+ symbolShiftPunc,
+ symbolShiftExt,
+ symbolShiftNone,
+ symbolNoTime,
+ symbolAlarm,
+ symbolRepeat,
+ symbolCheckMark,
+ // These next four characters were moved from the 0x8D..0x90
+ // range in the main fonts to the 9pt Symbol font in PalmOS 3.1
+ symbolDiamondChr,
+ symbolClubChr,
+ symbolHeartChr,
+ symbolSpadeChr
+ };
+
+// Character in the 7 point symbol font. Resource ID 9005
+enum symbol7Chars {
+ symbol7ScrollUp = 1,
+ symbol7ScrollDown,
+ symbol7ScrollUpDisabled,
+ symbol7ScrollDownDisabled
+ };
+
+// Characters in the 11 point symbol font. Resource ID 9004
+enum symbol11Chars {
+ symbolCheckboxOff = 0,
+ symbolCheckboxOn,
+ symbol11LeftArrow,
+ symbol11RightArrow,
+ symbol11LeftArrowDisabled, // New for Palm OS v3.2
+ symbol11RightArrowDisabled // New for Palm OS v3.2
+ };
+
+
+#endif // __CHARS_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Crc.h b/SrcShared/Palm/Platform/Incs/Core/System/Crc.h
new file mode 100644
index 0000000..bd7c3e5
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Crc.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Crc.h
+ *
+ * Description:
+ * This is the header file for the CRC calculation routines for Pilot.
+ *
+ * History:
+ * May 10, 1995 Created by Vitaly Kruglikov
+ * 05/10/95 vmk Created by Vitaly Kruglikov.
+ * 09/10/99 kwk Crc16CalcBlock takes a const void *.
+ *
+ *****************************************************************************/
+
+#ifndef __CRC_H__
+#define __CRC_H__
+
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+
+
+
+/********************************************************************
+ * CRC Calculation Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+
+// Crc16CalcBlock()
+//
+// Calculate the 16-bit CRC of a data block using the table lookup method.
+//
+UInt16 Crc16CalcBlock(const void *bufP, UInt16 count, UInt16 crc)
+ SYS_TRAP(sysTrapCrc16CalcBlock);
+
+UInt16 Crc16CalcBigBlock(void *bufP, UInt32 count, UInt16 crc);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif // __CRC_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h b/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h
new file mode 100644
index 0000000..af8a449
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DLCommon.h
@@ -0,0 +1,2433 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DLCommon.h
+ *
+ * Description:
+ * Desktop Link Protocol(DLP) function id's, parameters, and frame
+ * structures.
+ *
+ * History:
+ * 6/7/95 vmk Created by Vitaly Marty Kruglikov
+ * 6/15/95 vmk Changed dlp/Read/Write/UserID to dlp/Read/Write/UserInfo and
+ * added the last sync PC id field to their arguments at Laura's request.
+ * 6/15/95 vmk Added option to dlpDeleteRecord to delete all records in DB.
+ *
+ *****************************************************************************/
+
+#ifndef __DLCOMMON_H__
+#define __DLCOMMON_H__
+
+#include <PalmTypes.h>
+
+/************************************************************
+ * DesktopLink function codes
+ *************************************************************/
+
+// DlpFuncID -- function id's used in request blocks sent to
+// the DesktopLink application on Pilot. The width of the function
+// id base is 7 bits. The high order bit(the 8th bit) is used to
+// distinguish requests from their responses -- it is cleared in request
+// blocks and is set in response blocks (i.e., the response to a particular
+// command will have the same function code base as the command and the
+// high order bit set). See dlpFuncRespFlag defined below.
+//
+typedef enum DlpFuncID {
+
+ dlpReservedFunc = 0x0F, // range reserved for internal use
+
+ // DLP 1.0 FUNCTIONS START HERE (PalmOS v1.0)
+ dlpReadUserInfo,
+
+ dlpWriteUserInfo,
+
+ dlpReadSysInfo,
+
+ dlpGetSysDateTime,
+
+ dlpSetSysDateTime,
+
+ dlpReadStorageInfo,
+
+ dlpReadDBList,
+
+ dlpOpenDB,
+
+ dlpCreateDB,
+
+ dlpCloseDB,
+
+ dlpDeleteDB,
+
+ dlpReadAppBlock,
+
+ dlpWriteAppBlock,
+
+ dlpReadSortBlock,
+
+ dlpWriteSortBlock,
+
+ dlpReadNextModifiedRec,
+
+ dlpReadRecord,
+
+ dlpWriteRecord,
+
+ dlpDeleteRecord,
+
+ dlpReadResource,
+
+ dlpWriteResource,
+
+ dlpDeleteResource,
+
+ dlpCleanUpDatabase,
+
+ dlpResetSyncFlags,
+
+ dlpCallApplication,
+
+ dlpResetSystem,
+
+ dlpAddSyncLogEntry,
+
+ dlpReadOpenDBInfo,
+
+ dlpMoveCategory,
+
+ dlpProcessRPC, // remote procedure calls interface
+
+ dlpOpenConduit, // this command is sent before each conduit is opened
+
+ dlpEndOfSync, // ends the sync session
+
+ dlpResetRecordIndex, // resets "modified record" index
+
+ dlpReadRecordIDList, // LAST 1.0 FUNCTION
+
+
+ // DLP 1.1 FUNCTIONS ADDED HERE (PalmOS v2.0 Personal, and Professional)
+ dlpReadNextRecInCategory, // iterate through all records in category
+
+ dlpReadNextModifiedRecInCategory, // iterate through modified records in category
+
+ dlpReadAppPreference, // read application preference
+
+ dlpWriteAppPreference, // write application preference
+
+ dlpReadNetSyncInfo, // read Network HotSync settings
+
+ dlpWriteNetSyncInfo, // write Network HotSync settings
+
+ dlpReadFeature, // read a feature from Feature Manager
+
+
+ // DLP 1.2 FUNCTIONS ADDED HERE (PalmOS v3.0)
+ dlpFindDB, // find a database given creator and type, or name, or
+ // get info on currently-open db
+ dlpSetDBInfo, // change database information (name, attributes, version,
+ // creation, modification, backup dates, type and creator
+
+
+
+
+ dlpLastFunc // ***ALWAYS KEEP LAST***
+
+ } DlpFuncID;
+
+#define dlpLastPilotV10FuncID dlpReadRecordIDList
+
+
+// Desktop Link function error codes returned in the response errorCode
+// field.
+typedef enum DlpRespErrorCode {
+ dlpRespErrNone = 0, // reserve 0 for no error
+ dlpRespErrSystem, // general Pilot system error
+ dlpRespErrIllegalReq, // unknown function ID
+ dlpRespErrMemory, // insufficient dynamic heap memory
+ dlpRespErrParam, // invalid parameter
+ dlpRespErrNotFound, // database, record, or resource not found
+ dlpRespErrNoneOpen, // there are no open databases
+ dlpRespErrDatabaseOpen, // database is open by someone else
+ dlpRespErrTooManyOpenDatabases, // there are too many open databases
+ dlpRespErrAlreadyExists, // DB already exists
+ dlpRespErrCantOpen, // couldn't open DB
+ dlpRespErrRecordDeleted, // record is deleted
+ dlpRespErrRecordBusy, // record is in use by someone else
+ dlpRespErrNotSupported, // the requested operation is not supported
+ // on the given database type(record or resource)
+ dlpRespErrUnused1, // was dlpRespErrROMBased
+ dlpRespErrReadOnly, // caller does not have write access(or DB is in ROM)
+ dlpRespErrNotEnoughSpace, // not enough space in data store for record/resource/etc.
+ dlpRespErrLimitExceeded, // size limit exceeded
+ dlpRespErrCancelSync, // cancel the sync
+
+ dlpRespErrBadWrapper, // bad arg wrapper(for debugging)
+ dlpRespErrArgMissing, // required arg not found(for debugging)
+ dlpRespErrArgSize, // invalid argument size
+
+ dlpRespErrLastReserved = 127 // last error code reserved for Palm
+ // *KEEP THIS ENTRY LAST*
+ } DlpRespErrorCode;
+
+
+// Database flags
+// NOTE: THESE *MUST* MATCH THE TOUCHDOWN DB ATTRIBUTES(AT LEAST IN THE FIRST VERSION).
+// ANY CHANGES MUST BE REFLECTED IN "READ DB LIST" AND
+#define dlpDBFlagResDB 0x0001 // resource DB if set; record DB if cleared
+
+#define dlpDBFlagReadOnly 0x0002 // DB is read only if set; read/write if cleared
+
+#define dlpDBFlagAppInfoDirty 0x0004 // Set if Application Info block is dirty
+ // Optionally supported by an App's conduit
+
+#define dlpDBFlagBackup 0x0008 // Set if database should be backed up to PC if
+ // no app-specific synchronization conduit has
+ // been supplied.
+
+#define dlpDBFlagOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK
+ // for it to install a newer version of this database
+ // with a different name if the current database is
+ // open. This mechanism is used to update the
+ // Graffiti Shortcuts database, for example.
+
+#define dlpDBFlagResetAfterInstall 0x0020 // Device requires a reset after this database is
+ // installed.
+
+#define dlpDBFlagCopyPrevention 0x0040 // This database should not be copied to
+ // another deviced.
+
+#define dlpDBFlagOpen 0x8000 // DB is open
+
+
+
+
+// Database record attributes
+#define dlpRecAttrDeleted 0x80 // delete this record next sync
+#define dlpRecAttrDirty 0x40 // archive this record next sync
+#define dlpRecAttrBusy 0x20 // record currently in use
+#define dlpRecAttrSecret 0x10 // "secret" record - password protected
+#define dlpRecAttrArchived 0x08 // archived record
+
+
+// Date/time will be described in the following format
+// yr(2 bytes), mo(1 byte, 1-12), dy(1 byte, 1-31),
+// hr(1 byte, 0-23), min(1 byte, 0-59), sec(1 byte, 0-59),
+// unused(1 byte).
+
+typedef struct DlpDateTimeType { // OFFSET
+ UInt16 year; // 0; year (high, low)
+ UInt8 month; // 2; month: 1-12
+ UInt8 day; // 3; day: 1-31
+ UInt8 hour; // 4; hour: 0-23
+ UInt8 minute; // 5; minute: 0-59
+ UInt8 second; // 6; second: 0-59
+ UInt8 unused; // 7; unused -- set to null!
+ } DlpDateTimeType; // TOTAL: 8 bytes
+
+
+// Version structure
+typedef struct DlpVersionType {
+ // OFFSET
+ UInt16 wMajor; // 0; major version number (0 = ignore)
+ UInt16 wMinor; // 2; minor version number
+ // TOTAL: 4 bytes
+ } DlpVersionType;
+
+
+/************************************************************
+ * Request and Response headers.
+ *
+ * Each DLP request and response data block begins with the
+ * corresponding header structure which identifies the function
+ * id, argument count, and error code(responses only).
+ *************************************************************/
+
+// Request header:
+//
+typedef struct DlpReqHeaderType {
+ // OFFSET
+ UInt8 id; // 0; request function ID
+ UInt8 argc; // 2; count of args that follow this header
+ // TOTAL: 2 bytes
+ } DlpReqHeaderType;
+
+typedef DlpReqHeaderType* DlpReqHeaderPtr;
+
+typedef struct DlpReqType {
+ // OFFSET
+ DlpReqHeaderType header; // 0; request header
+ // FIXED SIZE: 2 bytes
+ UInt8 args[2]; // 2; request arguments -- var size
+ } DlpReqType;
+
+typedef DlpReqType* DlpReqPtr;
+
+// Response header:
+//
+typedef struct DlpRespHeaderType {
+ // OFFSET
+ UInt8 id; // 0; response function ID
+ UInt8 argc; // 1; count of arguments that follow this header
+ UInt16 errorCode; // 2; error code
+ // TOTAL: 4 bytes
+ } DlpRespHeaderType;
+
+typedef DlpRespHeaderType* DlpRespHeaderPtr;
+
+typedef struct DlpRespType {
+ // OFFSET
+ DlpRespHeaderType header; // 0; response header
+ // FIXED SIZE: 4 bytes
+ UInt8 args[2]; // 4; response arguments -- var size
+ } DlpRespType;
+
+typedef DlpRespType* DlpRespPtr;
+
+
+// Generic request/response body type(for utility routines)
+//
+typedef union DlpGenericBodyType {
+ UInt8 id; // request/response id
+ DlpReqType req; // request body
+ DlpRespType resp; // response body
+ } DlpGenericBodyType;
+
+typedef DlpGenericBodyType* DlpGenericBodyPtr;
+
+
+// dlpFuncRespFlag is used to form a function response ID from a
+// function ID by or'ing it with the function ID. For example: if
+// dlpFuncDeleteResource is the request ID, the correct response ID
+// must be (dlpFuncDeleteResource | dlpFuncRespFlag).
+//
+#define dlpFuncRespFlag 0x80
+
+// dlpFuncIDMask is used to mask out the function ID value
+#define dlpFuncIDMask 0x7f
+
+// dlpFirstArgID is the value of the first argument ID to be defined for
+// functions. Values below it are reserved.
+//
+#define dlpFirstArgID 0x20
+
+
+/************************************************************
+ *
+ * Argument headers used to "wrap" request and response arguments
+ *
+ * IMPORTANT: ARGUMENT WRAPPERS IN REQUESTS AND RESPONSES MUST
+ * ALWAYS START ON AN EVEN-BYTE BOUNDARY. The server
+ * implementation expects this to be the case.
+ *
+ *************************************************************/
+
+// dlpSmallArgFlag is used to identify "small" argument wrappers by
+// or'ing it with the argument id in argument header.
+//
+#define dlpSmallArgFlag 0x080
+
+// dlpShortArgIDMask is used to mask out the argument id value
+//
+#define dlpShortArgIDMask 0x7F
+
+
+// dlpLongArgFlag is used to identify "long" argument wrappers by
+// or'ing it with the argument id in argument header.
+//
+#define dlpLongArgFlag 0xC000
+
+// dlpLongArgIDMask is used to mask out the argument id value
+//
+#define dlpLongArgIDMask 0x3FFF
+
+
+//-------------------------------------------------------------------------
+// Int16 argument wrappers (v1.0-compatible)
+//-------------------------------------------------------------------------
+
+// Maximum Int16 argument size which can be "wrapped"
+#define dlpMaxTinyArgSize 0x000000FFL
+#define dlpMaxSmallArgSize 0x0000FFFFL
+#define dlpMaxShortArgSize dlpMaxSmallArgSize
+
+
+
+// Tiny argument header for data sizes up to 255 bytes(optimization)
+//
+typedef struct DlpTinyArgWrapperType {
+ // OFFSET
+ UInt8 bID; // 0; argument ID
+ UInt8 bSize; // 1; argument size (does NOT include this arg header)
+ // TOTAL: 2 bytes
+ } DlpTinyArgWrapperType;
+
+typedef struct DlpTinyArgType {
+ DlpTinyArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 2; argument data -- var size
+ } DlpTinyArgType;
+
+
+// Small argument header for data sizes above 255 bytes(*may also be used for
+// smaller arguments when convenient*)
+//
+typedef struct DlpSmallArgWrapperType {
+ // OFFSET
+ UInt8 bID; // 0; argument ID
+ UInt8 unused; // 1; unused(for alignment) -- set to null!
+ UInt16 wSize; // 2; argument size (does NOT include this arg header)
+ // TOTAL: 4 bytes
+ } DlpSmallArgWrapperType;
+
+typedef struct DlpSmallArgType {
+ DlpSmallArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 4; argument data -- var size
+ } DlpSmallArgType;
+
+// Unions of Int16 argument types
+typedef union DlpShortArgWrapperType {
+ UInt8 bID; // arg id
+ DlpTinyArgWrapperType tiny; // "tiny" arg wrapper
+ DlpSmallArgWrapperType small; // "tiny" arg wrapper
+ } DlpShortArgWrapperType;
+typedef DlpShortArgWrapperType* DlpShortArgWrapperPtr;
+
+typedef union DlpShortArgType {
+ UInt8 bID; // arg id
+ DlpTinyArgType tiny; // "tiny" arg
+ DlpSmallArgType small; // "small" arg
+ } DlpShortArgType;
+
+typedef DlpShortArgType* DlpShortArgPtr;
+
+
+
+//-------------------------------------------------------------------------
+// Int32 argument wrapper (v2.0 extension)
+//-------------------------------------------------------------------------
+// NOTE: Pilot v2.0 will implement the capability to parse long arguments
+// but will not originate them. This will assure backwards compatibility with
+// the 1.0 desktop as well as compatibility with the future version of the
+// desktop software which may originate the "long" argument wrappers.
+//
+// Int32 argument wrappers are identified by the dlpLongArgFlag bits set
+// in the argument id field.
+
+// Maximum long argument size which can be "wrapped"
+#define dlpMaxLongArgSize 0xFFFFFFFFL
+
+typedef struct DlpLongArgWrapperType {
+ // OFFSET
+ UInt16 wID; // 0; argument ID
+ UInt32 dwSize; // 2; argument size (does NOT include this arg header)
+ // TOTAL: 6 bytes
+ } DlpLongArgWrapperType;
+typedef DlpLongArgWrapperType* DlpLongArgWrapperPtr;
+
+typedef struct DlpLongArgType {
+ // OFFSET
+ DlpLongArgWrapperType wrapper; // 0; argument header
+ UInt8 data[2]; // 6; argument data -- var size
+ } DlpLongArgType;
+typedef DlpLongArgType* DlpLongArgPtr;
+
+
+//-------------------------------------------------------------------------
+// Unions of all argument and wrapper types
+//-------------------------------------------------------------------------
+
+// Union of all argument wrapper types
+typedef union DlpGenericArgWrapperType {
+ DlpShortArgWrapperType shortWrap; // "Int16" arg wrapper(tiny and small)
+ DlpLongArgWrapperType longWrap; // "long" arg wrapper
+ } DlpGenericArgWrapperType;
+typedef DlpGenericArgWrapperType* DlpGenericArgWrapperPtr;
+
+
+// Union of all argument types
+typedef union DlpGenericArgType {
+ DlpShortArgType shortArg; // "Int16" arg(tiny and small)
+ DlpLongArgType longArg; // "long" arg
+ } DlpGenericArgType;
+typedef DlpGenericArgType* DlpGenericArgPtr;
+
+
+/********************************************************************
+ * Desktop Link Protocol Parameters
+ ********************************************************************/
+
+// dlpCmdTimeoutSec -- this is the number of seconds to wait for a command
+// to begin coming in before timing out
+//
+#define dlpCmdTimeoutSec 30
+
+
+
+/************************************************************
+ * DLP function argument structures
+ *************************************************************/
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadUserInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments: none
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpReadUserInfoRespArgID dlpFirstArgID
+
+typedef struct DlpReadUserInfoRespHdrType {
+ // OFFSET
+ UInt32 userID; // 0; user ID number (0 if none)
+ UInt32 viewerID; // 4; id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // 8; last sync PC id (0 if none)
+ DlpDateTimeType succSyncDate; // 12; last successful sync (year = 0 if none)
+ DlpDateTimeType lastSyncDate; // 20; last sync date(year = 0 if none)
+ UInt8 userNameLen; // 28; length of user name field,
+ // including null (0 = no user name)
+ UInt8 passwordLen; // 29; length of encrypted password
+ // (0 = no password set)
+ // TOTAL: 30 bytes
+ } DlpReadUserInfoRespHdrType;
+
+typedef struct DlpReadUserInfoRespType {
+ // OFFSET
+ DlpReadUserInfoRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 30 bytes
+ UInt8 nameAndPassword[2]; // 30; user name -- var size
+ // User name begins at the nameAndPassword field and is null-terminated.
+ // The encrypted password follows the user name and is NOT null-terminated.
+ // The encrypted password may contain any byte values(0-255).
+ } DlpReadUserInfoRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteUserInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+// user id (4 bytes)
+// last sync PC id(4 bytes)
+// user name
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpWriteUserInfoReqArgID dlpFirstArgID
+
+#define dlpMaxUserNameSize 41 // max user name size, including null byte
+
+typedef struct DlpWriteUserInfoReqHdrType {
+ // OFFSET
+ UInt32 userID; // 0; user ID number
+ UInt32 viewerID; // 4; id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // 8; last sync PC id
+ DlpDateTimeType lastSyncDate; // 12; last sync date(year = 0 if none)
+ UInt8 modFlags; // 20; flags indicating which values are being
+ // modified; see the dlpUserInfoMod...
+ // flags defined below
+ UInt8 userNameLen; // 21; user name length, including null
+ // TOTAL: 22 bytes
+ } DlpWriteUserInfoReqHdrType;
+
+// Flags indicating which values are being changed by the dlpWriteUserInfo
+// request. These flags are used in the modFlags field of DlpWriteUserInfoReqHdrType.
+// These flags are additive.
+//
+#define dlpUserInfoModUserID 0x80 // changing the user id
+#define dlpUserInfoModSyncPC 0x40 // changing the last sync PC id
+#define dlpUserInfoModSyncDate 0x20 // changing sync date
+#define dlpUserInfoModName 0x10 // changing user name
+#define dlpUserInfoModViewerID 0x08 // changing the viewer id
+
+typedef struct DlpWriteUserInfoReqType {
+ // OFFSET
+ DlpWriteUserInfoReqHdrType
+ header; // 0; fixed-size header
+ // FIXED SIZE: 22 bytes
+ UInt8 userName[2]; // 22; user name -- var size
+ // User name begins at the userName field and is null-terminated.
+ } DlpWriteUserInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadSysInfo
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem
+//
+
+// Request argument structure:
+//
+// none. DLP v1.0 and v1.1
+
+enum {
+ // NEW FOR DLP v1.2:
+ dlpReadSysInfoReqArgID = dlpFirstArgID
+ };
+
+
+// dlpReadSysInfoReqArgID request arg structure
+//
+typedef struct DlpReadSysInfoReqType {
+ // OFFSET
+ DlpVersionType dlpVer; // 0; DLP version of the caller
+ // TOTAL: 4 bytes
+ } DlpReadSysInfoReqType;
+
+
+// Response argument structure:
+//
+// Both response arguments are returned in one reply
+enum {
+ dlpReadSysInfoRespArgID = dlpFirstArgID,
+
+ // NEW FOR DLP v1.2:
+ dlpReadSysInfoVerRespArgID
+ };
+
+// dlpReadSysInfoRespArgID response arg structure:
+//
+typedef struct DlpReadSysInfoRespType {
+ // OFFSET
+ UInt32 romSWVersion; // 0; ROM-based sys software version
+ UInt32 localizationID;// 4; localization ID
+ UInt8 unused; // 8; unused(for alignment) -- set to null!
+ UInt8 prodIDSize; // 9; size of productID/model field
+ UInt32 prodID; // 10; product id (was variable size)
+ // TOTAL: 14 bytes
+ } DlpReadSysInfoRespType;
+
+
+// dlpReadSysInfoVerRespArgID response arg structure:
+//
+typedef struct DlpReadSysInfoVerRespType {
+ // OFFSET
+ DlpVersionType dlpVer; // 0; DLP version of the device
+ DlpVersionType compVer; // 4; product compatibility version of the device
+ UInt32 dwMaxRecSize; // 8; maximum record/resource size that may be allocated on
+ // the device given that sufficient free memory exists
+ // (0xFFFFFFFF = up to available memory)
+ // TOTAL: 12 bytes
+ } DlpReadSysInfoVerRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpGetSysDateTime
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes: none
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpGetSysDateTimeRespArgID dlpFirstArgID
+
+typedef struct DlpGetSysDateTimeRespType {
+ // OFFSET
+ DlpDateTimeType dateTime; // 0; system date/time
+ // TOTAL: 8 bytes
+ } DlpGetSysDateTimeRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpSetSysDateTime
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+// new system date/time
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpSetSysDateTimeReqArgID dlpFirstArgID
+
+typedef struct DlpSetSysDateTimeReqType {
+ // OFFSET
+ DlpDateTimeType dateTime; // 0; new system date/time
+ // TOTAL: 8 bytes
+ } DlpSetSysDateTimeReqType;
+
+typedef DlpSetSysDateTimeReqType* DlpSetSysDateTimeReqPtr;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadStorageInfo
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+enum {
+ dlpReadStorageInfoReqArgID = dlpFirstArgID
+ };
+
+typedef struct DlpReadStorInfoReqType {
+ // OFFSET
+ UInt8 startCardNo; // 0; card number to start at
+ // (0 = first)
+ UInt8 unused; // 1; unused -- set to null!
+ // TOTAL: 2 bytes
+ } DlpReadStorInfoReqType;
+
+
+// Response argument structure:
+//
+enum {
+ dlpReadStorageInfoRespArgID = dlpFirstArgID,
+ dlpReadStorageInfoExRespArgID // v1.1 extension
+ };
+
+//
+// dlpReadStorageInfoRespArgID:
+//
+
+// Card info structure of variable size
+typedef struct DlpCardInfoHdrType {
+ // OFFSET
+ UInt8 totalSize; // 0; total size of this card info
+ // *ROUNDED UP TO EVEN SIZE*
+ UInt8 cardNo; // 1; card number
+ UInt16 cardVersion; // 2; card version
+ DlpDateTimeType crDate; // 4; creation date/time
+ UInt32 romSize; // 12; ROM size
+ UInt32 ramSize; // 16; RAM size
+ UInt32 freeRam; // 20; total free data store RAM - Fixed in DLP v1.2 to exclude
+ // dynamic heap RAM
+ UInt8 cardNameSize; // 24; size of card name string
+ UInt8 manufNameSize; // 25; size of manuf. name string
+ // TOTAL: 26 bytes;
+ } DlpCardInfoHdrType;
+
+typedef struct DlpCardInfoType {
+ // OFFSET
+ DlpCardInfoHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 26 bytes;
+ UInt8 cardNameAndManuf[2];
+ // 26; card name and manuf. text -- var size
+ // Card name is the cardNameSize bytes of text at cardNameAndManuf,
+ // followed immediately by manufNameSize bytes of manufacturer name.
+ } DlpCardInfoType;
+
+
+typedef struct DlpReadStorInfoRespHdrType {
+ // OFFSET
+ UInt8 lastCardNo; // 0; card number of last card retrieved
+ UInt8 more; // 1; non-zero if there are more cards
+ UInt8 unused; // 2; unused -- set to null!
+ UInt8 actCount; // 3; actual count of structures returned
+ // TOTAL: 4 bytes
+ } DlpReadStorInfoRespHdrType;
+
+typedef struct DlpReadStorInfoRespType {
+ // OFFSET
+ DlpReadStorInfoRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes
+ DlpCardInfoType cardInfo[1]; // 4; actCount of card info structures -- var size
+ } DlpReadStorInfoRespType;
+
+
+//
+// EXTENDED ARGUMENTS(DL v1.1): dlpReadStorageInfoExRespArgID
+//
+typedef struct DlpReadStorInfoExRespType {
+ // OFFSET
+ UInt16 romDBCount; // 0; ROM database count
+ UInt16 ramDBCount; // 2; RAM database count
+ UInt32 dwReserved1; // 4; RESERVED -- SET TO NULL!
+ UInt32 dwReserved2; // 8; RESERVED -- SET TO NULL!
+ UInt32 dwReserved3; // 12; RESERVED -- SET TO NULL!
+ UInt32 dwReserved4; // 16; RESERVED -- SET TO NULL!
+ // TOTAL: 20 bytes
+ } DlpReadStorInfoExRespType;
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadDBList
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+#define dlpReadDBListReqArgID dlpFirstArgID
+
+typedef struct DlpReadDBListReqType {
+ // OFFSET
+ UInt8 srchFlags; // 0; search flags
+ UInt8 cardNo; // 1; card number -- 0-based
+ UInt16 startIndex; // 2; DB index to start at
+ // (0 = from beginning)
+ // TOTAL: 4 bytes
+ } DlpReadDBListReqType;
+
+#define dlpReadDBListFlagRAM 0x80 // Search for RAM-based
+#define dlpReadDBListFlagROM 0x40 // Search for ROM-based
+#define dlpReadDBListFlagMultiple 0x20 // OK to return multiple entries (DEFINED FOR DLP v1.2)
+
+
+// Response argument structure:
+//
+#define dlpReadDBListRespArgID dlpFirstArgID
+
+// Database info structure of variable size
+typedef struct DlpDBInfoHdrType {
+ // OFFSET
+ UInt8 totalSize; // 0; total size of the DB info (DlpDBInfoHdrType + name)
+ // *ROUNDED UP TO EVEN SIZE*
+ UInt8 miscFlags; // 1; dlpDbInfoMiscFlag... flags(v1.1) -- set all unused bits to null!
+ UInt16 dbFlags; // 2; DB flags: dlpDBFlagReadOnly,
+ // dlpDBFlagResDB, dlpDBFlagAppInfoDirty, dlpDBFlagOpen,
+ // dlpDBFlagBackup, etc;
+ UInt32 type; // 4; database type
+ UInt32 creator; // 8; database creator
+ UInt16 version; // 12; database version
+ UInt32 modNum; // 14; modification number
+ DlpDateTimeType crDate; // 18; creation date
+ DlpDateTimeType modDate; // 26; latest modification date
+ DlpDateTimeType backupDate; // 34; latest backup date
+ UInt16 dbIndex; // 42; DB index (or dlpDbInfoUnknownDbIndex for dlpFindDB)
+ // TOTAL: 44 bytes;
+ } DlpDBInfoHdrType;
+
+// Flags for the miscFlags field of DlpDBInfoHdrType
+#define dlpDbInfoMiscFlagExcludeFromSync 0x80 // DEFINED FOR DLP v1.1
+#define dlpDbInfoMiscFlagRamBased 0x40 // DEFINED FOR DLP v1.2
+
+// Unknown index value for the dbIndex field of DlpDBInfoHdrType
+#define dlpDbInfoUnknownDbIndex 0xFFFF
+
+
+typedef struct DlpDBInfoType {
+ // OFFSET
+ DlpDBInfoHdrType header; // 0; fixed-size header
+ // FIXED SIZE: 44 bytes;
+ UInt8 name[2]; // 44; databse name text -- var size and
+ // null-terminated
+ } DlpDBInfoType;
+
+
+typedef struct DlpReadDBListRespHdrType {
+ // OFFSET
+ UInt16 lastIndex; // 0; DB index of last entry retrieved
+ UInt8 flags; // 2; flags: dlpReadDBListRespFlagMore
+ UInt8 actCount; // 3; actual count of structures returned
+ // TOTAL: 4 bytes
+ } DlpReadDBListRespHdrType;
+
+// dlpReadDBListRespFlagMore flag: if set, indicates that there are more
+// databases to list -- this enables the server to send the listing
+// incrementally, reducing server memory requirements if necessary
+#define dlpReadDBListRespFlagMore 0x80
+
+typedef struct DlpReadDBListRespType {
+ // OFFSET
+ DlpReadDBListRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes
+ DlpDBInfoType dbInfo[1]; // 4; actCount of DB info structures -- var size
+ } DlpReadDBListRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpOpenDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrTooManyOpenDatabases
+// dlpRespErrCantOpen
+
+// Request argument structure:
+//
+#define dlpOpenDBReqArgID dlpFirstArgID
+
+typedef struct DlpOpenDBReqHdrType {
+ // OFFSET
+ UInt8 cardNo; // 0; memory module number
+ UInt8 mode; // 1; open mode
+ // TOTAL: 2 bytes;
+ } DlpOpenDBReqHdrType;
+
+#define dlpOpenDBModeRead 0x80
+#define dlpOpenDBModeWrite 0x40
+#define dlpOpenDBModeExclusive 0x20
+#define dlpOpenDBModeShowSecret 0x10
+
+
+typedef struct DlpOpenDBReqType {
+ // OFFSET
+ DlpOpenDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt8 name[2]; // 2; databse name text -- var size
+ // zero-terminated
+ } DlpOpenDBReqType;
+
+typedef DlpOpenDBReqType* DlpOpenDBReqPtr;
+
+
+// Response argument structure:
+//
+#define dlpOpenDBRespArgID dlpFirstArgID
+//
+// The response argument is the 1-byte database ID to be passed in
+// subsequent read/write requests.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCreateDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrAlreadyExists,
+// dlpRespErrCantOpen,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrTooManyOpenDatabases
+
+// Request argument structure:
+//
+#define dlpCreateDBReqArgID dlpFirstArgID
+
+typedef struct DlpCreateDBReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; DB creator
+ UInt32 type; // 4; DB type
+ UInt8 cardNo; // 8; memory module number
+ UInt8 unused; // 9; unused -- set to null
+ UInt16 dbFlags; // 10; allowed flags: dlpDBFlagResDB,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall
+ UInt16 version; // 12; DB version #
+ // TOTAL: 14 bytes;
+ } DlpCreateDBReqHdrType;
+
+typedef struct DlpCreateDBReqType {
+ // OFFSET
+ DlpCreateDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 12 bytes;
+ UInt8 name[2]; // 14; DB name text -- var size
+ // zero-terminated
+ } DlpCreateDBReqType;
+
+typedef DlpCreateDBReqType* DlpCreateDBReqPtr;
+
+
+// Response argument structure:
+//
+#define dlpCreateDBRespArgID dlpFirstArgID
+
+// The response argument is the 1-byte database ID to be passed in
+// subsequent read/write requests.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCloseDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrParam,
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+typedef enum {
+ dlpCloseDBReqArgID = dlpFirstArgID, // close a specific database
+ dlpCloseDBAllReqArgID, // close all databases
+ dlpCloseDBExReqArgID // close a specific db and update backup
+ // and/or modification dates (PalmOS v3.0)
+ } DlpCloseDBReqArgID;
+
+// Argument structure to close a specific database(dlpCloseDBDBIDReqArgID):
+//
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+typedef UInt8 DlpCloseDBReqType;
+
+// Argument structure to close all databases(dlpCloseDBReqAllArgID):
+//
+// This request argument contains no data
+
+
+// Request type for dlpCloseDBExReqArgID (PalmOS v3.0):
+typedef struct DlpCloseDBExReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id to close
+ UInt8 bOptFlags; // 1; bitfield of dlpCloseDBExOptFlag... flags
+ // TOTAL: 2 bytes
+ } DlpCloseDBExReqType;
+
+// Option flags
+#define dlpCloseDBExOptFlagUpdateBackupDate 0x80 // Update the backup date after closing
+#define dlpCloseDBExOptFlagUpdateModDate 0x40 // Update the modification date after closing
+
+
+#define dlpCloseDBExOptAllFlags (dlpCloseDBExOptFlagUpdateBackupDate | dlpCloseDBExOptFlagUpdateModDate)
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteDB
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrCantOpen,
+// dlpRespErrDatabaseOpen
+
+// Request argument structure:
+//
+#define dlpDeleteDBReqArgID dlpFirstArgID
+
+typedef struct DlpDeleteDBReqHdrType {
+ // OFFSET
+ UInt8 cardNo; // 0; memory module number
+ UInt8 unused; // 1; unused -- set to null!
+ // TOTAL: 2 bytes;
+ } DlpDeleteDBReqHdrType;
+
+
+typedef struct DlpDeleteDBReqType {
+ // OFFSET
+ DlpDeleteDBReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt8 name[2]; // 2; databse name text -- var size
+ // zero-terminated
+ } DlpDeleteDBReqType;
+
+typedef DlpDeleteDBReqType* DlpDeleteDBReqPtr;
+
+
+// Response argument structure:
+//
+// none.
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadOpenDBInfo
+//////////////////////////////////////////////////////////////////////////
+// Get information on an open database
+//
+// Possible error codes
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadOpenDBInfoArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+#define dlpReadOpenDBInfoRespArgID dlpFirstArgID
+
+
+typedef struct DlpReadOpenDBInfoRespType {
+ // OFFSET
+ UInt16 numRec; // 0; number of records or resources
+ // TOTAL: 2 bytes
+ } DlpReadOpenDBInfoRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpMoveCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+
+// Request argument structure:
+//
+#define dlpMoveCategoryReqArgID dlpFirstArgID
+
+typedef struct DlpMoveCategoryReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 fromCategory; // 1; id of the "from" category
+ UInt8 toCategory; // 2; id of the "to" category
+ UInt8 unused; // 3; unused -- set to null!
+ // TOTAL: 4 bytes;
+ } DlpMoveCategoryReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadAppBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadBlockReqArgID dlpFirstArgID
+
+typedef struct DlpReadBlockReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 offset; // 2; offset into the block
+ UInt16 numBytes; // 4; number of bytes to read starting
+ // at offset(-1 = to the end)
+ // TOTAL: 6 bytes;
+ } DlpReadBlockReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadBlockRespArgID dlpFirstArgID
+
+typedef struct DlpReadBlockRespHdrType {
+ // OFFSET
+ UInt16 blockSize; // 0; actual block size -- may be greater
+ // than the amount of data returned
+ // TOTAL: 2 bytes
+ } DlpReadBlockRespHdrType;
+
+typedef struct DlpReadBlockRespType {
+ // OFFSET
+ DlpReadBlockRespHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 2 bytes
+ UInt8 data[2]; // 2; block data -- var size
+ } DlpReadBlockRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteAppBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrReadOnly
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteBlockReqArgID dlpFirstArgID
+
+typedef struct DlpWriteBlockReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 blockSize; // 2; total block size(0 = free existing block)
+ // TOTAL: 4 bytes;
+ } DlpWriteBlockReqHdrType;
+
+
+typedef struct DlpWriteBlockReqType {
+ // OFFSET
+ DlpWriteBlockReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 4 bytes;
+ UInt8 data[2]; // 4; block data -- var size
+ } DlpWriteBlockReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadSortBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+// see dlpReadAppBlock
+
+
+// Response argument structure:
+//
+// see dlpReadAppBlock
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteSortBlock
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+// see dlpWriteAppBlock
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextModifiedRec
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadRecord
+//
+
+// Request argument structure:
+//
+#define dlpReadNextModRecReqArgID dlpFirstArgID
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+// Response argument id = dlpReadRecordRespArgID
+
+// Response argument structure = DlpReadRecordRespType
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetRecordIndex
+//////////////////////////////////////////////////////////////////////////
+// Resets the "next modified record" index to the beginning
+//
+// Possible error codes
+// dlpRespErrParam
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpResetRecordIndexReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrNotSupported,
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrRecordBusy,
+// dlpRespErrNoneOpen
+
+typedef enum {
+ dlpReadRecordIdArgID = dlpFirstArgID,
+ dlpReadRecordIndexArgID
+ } DlpReadRecordReqArgID;
+
+// dlpReadRecordIdArgID request argument structure:
+//
+typedef struct DlpReadRecordByIDReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt32 recordID; // 2; unique record id
+ UInt16 offset; // 6; offset into the record
+ UInt16 numBytes; // 8; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 10 bytes;
+ } DlpReadRecordByIDReqType;
+
+// dlpReadRecordIndexArgID request argument structure:
+//
+typedef struct DlpReadRecordByIndexReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 index; // 2; record index
+ UInt16 offset; // 4; offset into the record
+ UInt16 numBytes; // 6; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 8 bytes;
+ } DlpReadRecordByIndexReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadRecordRespArgID dlpFirstArgID
+
+typedef struct DlpReadRecordRespHdrType {
+ // OFFSET
+ UInt32 recordID; // 0; unique record id
+ UInt16 index; // 4; record index
+ UInt16 recSize; // 6; total record size in bytes
+ UInt8 attributes; // 8; record attributes
+ UInt8 category; // 9; record category index
+ // TOTAL: 10 bytes;
+ } DlpReadRecordRespHdrType;
+
+typedef struct DlpReadRecordRespType {
+ // OFFSET
+ DlpReadRecordRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes;
+ UInt8 data[2]; // 8; record data -- var size
+ } DlpReadRecordRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadRecordIDList
+//////////////////////////////////////////////////////////////////////////
+// Returns a list of unique record id's. May need to call more than once
+// to get the entire list. dlpRespErrNotFound is returned when "start"
+// is out of bounds
+//
+// Possible error codes
+// dlpRespErrNotSupported,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+// dlpRespErrNoneOpen
+
+#define dlpReadRecordIDListReqArgID dlpFirstArgID
+
+// dlpReadRecordIDListReqArgID request argument structure:
+//
+typedef struct DlpReadRecordIDListReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; request flags
+ UInt16 start; // 2; starting record index (0-based)
+ UInt16 maxEntries; // 4; maximum number of entries, or
+ // 0xFFFF to return as many as possible
+ // TOTAL: 6 bytes;
+ } DlpReadRecordIDListReqType;
+
+// dlpReadRecordIDListFlagSortDB: if set, DL Server will call the creator
+// application to resort the database before returning the list.
+#define dlpReadRecordIDListFlagSortDB 0x80
+
+
+// Response argument structure:
+//
+#define dlpReadRecordIDListRespArgID dlpFirstArgID
+
+typedef struct DlpReadRecordIDListRespHdrType {
+ // OFFSET
+ UInt16 numEntries; // 0; number of entries returned
+ // TOTAL: 2 bytes;
+ } DlpReadRecordIDListRespHdrType;
+
+typedef struct DlpReadRecordIDListRespType {
+ // OFFSET
+ DlpReadRecordIDListRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 2 bytes;
+ UInt32 recID[1]; // 8; list of record id's -- var size
+ } DlpReadRecordIDListRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteRecordReqArgID dlpFirstArgID
+
+// dlpWriteRecordReqArgID -- required
+typedef struct DlpWriteRecordReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; set unused bits to null!
+ UInt32 recordID; // 2; unique record id or null
+ UInt8 attributes; // 6; record attributes -- only
+ // dlpRecAttrSecret is allowed here
+ // v1.1 extension:
+ // dlpRecAttrDeleted, dlpRecAttrArchived and
+ // dlpRecAttrDirty are also allowed.
+ UInt8 category; // 7; record category
+ // TOTAL: 8 bytes;
+ } DlpWriteRecordReqHdrType;
+
+#define dlpWriteRecordReqFlagDataIncluded 0x80 // original implementer of destop software always
+ // set this bit. Define it here for compatibility
+
+typedef struct DlpWriteRecordReqType {
+ // OFFSET
+ DlpWriteRecordReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes;
+ UInt8 data[2]; // 8; record data -- var size
+ } DlpWriteRecordReqType;
+
+
+// Response argument structure:
+//
+#define dlpWriteRecordRespArgID dlpFirstArgID
+
+typedef struct DlpWriteRecordRespType {
+ // OFFSET
+ UInt32 recordID; // 0; record ID
+ // TOTAL: 4 bytes
+ } DlpWriteRecordRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteRecord
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+//
+
+// Request argument structure:
+//
+#define dlpDeleteRecordReqArgID dlpFirstArgID
+
+// Argument structure to delete by record ID(dlpDeleteRecordReqIDArgID):
+typedef struct DlpDeleteRecordReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; flags (dlpDeleteRecFlagDeleteAll)
+ UInt32 recordID; // 2; unique record id (see flags)
+ // TOTAL: 6 bytes;
+ } DlpDeleteRecordReqType;
+
+// dlpDeleteRecFlagDeleteAll: if this flag is set, the reocordID field
+// is ignored and all database records will be deleted
+#define dlpDeleteRecFlagDeleteAll 0x80
+
+// dlpDeleteRecFlagByCategory: if this flag is set, the least significant byte
+// of the reocordID field contains the category id of records to be deleted (PalmOS 2.0)
+#define dlpDeleteRecFlagByCategory 0x40
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNoneOpen
+
+typedef enum {
+ dlpReadResourceIndexArgID = dlpFirstArgID,
+ dlpReadResourceTypeArgID
+ } DlpReadResourceReqArgID;
+
+// dlpReadResourceIndexArgID request argument structure:
+//
+typedef struct DlpReadResourceByIndexReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt16 index; // 2; resource index
+ UInt16 offset; // 4; offset into the resource
+ UInt16 numBytes; // 6; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 8 bytes;
+ } DlpReadResourceByIndexReqType;
+
+// dlpReadResourceTypeArgID request argument structure:
+//
+typedef struct DlpReadResourceByTypeReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; unused -- set to null!
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ UInt16 offset; // 8; offset into the resource
+ UInt16 numBytes; // 10; number of bytes to read starting
+ // at the offset(-1 = "to the end")
+ // TOTAL: 12 bytes;
+ } DlpReadResourceByTypeReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadResourceRespArgID dlpFirstArgID
+
+typedef struct DlpReadResourceRespHdrType {
+ // OFFSET
+ UInt32 type; // 0; resource type
+ UInt16 id; // 4; resource id
+ UInt16 index; // 6; resource index
+ UInt16 resSize; // 8; total resource size in bytes
+ // TOTAL: 10 bytes;
+ } DlpReadResourceRespHdrType;
+
+typedef struct DlpReadResourceRespType {
+ // OFFSET
+ DlpReadResourceRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes;
+ UInt8 resData[2]; // 6; resource data -- var size
+ } DlpReadResourceRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpWriteResourceReqArgID dlpFirstArgID
+
+typedef struct DlpWriteResourceReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 unused; // 1; inused -- set to null!
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ UInt16 resSize; // 8; total resource size
+ // TOTAL: 10 bytes;
+ } DlpWriteResourceReqHdrType;
+
+typedef struct DlpWriteResourceReqType {
+ // OFFSET
+ DlpWriteResourceReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 10 bytes;
+ UInt8 data[2]; // 10; resource data -- var size
+ } DlpWriteResourceReqType;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpDeleteResource
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpDeleteResourceReqArgID dlpFirstArgID
+
+typedef struct DlpDeleteResourceReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 flags; // 1; flags (dlpDeleteResFlagDeleteAll)
+ UInt32 type; // 2; resource type
+ UInt16 id; // 6; resource id
+ // TOTAL: 8 bytes;
+ } DlpDeleteResourceReqType;
+
+// dlpDeleteResFlagDeleteAll: if set, all resources in the db will be deleted
+#define dlpDeleteResFlagDeleteAll 0x80
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCleanUpDatabase
+//////////////////////////////////////////////////////////////////////////
+// Deletes all records which are marked as archived or deleted in the
+// record database
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrReadOnly,
+// dlpRespErrNotSupported
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpCleanUpDatabaseReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetSyncFlags
+//////////////////////////////////////////////////////////////////////////
+// For record databases, reset all dirty flags.
+// For both record and resource databases, set the last sync time to NOW
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam
+// dlpRespErrReadOnly,
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+#define dlpResetSyncFlagsReqArgID dlpFirstArgID
+
+// The request argument is the 1-byte database ID returned in open/create
+// DB responses.
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpCallApplication
+//////////////////////////////////////////////////////////////////////////
+// Call an application entry point via an action code
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+
+// Request argument structure:
+//
+enum {
+ dlpCallApplicationReqArgIDV10 = dlpFirstArgID, // req id for Pilot v1.0
+ dlpCallAppReqArgID // req id for Pilot v2.0 and later
+ };
+
+// dlpCallApplicationReqArgIDV10:
+typedef struct DlpCallApplicationReqHdrTypeV10 {
+ // OFFSET
+ UInt32 creator; // 0; app DB creator id
+ UInt16 action; // 4; action code
+ UInt16 paramSize; // 6; custom param size
+ // TOTAL: 8 bytes
+ } DlpCallApplicationReqHdrTypeV10;
+
+typedef struct DlpCallApplicationReqTypeV10 {
+ // OFFSET
+ DlpCallApplicationReqHdrTypeV10 //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 8 bytes
+ UInt8 paramData[2]; // 8; custom param data -- var size
+ } DlpCallApplicationReqTypeV10;
+
+
+// dlpCallAppReqArgID (Pilot v2.0):
+typedef struct DlpCallAppReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; DB creator id of target executable
+ UInt32 type; // 4; DB type id of target executable
+ UInt16 action; // 8; action code
+ UInt32 dwParamSize; // 10; custom param size in number of bytes
+ UInt32 dwReserved1; // 14; RESERVED -- set to NULL!!!
+ UInt32 dwReserved2; // 18; RESERVED -- set to NULL!!!
+ // TOTAL: 22 bytes
+ } DlpCallAppReqHdrType;
+
+typedef struct DlpCallAppReqType {
+ // OFFSET
+ DlpCallAppReqHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 22 bytes
+ UInt8 paramData[2]; // 22; custom param data -- var size
+ } DlpCallAppReqType;
+
+
+
+// Response argument structure:
+//
+enum {
+ dlpCallApplicationRespArgIDV10 = dlpFirstArgID, // resp id for Pilot v1.0
+ dlpCallAppRespArgID // resp id for Pilot v2.0 and later
+ };
+
+// dlpCallApplicationRespArgIDV10:
+typedef struct DlpCallApplicationRespHdrTypeV10 {
+ // OFFSET
+ UInt16 action; // 0; action code which was called
+ UInt16 resultCode; // 2; result error code returned by action
+ UInt16 resultSize; // 4; custom result data size
+ // TOTAL: 6 bytes
+ } DlpCallApplicationRespHdrTypeV10;
+
+typedef struct DlpCallApplicationRespTypeV10 {
+ // OFFSET
+ DlpCallApplicationRespHdrTypeV10 //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes
+ UInt8 resultData[2]; // 6; custom result data -- var size
+ } DlpCallApplicationRespTypeV10;
+
+// dlpCallAppRespArgID:
+typedef struct DlpCallAppRespHdrType {
+ // OFFSET
+ UInt32 dwResultCode; // 0; result error code returned by handler
+ UInt32 dwResultSize; // 4; custom result data size
+ UInt32 dwReserved1; // 8; RESERVED -- SET TO NULL!!!
+ UInt32 dwReserved2; // 12; RESERVED -- SET TO NULL!!!
+ // TOTAL: 16 bytes
+ } DlpCallAppRespHdrType;
+
+typedef struct DlpCallAppRespType {
+ // OFFSET
+ DlpCallAppRespHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 16 bytes
+ UInt8 resultData[2]; // 16; custom result data -- var size
+ } DlpCallAppRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpResetSystem
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpAddSyncLogEntry
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrLimitExceeded,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpAddSyncLogEntryReqArgID dlpFirstArgID
+
+typedef struct DlpAddSyncLogEntryReqType {
+ // OFFSET
+ UInt8 text[2]; // 0; entry text -- var size and
+ // null-terminated
+ } DlpAddSyncLogEntryReqType;
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpProcessRPC
+//////////////////////////////////////////////////////////////////////////
+// Remote Procedure Call interface
+//
+// Request arguments:
+// RPC command block
+//
+// Response arguments:
+// RPC reply block
+//
+// Possible error codes
+// 0 on success; otherwise error code from the TouchDown
+// RPC executor
+//
+// NOTE: this is a low-level system command which does not use arg wrappers.
+
+// Request argument structure:
+//
+// Block of RPC command data (no arg wrapper)
+
+// Response argument structure:
+//
+// Block of RPC reply data of same length as command block(no arg wrapper)
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpOpenConduit
+//////////////////////////////////////////////////////////////////////////
+// This command is sent before each conduit is opened by the desktop.
+// If the viewer has a cancel pending, it will return dlpRespErrCancelSync
+// in the response header's errorCode field.
+//
+// Request arguments: none.
+//
+// Response arguments: none.
+//
+// Possible error codes
+// dlpRespErrCancelSync
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpEndOfSync
+//////////////////////////////////////////////////////////////////////////
+// This command is sent by the desktop to end the sync.
+//
+// Request arguments: termination code: 0 = normal termination;
+// otherwise the client is aborting the sync
+//
+// Possible error codes
+// 0
+
+// Request argument structure:
+//
+#define dlpEndOfSyncReqArgID dlpFirstArgID
+
+typedef enum DlpSyncTermCode {
+ dlpTermCodeNormal = 0, // normal termination
+ dlpTermCodeOutOfMemory, // termination due to low memory on TD
+ dlpTermCodeUserCan, // user cancelled from desktop
+ dlpTermCodeOther, // catch-all abnormal termination code
+ dlpTermCodeIncompatibleProducts // incompatibility between desktop and handheld hotsync products
+ } DlpSyncTermCode;
+
+
+typedef struct DlpEndOfSyncReqType {
+ // OFFSET
+ UInt16 termCode; // 0; termination code
+ // TOTAL: 2 bytes
+ } DlpEndOfSyncReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextRecInCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadRecord
+
+#define dlpReadNextRecInCategoryReqArgID dlpFirstArgID
+
+// dlpReadNextRecInCategoryReqArgID request argument structure:
+//
+typedef struct DlpReadNextRecInCategoryReqType {
+ // OFFSET
+ UInt8 dbID; // 0; database id
+ UInt8 category; // 1; category id
+ // TOTAL: 2 bytes;
+ } DlpReadNextRecInCategoryReqType;
+
+
+// Response argument structure:
+//
+// Response argument id = dlpReadRecordRespArgID
+
+// Response argument structure = DlpReadRecordRespType
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNextModifiedRecInCategory
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// see dlpReadNextRecInCategory
+
+// Request argument structure:
+//
+// same as dlpReadNextRecInCategory
+
+// Response argument structure:
+//
+// same as dlpReadNextRecInCategory
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadAppPreference
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory,
+// dlpRespErrParam,
+// dlpRespErrNotFound,
+
+#define dlpReadAppPreferenceReqArgID dlpFirstArgID
+
+// dlpReadAppPreferenceReqArgID request argument structure:
+//
+typedef struct DlpReadAppPreferenceReqType {
+ // OFFSET
+ UInt32 creator; // 0; application creator type
+ UInt16 id; // 4; preference id
+ UInt16 reqBytes; // 6; max. number of preference bytes requested;
+ // pass 0xFFFF for actual size
+ UInt8 flags; // 8; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db
+ UInt8 unused; // 9; reserved/padding -- set to NUL!
+ // TOTAL: 10 bytes;
+ } DlpReadAppPreferenceReqType;
+
+#define dlpReadAppPrefActualSize 0xFFFF
+#define dlpAppPrefReqFlagBackedUp 0x80
+
+// Response argument structure:
+//
+#define dlpReadAppPreferenceRespArgID dlpFirstArgID
+
+typedef struct DlpReadAppPreferenceRespHdrType {
+ // OFFSET
+ UInt16 version; // 0; version number of the application
+ UInt16 actualSize; // 2; actual preference data size
+ UInt16 retBytes; // 4; number of preference bytes returned
+ // TOTAL: 6 bytes
+ } DlpReadAppPreferenceRespHdrType;
+
+typedef struct DlpReadAppPreferenceRespType {
+ // OFFSET
+ DlpReadAppPreferenceRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 6 bytes
+ UInt8 data[2]; // 6; custom result data -- var size
+ } DlpReadAppPreferenceRespType;
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteAppPreference
+//////////////////////////////////////////////////////////////////////////
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotEnoughSpace
+
+// Request argument structure:
+//
+#define dlpWriteAppPreferenceReqArgID dlpFirstArgID
+
+typedef struct DlpWriteAppPreferenceReqHdrType {
+ // OFFSET
+ UInt32 creator; // 0; application creator type
+ UInt16 id; // 4; preference id
+ UInt16 version; // 6; version number of the application
+ UInt16 prefSize; // 8; preference size(in number of bytes)
+ UInt8 flags; // 10; command flags: dlpAppPrefReqFlagBackedUp - if set, use backed-up pref db
+ UInt8 unused; // 11; reserved/padding -- set to NUL!
+ // TOTAL: 12 bytes;
+ } DlpWriteAppPreferenceReqHdrType;
+
+typedef struct DlpWriteAppPreferenceReqType {
+ // OFFSET
+ DlpWriteAppPreferenceReqHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 12 bytes;
+ UInt8 data[2]; // 12; record data -- var size
+ } DlpWriteAppPreferenceReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadNetSyncInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments: none
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrMemory
+
+// Request argument structure:
+//
+// none.
+
+// Response argument structure:
+//
+#define dlpReadNetSyncInfoRespArgID dlpFirstArgID
+
+typedef struct DlpReadNetSyncInfoRespHdrType {
+ // OFFSET
+ UInt8 lanSyncOn; // 0; non-zero if Lan Sync is enabled
+ UInt8 bReserved1; // 1; reserved -- SET TO NULL!
+ UInt32 dwReserved1; // 2; reserved -- SET TO NULL!
+ UInt32 dwReserved2; // 6; reserved -- SET TO NULL!
+ UInt32 dwReserved3; // 10; reserved -- SET TO NULL!
+ UInt32 dwReserved4; // 14; reserved -- SET TO NULL!
+ UInt16 syncPCNameSize;// 18; length of sync PC host name,
+ // including null (0 = no host name)
+ UInt16 syncPCAddrSize;// 20; length of sync PC address,
+ // including null (0 = no address)
+ UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask,
+ // including null (0 = no mask)
+ // TOTAL: 24 bytes
+ } DlpReadNetSyncInfoRespHdrType;
+
+typedef struct DlpReadNetSyncInfoRespType {
+ // OFFSET
+ DlpReadNetSyncInfoRespHdrType //
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 24 bytes
+ UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size,
+ // null-terminated
+ } DlpReadNetSyncInfoRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpWriteNetSyncInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments: none
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotEnoughSpace,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpWriteNetSyncInfoReqArgID dlpFirstArgID
+
+#define dlpMaxHostAddrLength 255 // maximum PC host name length, not including NULL
+
+typedef struct DlpWriteNetSyncInfoReqHdrType {
+ // OFFSET
+ UInt8 modFlags; // 0; flags indicating which values are being
+ // modified; see the dlpNetSyncInfoMod...
+ // flags defined below
+ UInt8 lanSyncOn; // 1; non-zero if Lan Sync is enabled
+ UInt32 dwReserved1; // 2; reserved -- SET TO NULL!
+ UInt32 dwReserved2; // 6; reserved -- SET TO NULL!
+ UInt32 dwReserved3; // 10; reserved -- SET TO NULL!
+ UInt32 dwReserved4; // 14; reserved -- SET TO NULL!
+ UInt16 syncPCNameSize;// 18; length of sync PC host name,
+ // including null (0 = no address/host name)
+ UInt16 syncPCAddrSize;// 20; length of sync PC address,
+ // including null (0 = no address)
+ UInt16 syncPCMaskSize;// 22; length of sync PC subnet mask,
+ // including null (0 = no mask)
+ // TOTAL: 24 bytes
+ } DlpWriteNetSyncInfoReqHdrType;
+
+// Flags indicating which values are being changed by the dlpWriteNetSyncInfo
+// request. These flags are used in the modFlags field of DlpWriteNetSyncInfoReqHdrType.
+// These flags are additive.
+//
+#define dlpNetSyncInfoModLanSyncOn 0x80 // changing the "lan sync on" setting
+#define dlpNetSyncInfoModSyncPCName 0x40 // changing the sync PC host name
+#define dlpNetSyncInfoModSyncPCAddr 0x20 // changing the sync PC address
+#define dlpNetSyncInfoModSyncPCMask 0x10 // changing the sync PC subnet mask
+
+typedef struct DlpWriteNetSyncInfoReqType {
+ // OFFSET
+ DlpWriteNetSyncInfoReqHdrType
+ hdr; // 0; fixed-size header
+ // FIXED SIZE: 24 bytes
+ UInt8 syncAddr[2]; // 24; sync IP address/host name -- var size,
+ // null-terminated
+ } DlpWriteNetSyncInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpReadFeature
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotFound,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+#define dlpReadFeatureReqArgID dlpFirstArgID
+
+typedef struct DlpReadFeatureReqType {
+ // OFFSET
+ UInt32 dwFtrCreator; // 0; feature creator
+ UInt16 wFtrNum; // 4; feature number
+ // TOTAL: 6 bytes
+ } DlpReadFeatureReqType;
+
+
+// Response argument structure:
+//
+#define dlpReadFeatureRespArgID dlpFirstArgID
+
+typedef struct DlpReadFeatureRespType {
+ // OFFSET
+ UInt32 dwFeature; // 0; feature value
+ // TOTAL: 4 bytes
+ } DlpReadFeatureRespType;
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpFindDB
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrNotFound,
+// dlpRespErrParam
+
+// Request argument structure:
+//
+
+// dlpFindDBByNameReqArgID, dlpFindDBByTypeCreatorReqArgID and dlpFindDBByOpenHandleReqArgID
+// are mutually exclusive
+enum {
+ dlpFindDBByNameReqArgID = dlpFirstArgID, // req id for card + name based search
+ dlpFindDBByOpenHandleReqArgID, // req id for search given an open db handle
+ dlpFindDBByTypeCreatorReqArgID // req id for type + creator based iterative search
+ };
+
+// Option flags
+#define dlpFindDBOptFlagGetAttributes 0x80 // get database attributes -- this is
+ // an option to allow find operations to skip
+ // returning this data as a performance optimization
+
+#define dlpFindDBOptFlagGetSize 0x40 // get record count and data size also -- this is
+ // an option because the operation can take a long
+ // time, which we would rather avoid if it is not needed
+
+#define dlpFindDBOptFlagGetMaxRecSize 0x20 // get max rec/resource size -- this is
+ // an option because the operation can take a long
+ // time, which we would rather avoid if it is not needed
+ // (dlpFindDBOptFlagGetMaxRecSize is only supported for
+ // dlpFindDBByOpenHandleReqArgID)
+
+// Request type for dlpdlpFindDBByNameReqArgID:
+typedef struct DlpFindDBByNameReqHdrType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bCardNo; // 2; card number to search
+ // TOTAL: 4 bytes
+ } DlpFindDBByNameReqHdrType;
+
+typedef struct DlpFindDBByNameReqType {
+ // OFFSET
+ DlpFindDBByNameReqHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 4 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpFindDBByNameReqType;
+
+
+// Request type for dlpFindDBByOpenHandleReqArgID:
+typedef struct DlpFindDBByOpenHandleReqType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bDbID; // 1; database id returned by dlpOpenDB or dlpCreateDB
+ // TOTAL: 2 bytes
+ } DlpFindDBByOpenHandleReqType;
+
+
+// Request type for dlpFindDBByTypeCreatorReqArgID:
+typedef struct DlpFindDBByTypeCreatorReqType {
+ // OFFSET
+ UInt8 bOptFlags; // 0; bitfield of dlpFindDBOptFlag... flags
+ UInt8 bSrchFlags; // 1; bitfield of dlpFindDBSrchFlag... flags
+ UInt32 dwType; // 2; db type id (zero = wildcard)
+ UInt32 dwCreator; // 6; db creator id (zero = wildcard)
+ // TOTAL: 10 bytes
+ } DlpFindDBByTypeCreatorReqType;
+
+#define dlpFindDBSrchFlagNewSearch 0x80 // set to beging a new search
+#define dlpFindDBSrchFlagOnlyLatest 0x40 // set to search for the latest version
+
+
+
+// Response argument structures for dlpFindDBByNameReqArgID, dlpFindDBByOpenHandleReqArgID and
+// dlpFindDBByTypeCreatorReqArgID (if found):
+//
+enum {
+ dlpFindDBBasicRespArgID = dlpFirstArgID, // resp arg id for basic info
+ // (if dlpFindDBOptFlagGetAttributes is set)
+ dlpFindDBSizeRespArgID // resp arg id for size info
+ // (if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize
+ // are set)
+ };
+
+
+// dlpFindDBBasicRespArgID (returned only if dlpFindDBOptFlagGetAttributes is set):
+
+typedef struct DlpFindDBBasicRespHdrType {
+ // OFFSET
+ UInt8 bCardNo; // 0; card number of database
+ UInt8 bReserved; // 1; RESERVED -- SET TO NULL
+ UInt32 dwLocalID; // 2; local id of the database (for internal use)
+ UInt32 dwOpenRef; // 6; db open ref of the database if it is currently opened
+ // by the caller; zero otherwise (for internal use) can
+ // change after read record list
+ DlpDBInfoHdrType info; //10; database info (creator, type, flags, etc.) MUST BE LAST FIELD
+ // TOTAL: 54 bytes
+ } DlpFindDBBasicRespHdrType;
+
+typedef struct DlpFindDBBasicRespType {
+ // OFFSET
+ DlpFindDBBasicRespHdrType //
+ header; // 0; fixed-size header
+ // FIXED SIZE: 54 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpFindDBBasicRespType;
+
+
+
+// dlpFindDBSizeRespArgID (returned only if dlpFindDBOptFlagGetSize or dlpFindDBOptFlagGetMaxRecSize is set):
+
+typedef struct DlpFindDBSizeRespType {
+ // OFFSET
+
+ // Returned if dlpFindDBOptFlagGetSize is set for all queries:
+ // (otherwise, fields are set to zero)
+ UInt32 dwNumRecords; // 0; record/resource count
+ UInt32 dwTotalBytes; // 4; total bytes used by db
+ UInt32 dwDataBytes; // 8; bytes used for data
+
+ // Returned if dlpFindDBOptFlagGetSize is set for dlpFindDBByOpenHandleReqArgID only:
+ // (otherwise, fields are set to zero)
+ UInt32 dwAppBlkSize; //12; size of app info block size (for
+ // dlpFindDBByOpenHandleReqArgID only)
+ UInt32 dwSortBlkSize; //16; size of sort info block size(for
+ // dlpFindDBByOpenHandleReqArgID only)
+ //
+ // Returned if dlpFindDBOptFlagGetMaxRecSize is set for dlpFindDBByOpenHandleReqArgID only:
+ // (otherwise, field is set to zero)
+ UInt32 dwMaxRecSize; //20; size of largest record or resource in the database (for
+ // dlpFindDBByOpenHandleReqArgID + dlpFindDBOptFlagGetMaxRecSize only)
+ // TOTAL: 24 bytes
+ } DlpFindDBSizeRespType;
+
+
+
+
+//////////////////////////////////////////////////////////////////////////
+// dlpSetDBInfo
+//////////////////////////////////////////////////////////////////////////
+// Request arguments:
+//
+// Response arguments:
+//
+// Possible error codes
+// dlpRespErrSystem,
+// dlpRespErrParam,
+// dlpRespErrNotFound
+// dlpRespErrNotEnoughSpace
+// dlpRespErrNotSupported
+// dlpRespErrReadOnly
+// dlpRespErrNoneOpen
+
+// Request argument structure:
+//
+
+enum {
+ dlpSetDBInfoReqArgID = dlpFirstArgID
+ };
+
+
+typedef struct DlpSetDBInfoReqHdrType {
+ // OFFSET
+ UInt8 dbID; // 0; database id returned by dlpOpenDB or dlpCreateDB
+ UInt8 bReserved; // 1; RESERVED -- SET TO NULL
+ UInt16 wClrDbFlags; // 2; flags to clear; allowed DB flags: dlpDBFlagAppInfoDirty,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention;
+ // 0 = don't change
+ UInt16 wSetDbFlags; // 4; flags to set; allowed DB flags: dlpDBFlagAppInfoDirty,
+ // dlpDBFlagBackup, dlpDBFlagOKToInstallNewer,
+ // dlpDBFlagResetAfterInstall, dlpDBFlagCopyPrevention;
+ // 0 = don't change
+ UInt16 wDbVersion; // 6; database version; dlpSetDBInfoNoVerChange = don't change
+ DlpDateTimeType crDate; // 8; creation date; zero year = don't change
+ DlpDateTimeType modDate; //16; modification date; zero year = don't change
+ DlpDateTimeType bckUpDate; //24; backup date; zero year = don't change
+ UInt32 dwType; //32; database type id; zero = don't change
+ UInt32 dwCreator; //36; database creator id; zero = don't change
+ // TOTAL: 40 bytes
+ } DlpSetDBInfoReqHdrType;
+
+#define dlpSetDBInfoNoVerChange 0xFFFF
+
+typedef struct DlpSetDBInfoReqType {
+ // OFFSET
+ DlpSetDBInfoReqHdrType //
+ header; // 0; fixed size header
+ // FIXED SIZE: 40 bytes
+ UInt8 name[2]; // variable size -- zero-terminated database name string
+ } DlpSetDBInfoReqType;
+
+
+// Response argument structure:
+//
+// none.
+
+
+
+/************************************************************
+ * Macros
+ *************************************************************/
+
+
+#endif // __DLCOMMON_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h b/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h
new file mode 100644
index 0000000..7412ea8
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DLServer.h
@@ -0,0 +1,418 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DLServer.h
+ *
+ * Description:
+ * Desktop Link Protocol(DLP) Server implementation definitions.
+ *
+ * History:
+ * vmk 7/12/95 Created by Vitaly Marty Kruglikov
+ * vmk 7/12/96 Converted to HTAL architecture
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __DL_SERVER_H__
+#define __DL_SERVER_H__
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <DataMgr.h> // for DmOpenRef
+
+#include <PalmOptErrorCheckLevel.h>
+
+
+/************************************************************
+ * DLK result codes
+ * (dlkErrorClass is defined in SystemMgr.h)
+ *************************************************************/
+#pragma mark *Error Codes*
+
+#define dlkErrParam (dlkErrorClass | 1) // invalid parameter
+#define dlkErrMemory (dlkErrorClass | 2) // memory allocation error
+#define dlkErrNoSession (dlkErrorClass | 3) // could not establish a session
+
+#define dlkErrSizeErr (dlkErrorClass | 4) // reply length was too big
+
+#define dlkErrLostConnection (dlkErrorClass | 5) // lost connection
+#define dlkErrInterrupted (dlkErrorClass | 6) // sync was interrupted (see sync state)
+#define dlkErrUserCan (dlkErrorClass | 7) // cancelled by user
+
+
+
+/********************************************************************
+ * Desktop Link system preferences resource for user info
+ * id = sysResIDDlkUserInfo, defined in SystemResources.h
+ ********************************************************************/
+#pragma mark *User Info Preference*
+
+#define dlkMaxUserNameLength 40
+#define dlkUserNameBufSize (dlkMaxUserNameLength + 1)
+
+#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+#define dlkMaxLogSize (20 * 1024)
+#else
+#define dlkMaxLogSize (2 * 1024)
+#endif
+
+typedef enum DlkSyncStateType {
+ dlkSyncStateNeverSynced = 0, // never synced
+ dlkSyncStateInProgress, // sync is in progress
+ dlkSyncStateLostConnection, // connection lost during sync
+ dlkSyncStateLocalCan, // cancelled by local user on handheld
+ dlkSyncStateRemoteCan, // cancelled by user from desktop
+ dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld
+ dlkSyncStateAborted, // sync was aborted for some other reason
+ dlkSyncStateCompleted, // sync completed normally
+
+ // Added in PalmOS v3.0:
+ dlkSyncStateIncompatibleProducts // sync ended because desktop HotSync product
+ // is incompatible with this version
+ // of the handheld HotSync
+ } DlkSyncStateType;
+
+#define dlkUserInfoPrefVersion 0x0102 // current user info pref version: 1.2
+
+typedef struct DlkUserInfoHdrType {
+ UInt16 version; // pref version number
+ UInt32 userID; // user id
+ UInt32 viewerID; // id assigned to viewer by the desktop
+ UInt32 lastSyncPC; // last sync PC id
+ UInt32 succSyncDate; // last successful sync date
+ UInt32 lastSyncDate; // last sync date
+ DlkSyncStateType lastSyncState; // last sync status
+ UInt8 reserved1; // Explicitly account for 16-bit alignment padding
+ UInt16 lanSyncEnabled;// if non-zero, LAN Sync is enabled
+ UInt32 hsTcpPortNum; // TCP/IP port number of Desktop HotSync
+ UInt32 dwReserved1; // RESERVED -- set to NULL!
+ UInt32 dwReserved2; // RESERVED -- set to NULL!
+ UInt8 userNameLen; // length of name field(including null)
+ UInt8 reserved2; // Explicitly account for 16-bit alignment padding
+ UInt16 syncLogLen; // length of sync log(including null)
+ } DlkUserInfoHdrType;
+
+typedef struct DlkUserInfoType {
+ DlkUserInfoHdrType header; // fixed size header
+ Char nameAndLog[2]; // user name, followed by sync log;
+ // both null-terminated(for debugging)
+ } DlkUserInfoType;
+
+typedef DlkUserInfoType* DlkUserInfoPtr; // user info pointer
+
+
+/********************************************************************
+ * Desktop Link system preferences resource for the Conduit Filter Table
+ * id = sysResIDDlkCondFilterTab, defined in SystemResources.h
+ ********************************************************************/
+#pragma mark *Conduit Filter Preference*
+
+//
+// Table for specifying conduits to "filter out" during HotSync
+//
+
+// This table consists of DlkCondFilterTableHdrType header followed by a
+// variable number of DlkCondFilterEntryType entries
+
+typedef struct DlkCondFilterTableHdrType {
+ UInt16 entryCount;
+ } DlkCondFilterTableHdrType;
+typedef DlkCondFilterTableHdrType* DlkCondFilterTableHdrPtr;
+
+typedef struct DlkCondFilterEntryType {
+ UInt32 creator;
+ UInt32 type;
+ } DlkCondFilterEntryType;
+typedef DlkCondFilterEntryType* DlkCondFilterEntryPtr;
+
+typedef struct DlkCondFilterTableType {
+ DlkCondFilterTableHdrType
+ hdr; // table header
+ DlkCondFilterEntryType
+ entry[1]; // variable number of entries
+ } DlkCondFilterTableType;
+typedef DlkCondFilterTableType* DlkCondFilterTablePtr;
+
+
+
+/********************************************************************
+ * DLK Session Structures
+ ********************************************************************/
+#pragma mark *Session Structures*
+
+
+// DesktopLink event notification callback. If non-zero is returned,
+// sync will be cancelled as soon as a safe point is reached.
+typedef enum {
+ dlkEventOpeningConduit = 1, // conduit is being opened -- paramP
+ // is null;
+
+ dlkEventDatabaseOpened, // client has opened a database -- paramP
+ // points to DlkEventDatabaseOpenedType;
+
+ dlkEventCleaningUp, // last stage of sync -- cleaning up (notifying apps, etc) --
+ // paramP is null
+
+ dlkEventSystemResetRequested // system reset was requested by the desktop client
+ // (the normal action is to delay the reset until
+ // end of sync) -- paramP is null
+ } DlkEventType;
+
+// Prototype for the event notification callback
+typedef Int16 (*DlkEventProcPtr)(UInt32 eventRef, DlkEventType dlkEvent,
+ void * paramP);
+
+// Parameter structure for dlkEventDatabaseOpened
+// Added new fields for Pilot v2.0 vmk 12/24/96
+typedef struct DlkEventDatabaseOpenedType {
+ DmOpenRef dbR; // open database ref (v2.0)
+ Char * dbNameP; // database name
+ UInt32 dbType; // databse type (v2.0)
+ UInt32 dbCreator; // database creator
+ } DlkEventDatabaseOpenedType;
+
+
+// Prototype for the "user cancel" check callback function
+typedef Int16 (*DlkUserCanProcPtr)(UInt32 canRef);
+
+
+//
+// List of modified database creators maintained by DLP Server
+//
+typedef struct DlkDBCreatorList {
+ UInt16 count; // number of entries in the list
+ MemHandle listH; // chunk MemHandle of the creators list
+ } DlkDBCreatorList;
+
+
+//
+// Desktop Link Server state flags
+//
+#define dlkStateFlagVerExchanged 0x8000
+#define dlkStateFlagSyncDateSet 0x4000
+
+//
+// DLP Server session information
+//
+typedef struct DlkServerSessionType {
+ UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection
+ UInt32 maxHtalXferSize; // Maximum transfer block size
+
+ // Information supplied by user
+ DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
+ UInt32 eventRef; // user reference value for event proc
+ DlkUserCanProcPtr canProcP; // ptr to user-cancel function
+ UInt32 canRef; // parameter for canProcP()
+ MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+
+ // Current database information
+ UInt8 dlkDBID; // Desktop Link database MemHandle of the open database
+ UInt8 reserved1;
+ DmOpenRef dbR; // TouchDown database access pointer -- if null, no current db
+ UInt16 cardNo; // memory module number
+ UInt32 dbCreator; // creator id
+ Char dbName[dmDBNameLength]; // DB name
+ UInt16 dbOpenMode; // database open mode
+ Boolean created; // true if the current db was created
+ Boolean isResDB; // set to true if resource database
+ Boolean ramBased; // true if the db is in RAM storage
+ Boolean readOnly; // true if the db is read-only
+ LocalID dbLocalID; // TouchDown LocalID of the database
+ UInt32 initialModNum; // initial DB modification number
+ UInt32 curRecIndex; // current record index for enumeration functions
+ // (0=beginning)
+
+ // List of modified database creators maintained by DLP Server
+ DlkDBCreatorList creatorList;
+
+ // Session status information
+// DlkSyncStateType syncState; // current sync state;
+ UInt8 syncState; // current sync state;
+
+ Boolean complete; // set to true when completion request
+ // has been received
+
+ Boolean conduitOpened; // set to true after the first coduit
+ // is opened by remote
+
+ Boolean logCleared; // set to true after sync log has been
+ // cleared during the current session;
+ // The log will be cleared before any new entries are added or at
+ // the end of sync in case no new entries were added.
+ // (we do not clear the log at the beginning of sync in case the
+ // user cancels during the "identifying user" phase; in this
+ // event, the spec calls for preserving the original log)
+
+ Boolean resetPending; // set to true if system reset is pending;
+ // the reset will be carried out at end
+ // of sync
+
+ // Current request information
+ Boolean gotCommand; // set to true when got a request
+ UInt8 cmdTID; // current transaction ID
+ UInt8 reserved2;
+ UInt16 cmdLen; // size of data in request buffer
+ void * cmdP; // pointer to command
+ MemHandle cmdH; // MemHandle of command buffer
+
+ // Fields added in PalmOS v3.0
+ UInt16 wStateFlags; // bitfield of dlkStateFlag... bits
+ DmSearchStateType dbSearchState; // database search state for iterative
+ // searches using DmGetNextDatabaseByTypeCreator
+ } DlkServerSessionType;
+
+typedef DlkServerSessionType* DlkServerSessionPtr;
+
+
+/********************************************************************
+ * DLK Function Parameter Structures
+ ********************************************************************/
+#pragma mark *Function Parameter Structures*
+
+//
+// Parameter passed to DlkControl()
+//
+typedef enum DlkCtlEnum {
+ dlkCtlFirst = 0, // reserve 0
+
+ //
+ // Pilot v2.0 control codes:
+ //
+ dlkCtlGetPCHostName, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostName, // param1P = ptr to host name(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+ dlkCtlGetCondFilterTable, // param1P = ptr to destination buffer for filter table, or NULL if *param2 is 0
+ // param2P = on entry, ptr to size of buffer(UInt16) (the size may be 0)
+ // on return, size, in bytes, of the actual filter table
+
+ dlkCtlSetCondFilterTable, // param1P = ptr to to conduit filter table, or NULL if *param2 is 0
+ // param2P = ptr to size of filter table(UInt16) (if size is 0, the current table will be deleted)
+
+ dlkCtlGetLANSync, // param1P = ptr to store for the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlSetLANSync, // param1P = ptr to the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlGetHSTCPPort, // param1P = ptr to store for the Desktop HotSync TCP/IP port number(UInt32) -- zero if not set
+ // param2P = not used, set to NULL
+
+ dlkCtlSetHSTCPPort, // param1P = ptr to the Desktop HotSync TCP/IP port number(UInt32)
+ // param2P = not used, set to NULL
+
+ dlkCtlSendCallAppReply, // param1P = ptr to DlkCallAppReplyParamType structure
+ // param2P = not used, set to NULL
+ //
+ // RETURNS: send error code; use this error code
+ // as return value from the action code handler
+
+
+ dlkCtlGetPCHostAddr, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostAddr, // param1P = ptr to host address string(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+
+ dlkCtlGetPCHostMask, // param1P = ptr to text buffer; (can be null if *(UInt16 *)param2P is 0)
+ // param2P = ptr to buffer size(UInt16);
+ // returns actual length, including null, in *(UInt16 *)param2P which may be bigger than # of bytes copied.
+
+ dlkCtlSetPCHostMask, // param1P = ptr to subnet mask string(zero-terminated) or NULL if *param2 is 0
+ // param2P = ptr to length(UInt16), including NULL (if length is 0, the current name is deleted)
+
+
+ dlkCtlLAST // *KEEP THIS ENTRY LAST*
+
+} DlkCtlEnum;
+
+
+//
+// Parameter passed to DlkStartServer()
+//
+typedef struct DlkServerParamType {
+ UInt16 htalLibRefNum; // HTAL library reference number - the library has a live connection
+ DlkEventProcPtr eventProcP; // ptr to DesktopLink event notification proc
+ UInt32 eventRef; // user reference value for event proc
+ UInt32 reserved1; // reserved - set to NULL
+ UInt32 reserved2; // reserved - set to NULL
+ MemHandle condFilterH; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+ } DlkServerParamType;
+
+typedef DlkServerParamType* DlkServerParamPtr;
+
+
+
+//
+// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code
+//
+typedef struct DlkCallAppReplyParamType {
+ UInt16 pbSize; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType))
+ UInt32 dwResultCode; // result code to be returned to remote caller
+ void * resultP; // ptr to result data
+ UInt32 dwResultSize; // size of reply data in number of bytes
+ void * dlRefP; // DesktopLink reference pointer from
+ // SysAppLaunchCmdHandleSyncCallAppType
+ UInt32 dwReserved1; // RESERVED -- set to null!!!
+ } DlkCallAppReplyParamType;
+
+
+/********************************************************************
+ * DesktopLink Server Routines
+ ********************************************************************/
+#pragma mark *Function Prototypes*
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// SERVER API
+//
+
+// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam,
+// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory,
+// * dlkErrUserCan
+extern Err DlkStartServer(DlkServerParamPtr paramP)
+ SYS_TRAP(sysTrapDlkStartServer);
+
+extern Err DlkGetSyncInfo(UInt32 * succSyncDateP, UInt32 * lastSyncDateP,
+ DlkSyncStateType* syncStateP, Char * nameBufP,
+ Char * logBufP, Int32 * logLenP)
+ SYS_TRAP(sysTrapDlkGetSyncInfo);
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER... this is a temporary function for debugging modem manager.
+// remove it when done.
+#endif // PUBLIC_STUFF_STRIPPED
+extern void DlkSetLogEntry(const Char * textP, Int16 textLen, Boolean append)
+ SYS_TRAP(sysTrapDlkSetLogEntry);
+
+// Dispatch a DesktopLink request (exposed for patching)
+extern Err DlkDispatchRequest(DlkServerSessionPtr sessP)
+ SYS_TRAP(sysTrapDlkDispatchRequest);
+
+extern Err DlkControl(DlkCtlEnum op, void * param1P, void * param2P)
+ SYS_TRAP(sysTrapDlkControl);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/********************************************************************
+ * DLK Macros
+ ********************************************************************/
+
+
+
+#endif // __DL_SERVER_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h
new file mode 100644
index 0000000..0381b29
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DataMgr.h
@@ -0,0 +1,540 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DataMgr.h
+ *
+ * Description:
+ * Header for the Data Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __DATAMGR_H__
+#define __DATAMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+#include <ErrorBase.h> // Error numbers
+
+// Other headers we depend on
+#include <MemoryMgr.h>
+
+
+typedef UInt32 DmResType;
+typedef UInt16 DmResID;
+
+/************************************************************
+ * Category equates
+ *************************************************************/
+#define dmRecAttrCategoryMask 0x0F // mask for category #
+#define dmRecNumCategories 16 // number of categories
+#define dmCategoryLength 16 // 15 chars + 1 null terminator
+
+#define dmAllCategories 0xff
+#define dmUnfiledCategory 0
+
+#define dmMaxRecordIndex 0xffff
+
+
+
+// Record Attributes
+//
+// *** IMPORTANT:
+// ***
+// *** Any changes to record attributes must be reflected in dmAllRecAttrs and dmSysOnlyRecAttrs ***
+// ***
+// *** Only one nibble is available for record attributes
+//
+// *** ANY CHANGES MADE TO THESE ATTRIBUTES MUST BE REFLECTED IN DESKTOP LINK
+// *** SERVER CODE (DLCommon.h, DLServer.c)
+#define dmRecAttrDelete 0x80 // delete this record next sync
+#define dmRecAttrDirty 0x40 // archive this record next sync
+#define dmRecAttrBusy 0x20 // record currently in use
+#define dmRecAttrSecret 0x10 // "secret" record - password protected
+
+
+// All record atributes (for error-checking)
+#define dmAllRecAttrs ( dmRecAttrDelete | \
+ dmRecAttrDirty | \
+ dmRecAttrBusy | \
+ dmRecAttrSecret )
+
+// Record attributes which only the system is allowed to change (for error-checking)
+#define dmSysOnlyRecAttrs ( dmRecAttrBusy )
+
+
+/************************************************************
+ * Database Header equates
+ *************************************************************/
+#define dmDBNameLength 32 // 31 chars + 1 null terminator
+
+// Attributes of a Database
+//
+// *** IMPORTANT:
+// ***
+// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs ***
+// ***
+#define dmHdrAttrResDB 0x0001 // Resource database
+#define dmHdrAttrReadOnly 0x0002 // Read Only database
+#define dmHdrAttrAppInfoDirty 0x0004 // Set if Application Info block is dirty
+ // Optionally supported by an App's conduit
+#define dmHdrAttrBackup 0x0008 // Set if database should be backed up to PC if
+ // no app-specific synchronization conduit has
+ // been supplied.
+#define dmHdrAttrOKToInstallNewer 0x0010 // This tells the backup conduit that it's OK
+ // for it to install a newer version of this database
+ // with a different name if the current database is
+ // open. This mechanism is used to update the
+ // Graffiti Shortcuts database, for example.
+#define dmHdrAttrResetAfterInstall 0x0020 // Device requires a reset after this database is
+ // installed.
+#define dmHdrAttrCopyPrevention 0x0040 // This database should not be copied to
+
+#define dmHdrAttrStream 0x0080 // This database is used for file stream implementation.
+#define dmHdrAttrHidden 0x0100 // This database should generally be hidden from view
+ // used to hide some apps from the main view of the
+ // launcher for example.
+ // For data (non-resource) databases, this hides the record
+ // count within the launcher info screen.
+#define dmHdrAttrLaunchableData 0x0200 // This data database (not applicable for executables)
+ // can be "launched" by passing it's name to it's owner
+ // app ('appl' database with same creator) using
+ // the sysAppLaunchCmdOpenNamedDB action code.
+
+#define dmHdrAttrOpen 0x8000 // Database not closed properly
+
+
+// All database atributes (for error-checking)
+#define dmAllHdrAttrs ( dmHdrAttrResDB | \
+ dmHdrAttrReadOnly | \
+ dmHdrAttrAppInfoDirty | \
+ dmHdrAttrBackup | \
+ dmHdrAttrOKToInstallNewer | \
+ dmHdrAttrResetAfterInstall | \
+ dmHdrAttrCopyPrevention | \
+ dmHdrAttrStream | \
+ dmHdrAttrOpen )
+
+// Database attributes which only the system is allowed to change (for error-checking)
+#define dmSysOnlyHdrAttrs ( dmHdrAttrResDB | \
+ dmHdrAttrOpen )
+
+
+/************************************************************
+ * Unique ID equates
+ *************************************************************/
+#define dmRecordIDReservedRange 1 // The range of upper bits in the database's
+ // uniqueIDSeed from 0 to this number are
+ // reserved and not randomly picked when a
+ // database is created.
+#define dmDefaultRecordsID 0 // Records in a default database are copied
+ // with their uniqueIDSeeds set in this range.
+#define dmUnusedRecordID 0 // Record ID not allowed on the device
+
+
+/************************************************************
+ * Mode flags passed to DmOpenDatabase
+ *************************************************************/
+#define dmModeReadOnly 0x0001 // read access
+#define dmModeWrite 0x0002 // write access
+#define dmModeReadWrite 0x0003 // read & write access
+#define dmModeLeaveOpen 0x0004 // leave open when app quits
+#define dmModeExclusive 0x0008 // don't let anyone else open it
+#define dmModeShowSecret 0x0010 // force show of secret records
+
+// Generic type used to represent an open Database
+typedef void * DmOpenRef;
+
+
+/************************************************************
+ * Structure passed to DmGetNextDatabaseByTypeCreator and used
+ * to cache search information between multiple searches.
+ *************************************************************/
+typedef struct {
+ UInt32 info[8];
+ } DmSearchStateType;
+typedef DmSearchStateType* DmSearchStatePtr;
+
+
+
+/************************************************************
+ * Structures used by the sorting routines
+ *************************************************************/
+typedef struct {
+ UInt8 attributes; // record attributes;
+ UInt8 uniqueID[3]; // unique ID of record
+ } SortRecordInfoType;
+
+typedef SortRecordInfoType *SortRecordInfoPtr;
+
+typedef Int16 DmComparF (void *, void *, Int16 other, SortRecordInfoPtr,
+ SortRecordInfoPtr, MemHandle appInfoH);
+
+
+
+/************************************************************
+ * Database manager error codes
+ * the constant dmErrorClass is defined in ErrorBase.h
+ *************************************************************/
+#define dmErrMemError (dmErrorClass | 1)
+#define dmErrIndexOutOfRange (dmErrorClass | 2)
+#define dmErrInvalidParam (dmErrorClass | 3)
+#define dmErrReadOnly (dmErrorClass | 4)
+#define dmErrDatabaseOpen (dmErrorClass | 5)
+#define dmErrCantOpen (dmErrorClass | 6)
+#define dmErrCantFind (dmErrorClass | 7)
+#define dmErrRecordInWrongCard (dmErrorClass | 8)
+#define dmErrCorruptDatabase (dmErrorClass | 9)
+#define dmErrRecordDeleted (dmErrorClass | 10)
+#define dmErrRecordArchived (dmErrorClass | 11)
+#define dmErrNotRecordDB (dmErrorClass | 12)
+#define dmErrNotResourceDB (dmErrorClass | 13)
+#define dmErrROMBased (dmErrorClass | 14)
+#define dmErrRecordBusy (dmErrorClass | 15)
+#define dmErrResourceNotFound (dmErrorClass | 16)
+#define dmErrNoOpenDatabase (dmErrorClass | 17)
+#define dmErrInvalidCategory (dmErrorClass | 18)
+#define dmErrNotValidRecord (dmErrorClass | 19)
+#define dmErrWriteOutOfBounds (dmErrorClass | 20)
+#define dmErrSeekFailed (dmErrorClass | 21)
+#define dmErrAlreadyOpenForWrites (dmErrorClass | 22)
+#define dmErrOpenedByAnotherTask (dmErrorClass | 23)
+#define dmErrUniqueIDNotFound (dmErrorClass | 24)
+#define dmErrAlreadyExists (dmErrorClass | 25)
+#define dmErrInvalidDatabaseName (dmErrorClass | 26)
+#define dmErrDatabaseProtected (dmErrorClass | 27)
+#define dmErrDatabaseNotProtected (dmErrorClass | 28)
+
+/************************************************************
+ * Values for the direction parameter of DmSeekRecordInCategory
+ *************************************************************/
+#define dmSeekForward 1
+#define dmSeekBackward -1
+
+
+/************************************************************
+ * Data Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Initialization
+Err DmInit(void)
+ SYS_TRAP(sysTrapDmInit);
+
+
+// Directory Lists
+Err DmCreateDatabase(UInt16 cardNo, const Char *nameP,
+ UInt32 creator, UInt32 type, Boolean resDB)
+ SYS_TRAP(sysTrapDmCreateDatabase);
+
+Err DmCreateDatabaseFromImage(MemPtr bufferP)
+ SYS_TRAP(sysTrapDmCreateDatabaseFromImage);
+
+
+Err DmDeleteDatabase(UInt16 cardNo, LocalID dbID)
+ SYS_TRAP(sysTrapDmDeleteDatabase);
+
+UInt16 DmNumDatabases(UInt16 cardNo)
+ SYS_TRAP(sysTrapDmNumDatabases);
+
+LocalID DmGetDatabase(UInt16 cardNo, UInt16 index)
+ SYS_TRAP(sysTrapDmGetDatabase);
+
+LocalID DmFindDatabase(UInt16 cardNo, const Char *nameP)
+ SYS_TRAP(sysTrapDmFindDatabase);
+
+Err DmGetNextDatabaseByTypeCreator(Boolean newSearch, DmSearchStatePtr stateInfoP,
+ UInt32 type, UInt32 creator, Boolean onlyLatestVers,
+ UInt16 *cardNoP, LocalID *dbIDP)
+ SYS_TRAP(sysTrapDmGetNextDatabaseByTypeCreator);
+
+
+// Database info
+Err DmDatabaseInfo(UInt16 cardNo, LocalID dbID, Char *nameP,
+ UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP,
+ UInt32 * modDateP, UInt32 *bckUpDateP,
+ UInt32 * modNumP, LocalID *appInfoIDP,
+ LocalID *sortInfoIDP, UInt32 *typeP,
+ UInt32 *creatorP)
+ SYS_TRAP(sysTrapDmDatabaseInfo);
+
+Err DmSetDatabaseInfo(UInt16 cardNo, LocalID dbID, const Char *nameP,
+ UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP,
+ UInt32 * modDateP, UInt32 *bckUpDateP,
+ UInt32 * modNumP, LocalID *appInfoIDP,
+ LocalID *sortInfoIDP, UInt32 *typeP,
+ UInt32 *creatorP)
+ SYS_TRAP(sysTrapDmSetDatabaseInfo);
+
+Err DmDatabaseSize(UInt16 cardNo, LocalID dbID, UInt32 *numRecordsP,
+ UInt32 * totalBytesP, UInt32 *dataBytesP)
+ SYS_TRAP(sysTrapDmDatabaseSize);
+
+
+// This routine can be used to prevent a database from being deleted (by passing
+// true for 'protect'). It will increment the protect count if 'protect' is true
+// and decrement it if 'protect' is false. This is used by code that wants to
+// keep a particular record or resource in a database locked down but doesn't
+// want to keep the database open. This information is keep in the dynamic heap so
+// all databases are "unprotected" at system reset.
+Err DmDatabaseProtect(UInt16 cardNo, LocalID dbID, Boolean protect)
+ SYS_TRAP(sysTrapDmDatabaseProtect);
+
+
+// Open/close Databases
+DmOpenRef DmOpenDatabase(UInt16 cardNo, LocalID dbID, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDatabase);
+
+DmOpenRef DmOpenDatabaseByTypeCreator(UInt32 type, UInt32 creator, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDatabaseByTypeCreator);
+
+DmOpenRef DmOpenDBNoOverlay(UInt16 cardNo, LocalID dbID, UInt16 mode)
+ SYS_TRAP(sysTrapDmOpenDBNoOverlay);
+
+Err DmCloseDatabase(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmCloseDatabase);
+
+
+// Info on open databases
+DmOpenRef DmNextOpenDatabase(DmOpenRef currentP)
+ SYS_TRAP(sysTrapDmNextOpenDatabase);
+
+Err DmOpenDatabaseInfo(DmOpenRef dbP, LocalID *dbIDP,
+ UInt16 *openCountP, UInt16 *modeP, UInt16 *cardNoP,
+ Boolean *resDBP)
+ SYS_TRAP(sysTrapDmOpenDatabaseInfo);
+
+LocalID DmGetAppInfoID (DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmGetAppInfoID);
+
+void DmGetDatabaseLockState(DmOpenRef dbR, UInt8 *highest, UInt32 *count, UInt32 *busy)
+ SYS_TRAP(sysTrapDmGetDatabaseLockState);
+
+// Utility to unlock all records and clear busy bits
+Err DmResetRecordStates(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmResetRecordStates);
+
+
+// Error Query
+Err DmGetLastErr(void)
+ SYS_TRAP(sysTrapDmGetLastErr);
+
+
+//------------------------------------------------------------
+// Record based access routines
+//------------------------------------------------------------
+
+// Record Info
+UInt16 DmNumRecords(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNumRecords);
+
+UInt16 DmNumRecordsInCategory(DmOpenRef dbP, UInt16 category)
+ SYS_TRAP(sysTrapDmNumRecordsInCategory);
+
+Err DmRecordInfo(DmOpenRef dbP, UInt16 index,
+ UInt16 *attrP, UInt32 *uniqueIDP, LocalID *chunkIDP)
+ SYS_TRAP(sysTrapDmRecordInfo);
+
+Err DmSetRecordInfo(DmOpenRef dbP, UInt16 index,
+ UInt16 *attrP, UInt32 *uniqueIDP)
+ SYS_TRAP(sysTrapDmSetRecordInfo);
+
+
+
+// Record attaching and detaching
+Err DmAttachRecord(DmOpenRef dbP, UInt16 *atP,
+ MemHandle newH, MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmAttachRecord);
+
+Err DmDetachRecord(DmOpenRef dbP, UInt16 index,
+ MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmDetachRecord);
+
+Err DmMoveRecord(DmOpenRef dbP, UInt16 from, UInt16 to)
+ SYS_TRAP(sysTrapDmMoveRecord);
+
+
+
+// Record creation and deletion
+MemHandle DmNewRecord(DmOpenRef dbP, UInt16 *atP, UInt32 size)
+ SYS_TRAP(sysTrapDmNewRecord);
+
+Err DmRemoveRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmRemoveRecord);
+
+Err DmDeleteRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmDeleteRecord);
+
+Err DmArchiveRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmArchiveRecord);
+
+MemHandle DmNewHandle(DmOpenRef dbP, UInt32 size)
+ SYS_TRAP(sysTrapDmNewHandle);
+
+Err DmRemoveSecretRecords(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmRemoveSecretRecords);
+
+
+// Record viewing manipulation
+Err DmFindRecordByID(DmOpenRef dbP, UInt32 uniqueID, UInt16 *indexP)
+ SYS_TRAP(sysTrapDmFindRecordByID);
+
+MemHandle DmQueryRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmQueryRecord);
+
+MemHandle DmGetRecord(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmGetRecord);
+
+MemHandle DmQueryNextInCategory(DmOpenRef dbP, UInt16 *indexP, UInt16 category)
+ SYS_TRAP(sysTrapDmQueryNextInCategory);
+
+UInt16 DmPositionInCategory (DmOpenRef dbP, UInt16 index, UInt16 category)
+ SYS_TRAP(sysTrapDmPositionInCategory);
+
+Err DmSeekRecordInCategory (DmOpenRef dbP, UInt16 *indexP, UInt16 offset,
+ Int16 direction, UInt16 category)
+ SYS_TRAP(sysTrapDmSeekRecordInCategory);
+
+
+MemHandle DmResizeRecord(DmOpenRef dbP, UInt16 index, UInt32 newSize)
+ SYS_TRAP(sysTrapDmResizeRecord);
+
+Err DmReleaseRecord(DmOpenRef dbP, UInt16 index, Boolean dirty)
+ SYS_TRAP(sysTrapDmReleaseRecord);
+
+UInt16 DmSearchRecord(MemHandle recH, DmOpenRef *dbPP)
+ SYS_TRAP(sysTrapDmSearchRecord);
+
+
+// Category manipulation
+Err DmMoveCategory (DmOpenRef dbP, UInt16 toCategory, UInt16 fromCategory, Boolean dirty)
+ SYS_TRAP(sysTrapDmMoveCategory);
+
+Err DmDeleteCategory (DmOpenRef dbR, UInt16 categoryNum)
+ SYS_TRAP(sysTrapDmDeleteCategory);
+
+
+// Validation for writing
+Err DmWriteCheck(void *recordP, UInt32 offset, UInt32 bytes)
+ SYS_TRAP(sysTrapDmWriteCheck);
+
+// Writing
+Err DmWrite(void *recordP, UInt32 offset, const void *srcP, UInt32 bytes)
+ SYS_TRAP(sysTrapDmWrite);
+
+Err DmStrCopy(void *recordP, UInt32 offset, const Char *srcP)
+ SYS_TRAP(sysTrapDmStrCopy);
+
+Err DmSet(void *recordP, UInt32 offset, UInt32 bytes, UInt8 value)
+ SYS_TRAP(sysTrapDmSet);
+
+
+
+
+//------------------------------------------------------------
+// Resource based access routines
+//------------------------------------------------------------
+
+// High level access routines
+MemHandle DmGetResource(DmResType type, DmResID resID)
+ SYS_TRAP(sysTrapDmGetResource);
+
+MemHandle DmGet1Resource(DmResType type, DmResID resID)
+ SYS_TRAP(sysTrapDmGet1Resource);
+
+Err DmReleaseResource(MemHandle resourceH)
+ SYS_TRAP(sysTrapDmReleaseResource);
+
+MemHandle DmResizeResource(MemHandle resourceH, UInt32 newSize)
+ SYS_TRAP(sysTrapDmResizeResource);
+
+
+// Searching resource databases
+DmOpenRef DmNextOpenResDatabase(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNextOpenResDatabase);
+
+UInt16 DmFindResourceType(DmOpenRef dbP, DmResType resType, UInt16 typeIndex)
+ SYS_TRAP(sysTrapDmFindResourceType);
+
+UInt16 DmFindResource(DmOpenRef dbP, DmResType resType, DmResID resID,
+ MemHandle resH)
+ SYS_TRAP(sysTrapDmFindResource);
+
+UInt16 DmSearchResource(DmResType resType, DmResID resID,
+ MemHandle resH, DmOpenRef *dbPP)
+ SYS_TRAP(sysTrapDmSearchResource);
+
+
+// Resource Info
+UInt16 DmNumResources(DmOpenRef dbP)
+ SYS_TRAP(sysTrapDmNumResources);
+
+Err DmResourceInfo(DmOpenRef dbP, UInt16 index,
+ DmResType *resTypeP, DmResID *resIDP,
+ LocalID *chunkLocalIDP)
+ SYS_TRAP(sysTrapDmResourceInfo);
+
+Err DmSetResourceInfo(DmOpenRef dbP, UInt16 index,
+ DmResType *resTypeP, DmResID *resIDP)
+ SYS_TRAP(sysTrapDmSetResourceInfo);
+
+
+
+// Resource attaching and detaching
+Err DmAttachResource(DmOpenRef dbP, MemHandle newH,
+ DmResType resType, DmResID resID)
+ SYS_TRAP(sysTrapDmAttachResource);
+
+Err DmDetachResource(DmOpenRef dbP, UInt16 index,
+ MemHandle *oldHP)
+ SYS_TRAP(sysTrapDmDetachResource);
+
+
+
+// Resource creation and deletion
+MemHandle DmNewResource(DmOpenRef dbP, DmResType resType, DmResID resID,
+ UInt32 size)
+ SYS_TRAP(sysTrapDmNewResource);
+
+Err DmRemoveResource(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmRemoveResource);
+
+
+
+// Resource manipulation
+MemHandle DmGetResourceIndex(DmOpenRef dbP, UInt16 index)
+ SYS_TRAP(sysTrapDmGetResourceIndex);
+
+
+
+// Record sorting
+Err DmQuickSort(DmOpenRef dbP, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmQuickSort);
+
+Err DmInsertionSort (DmOpenRef dbR, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmInsertionSort);
+
+UInt16 DmFindSortPosition(DmOpenRef dbP, void *newRecord,
+ SortRecordInfoPtr newRecordInfo, DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmFindSortPosition);
+
+UInt16 DmFindSortPositionV10(DmOpenRef dbP, void *newRecord,
+ DmComparF *compar, Int16 other)
+ SYS_TRAP(sysTrapDmFindSortPositionV10);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __DATAMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h b/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h
new file mode 100644
index 0000000..adc44d6
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/DateTime.h
@@ -0,0 +1,283 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DateTime.h
+ *
+ * Description:
+ * Date and Time calculations
+ *
+ * History:
+ * 1/19/95 rsf - Created by Roger Flores
+ * 7/15/99 rsf - moved some types in from Preferences.h
+ * 12/23/99 jmp - eliminated bogus maxTime definition
+ *
+ *****************************************************************************/
+
+#ifndef __DATETIME_H__
+#define __DATETIME_H__
+
+#include <CoreTraps.h>
+
+typedef enum
+ {
+ tfColon,
+ tfColonAMPM, // 1:00 pm
+ tfColon24h, // 13:00
+ tfDot,
+ tfDotAMPM, // 1.00 pm
+ tfDot24h, // 13.00
+ tfHoursAMPM, // 1 pm
+ tfHours24h, // 13
+ tfComma24h // 13,00
+ } TimeFormatType;
+
+
+typedef enum {
+ dsNone, // Daylight Savings Time not observed
+ dsUSA, // United States Daylight Savings Time
+ dsAustralia, // Australian Daylight Savings Time
+ dsWesternEuropean, // Western European Daylight Savings Time
+ dsMiddleEuropean, // Middle European Daylight Savings Time
+ dsEasternEuropean, // Eastern European Daylight Savings Time
+ dsGreatBritain, // Great Britain and Eire Daylight Savings Time
+ dsRumania, // Rumanian Daylight Savings Time
+ dsTurkey, // Turkish Daylight Savings Time
+ dsAustraliaShifted // Australian Daylight Savings Time with shift in 1986
+ } DaylightSavingsTypes;
+
+
+// pass a TimeFormatType
+#define Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h)
+#define TimeSeparator(t) ((Char) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ',')))
+
+
+typedef enum {
+ dfMDYWithSlashes, // 12/31/95
+ dfDMYWithSlashes, // 31/12/95
+ dfDMYWithDots, // 31.12.95
+ dfDMYWithDashes, // 31-12-95
+ dfYMDWithSlashes, // 95/12/31
+ dfYMDWithDots, // 95.12.31
+ dfYMDWithDashes, // 95-12-31
+
+ dfMDYLongWithComma, // Dec 31, 1995
+ dfDMYLong, // 31 Dec 1995
+ dfDMYLongWithDot, // 31. Dec 1995
+ dfDMYLongNoDay, // Dec 1995
+ dfDMYLongWithComma, // 31 Dec, 1995
+ dfYMDLongWithDot, // 1995.12.31
+ dfYMDLongWithSpace, // 1995 Dec 31
+
+ dfMYMed, // Dec '95
+ dfMYMedNoPost // Dec 95 (added for French 2.0 ROM)
+ } DateFormatType;
+
+typedef struct {
+ Int16 second;
+ Int16 minute;
+ Int16 hour;
+ Int16 day;
+ Int16 month;
+ Int16 year;
+ Int16 weekDay; // Days since Sunday (0 to 6)
+ } DateTimeType;
+
+typedef DateTimeType *DateTimePtr;
+
+
+// This is the time format. Times are treated as words so don't
+// change the order of the members in this structure.
+//
+typedef struct {
+ UInt8 hours;
+ UInt8 minutes;
+} TimeType;
+
+typedef TimeType *TimePtr;
+
+#define noTime -1 // The entire TimeType is -1 if there isn't a time.
+
+
+// This is the date format. Dates are treated as words so don't
+// change the order of the members in this structure.
+//
+typedef struct {
+ UInt16 year :7; // years since 1904 (MAC format)
+ UInt16 month :4;
+ UInt16 day :5;
+} DateType;
+
+typedef DateType *DatePtr;
+
+
+/************************************************************
+ * Date Time Constants
+ *************************************************************/
+
+// Maximum lengths of strings return by the date and time formating
+// routine DateToAscii and TimeToAscii.
+#define timeStringLength 9
+#define dateStringLength 9
+#define longDateStrLength 15
+#define dowDateStringLength 19
+#define dowLongDateStrLength 25
+
+
+#define firstYear 1904
+#define numberOfYears 128
+#define lastYear (firstYear + numberOfYears - 1)
+
+
+
+// Constants for time calculations
+// Could change these from xIny to yPerX
+#define secondsInSeconds 1
+#define minutesInSeconds 60
+#define hoursInMinutes 60
+#define hoursInSeconds (hoursInMinutes * minutesInSeconds)
+#define hoursPerDay 24
+//#define daysInSeconds ((Int32)(hoursPerDay) * ((Int32)hoursInSeconds))
+#define daysInSeconds (0x15180) // cc bug
+
+#define daysInWeek 7
+#define daysInYear 365
+#define daysInLeapYear 366
+#define daysInFourYears (daysInLeapYear + 3 * daysInYear)
+
+#define monthsInYear 12
+
+#define maxDays ((UInt32) numberOfYears / 4 * daysInFourYears - 1)
+#define maxSeconds ((UInt32) maxDays * daysInSeconds)
+
+// Values returned by DayOfWeek routine.
+#define sunday 0
+#define monday 1
+#define tuesday 2
+#define wednesday 3
+#define thursday 4
+#define friday 5
+#define saturday 6
+
+// Months of the year
+#define january 1
+#define february 2
+#define march 3
+#define april 4
+#define may 5
+#define june 6
+#define july 7
+#define august 8
+#define september 9
+#define october 10
+#define november 11
+#define december 12
+
+
+// Values returned by DoyOfMonth routine.
+typedef enum {
+ dom1stSun, dom1stMon, dom1stTue, dom1stWen, dom1stThu, dom1stFri, dom1stSat,
+ dom2ndSun, dom2ndMon, dom2ndTue, dom2ndWen, dom2ndThu, dom2ndFri, dom2ndSat,
+ dom3rdSun, dom3rdMon, dom3rdTue, dom3rdWen, dom3rdThu, dom3rdFri, dom3rdSat,
+ dom4thSun, dom4thMon, dom4thTue, dom4thWen, dom4thThu, dom4thFri, dom4thSat,
+ domLastSun, domLastMon, domLastTue, domLastWen, domLastThu, domLastFri,
+ domLastSat
+ } DayOfWeekType;
+
+// Values used by DateTemplateToAscii routine.
+#define dateTemplateChar chrCircumflexAccent
+
+enum {
+ dateTemplateDayNum = '0',
+ dateTemplateDOWName,
+ dateTemplateMonthName,
+ dateTemplateMonthNum,
+ dateTemplateYearNum
+};
+
+#define dateTemplateShortModifier 's'
+#define dateTemplateRegularModifier 'r'
+#define dateTemplateLongModifier 'l'
+#define dateTemplateLeadZeroModifier 'z'
+
+//************************************************************
+//* Date and Time macros
+//***********************************************************
+
+// Convert a date in a DateType structure to an UInt16.
+ #define DateToInt(date) (*(UInt16 *) &date)
+
+
+// Convert a date in a DateType structure to a signed int.
+ #define TimeToInt(time) (*(Int16 *) &time)
+
+
+
+//************************************************************
+//* Date Time procedures
+//************************************************************
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void TimSecondsToDateTime(UInt32 seconds, DateTimePtr dateTimeP)
+ SYS_TRAP(sysTrapTimSecondsToDateTime);
+
+UInt32 TimDateTimeToSeconds(DateTimePtr dateTimeP)
+ SYS_TRAP(sysTrapTimDateTimeToSeconds);
+
+void TimAdjust(DateTimePtr dateTimeP, Int32 adjustment)
+ SYS_TRAP(sysTrapTimAdjust);
+
+void TimeToAscii(UInt8 hours, UInt8 minutes, TimeFormatType timeFormat,
+ Char *pString)
+ SYS_TRAP(sysTrapTimeToAscii);
+
+
+
+Int16 DaysInMonth(Int16 month, Int16 year)
+ SYS_TRAP(sysTrapDaysInMonth);
+
+Int16 DayOfWeek (Int16 month, Int16 day, Int16 year)
+ SYS_TRAP(sysTrapDayOfWeek);
+
+Int16 DayOfMonth (Int16 month, Int16 day, Int16 year)
+ SYS_TRAP(sysTrapDayOfMonth);
+
+
+
+// Date routines.
+void DateSecondsToDate (UInt32 seconds, DatePtr date)
+ SYS_TRAP(sysTrapDateSecondsToDate);
+
+void DateDaysToDate (UInt32 days, DatePtr date)
+ SYS_TRAP(sysTrapDateDaysToDate);
+
+UInt32 DateToDays (DateType date)
+ SYS_TRAP(sysTrapDateToDays);
+
+void DateAdjust (DatePtr dateP, Int32 adjustment)
+ SYS_TRAP(sysTrapDateAdjust);
+
+void DateToAscii(UInt8 months, UInt8 days, UInt16 years,
+ DateFormatType dateFormat, Char *pString)
+ SYS_TRAP(sysTrapDateToAscii);
+
+void DateToDOWDMFormat(UInt8 months, UInt8 days, UInt16 years,
+ DateFormatType dateFormat, Char *pString)
+ SYS_TRAP(sysTrapDateToDOWDMFormat);
+
+UInt16 DateTemplateToAscii(const Char *templateP, UInt8 months,
+ UInt8 days, UInt16 years, Char *stringP, Int16 stringLen)
+ SYS_TRAP(sysTrapDateTemplateToAscii);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__DATETIME_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h b/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h
new file mode 100644
index 0000000..9417c42
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/ErrorBase.h
@@ -0,0 +1,294 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ErrorBase.h
+ *
+ * Description:
+ * Include file for Error Management
+ *
+ * History:
+ * 10/25/94 RM Created by Ron Marianetti
+ * 10/09/98 Bob Fill in all macros, fix defns w/ do{}while(0)
+ * 08/05/99 kwk Added menuErrorClass from Gavin's Menu.c
+ *
+ *-----------------------------------------------------------------------
+ * Exception Handling
+ *
+ * This unit implements an exception handling mechanism that is similar
+ * to "real" C++ Exceptions. Our Exceptions are untyped, and there
+ * must be one and only one Catch block for each Try block.
+ *
+ * Try/Catch Syntax:
+ *
+ * ErrTry {
+ * // Do something which may fail.
+ * // Call ErrThrow() to signal failure and force jump
+ * // to the following Catch block.
+ * }
+ *
+ * ErrCatch(inErr) {
+ * // Recover or cleanup after a failure in the above Try block.
+ * // "inErr" is an ExceptionCode identifying the reason
+ * // for the failure.
+ *
+ * // You may call Throw() if you want to jump out to
+ * // the next Catch block.
+ *
+ * // The code in this Catch block does not execute if
+ * // the above Try block completes without a Throw.
+ *
+ * } ErrEndCatch
+ *
+ * You must structure your code exactly as above. You can't have a
+ * ErrTry { } without a ErrCatch { } ErrEndCatch, or vice versa.
+ *
+ *
+ * ErrThrow
+ *
+ * To signal failure, call ErrThrow() from within a Try block. The
+ * Throw can occur anywhere in the Try block, even within functions
+ * called from the Try block. A ErrThrow() will jump execution to the
+ * start of the nearest Catch block, even across function calls.
+ * Destructors for stack-based objects which go out of scope as
+ * a result of the ErrThrow() are called.
+ *
+ * You can call ErrThrow() from within a Catch block to "rethrow"
+ * the exception to the next nearest Catch block.
+ *
+ *
+ * Exception Codes
+ *
+ * An ExceptionCode is a 32-bit number. You will normally use
+ * Pilot error codes, which are 16-bit numbers. This allows
+ * plently of room for defining codes for your own kinds of errors.
+ *
+ *
+ * Limitations
+ *
+ * Try/Catch and Throw are based on setjmp/longjmp. At the
+ * beginning of a Try block, setjmp saves the machine registers.
+ * Throw calls longjmp, which restores the registers and jumps
+ * to the beginning of the Catch block. Therefore, any changes
+ * in the Try block to variables stored in registers will not
+ * be retained when entering the Catch block.
+ *
+ * The solution is to declare variables that you want to use
+ * in both the Try and Catch blocks as "volatile". For example:
+ *
+ * volatile long x = 1; // Declare volatile local variable
+ * ErrTry {
+ * x = 100; // Set local variable in Try
+ * ErrThrow(-1);
+ * }
+ *
+ * ErrCatch(inErr) {
+ * if (x > 1) { // Use local variable in Catch
+ * SysBeep(1);
+ * }
+ * } ErrEndCatch
+ *
+ *****************************************************************************/
+
+#ifndef __ERRORBASE_H__
+#define __ERRORBASE_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+
+#if EMULATION_LEVEL != EMULATION_NONE
+#include <setjmp.h>
+#endif
+
+// Max message length supported by ErrCustomAlert
+#define errMaxMsgLength 511
+
+
+/************************************************************
+ * Error Classes for each manager
+ *************************************************************/
+#define errNone 0x0000 // No error
+
+#define memErrorClass 0x0100 // Memory Manager
+#define dmErrorClass 0x0200 // Data Manager
+#define serErrorClass 0x0300 // Serial Manager
+#define slkErrorClass 0x0400 // Serial Link Manager
+#define sysErrorClass 0x0500 // System Manager
+#define fplErrorClass 0x0600 // Floating Point Library
+#define flpErrorClass 0x0680 // New Floating Point Library
+#define evtErrorClass 0x0700 // System Event Manager
+#define sndErrorClass 0x0800 // Sound Manager
+#define almErrorClass 0x0900 // Alarm Manager
+#define timErrorClass 0x0A00 // Time Manager
+#define penErrorClass 0x0B00 // Pen Manager
+#define ftrErrorClass 0x0C00 // Feature Manager
+#define cmpErrorClass 0x0D00 // Connection Manager (HotSync)
+#define dlkErrorClass 0x0E00 // Desktop Link Manager
+#define padErrorClass 0x0F00 // PAD Manager
+#define grfErrorClass 0x1000 // Graffiti Manager
+#define mdmErrorClass 0x1100 // Modem Manager
+#define netErrorClass 0x1200 // Net Library
+#define htalErrorClass 0x1300 // HTAL Library
+#define inetErrorClass 0x1400 // INet Library
+#define exgErrorClass 0x1500 // Exg Manager
+#define fileErrorClass 0x1600 // File Stream Manager
+#define rfutErrorClass 0x1700 // RFUT Library
+#define txtErrorClass 0x1800 // Text Manager
+#define tsmErrorClass 0x1900 // Text Services Library
+#define webErrorClass 0x1A00 // Web Library
+#define secErrorClass 0x1B00 // Security Library
+#define emuErrorClass 0x1C00 // Emulator Control Manager
+#define flshErrorClass 0x1D00 // Flash Manager
+#define pwrErrorClass 0x1E00 // Power Manager
+#define cncErrorClass 0x1F00 // Connection Manager (Serial Communication)
+#define actvErrorClass 0x2000 // Activation application
+#define radioErrorClass 0x2100 // Radio Manager (Library)
+#define dispErrorClass 0x2200 // Display Driver Errors.
+#define bltErrorClass 0x2300 // Blitter Driver Errors.
+#define winErrorClass 0x2400 // Window manager.
+#define omErrorClass 0x2500 // Overlay Manager
+#define menuErrorClass 0x2600 // Menu Manager
+#define lz77ErrorClass 0x2700 // Lz77 Library
+#define smsErrorClass 0x2800 // Sms Library
+#define expErrorClass 0x2900 // Expansion Manager and Slot Driver Library
+#define vfsErrorClass 0x2A00 // Virtual Filesystem Manager and Filesystem library
+#define lmErrorClass 0x2B00 // Locale Manager
+#define intlErrorClass 0x2C00 // International Manager
+#define pdiErrorClass 0x2D00 // PDI Library
+#define attnErrorClass 0x2E00 // Attention Manager
+#define telErrorClass 0x2F00 // Telephony Manager
+#define hwrErrorClass 0x3000 // Hardware Manager (HAL)
+#define blthErrorClass 0x3100 // Bluetooth Library Error Class
+#define udaErrorClass 0x3200 // UDA Manager Error Class
+
+#define oemErrorClass 0x7000 // OEM/Licensee errors (0x7000-0x7EFF shared among ALL partners)
+#define errInfoClass 0x7F00 // special class shows information w/o error code
+#define appErrorClass 0x8000 // Application-defined errors
+
+
+
+/********************************************************************
+ * Try / Catch / Throw support
+ *
+ * ---------------------------------------------------------------------
+ * Exception Handler structure
+ *
+ * An ErrExceptionType object is created for each ErrTry & ErrCatch block.
+ * At any point in the program, there is a linked list of
+ * ErrExceptionType objects. GErrFirstException points to the
+ * most recently entered block. A ErrExceptionType blocks stores
+ * information about the state of the machine (register values)
+ * at the start of the Try block
+ ********************************************************************/
+
+#if EMULATION_LEVEL != EMULATION_NONE
+ #define ErrJumpBuf jmp_buf
+#else
+ typedef long* ErrJumpBuf[12]; // D3-D7,PC,A2-A7
+#endif
+
+// Structure used to store Try state.
+typedef struct ErrExceptionType {
+ struct ErrExceptionType* nextP; // next exception type
+ ErrJumpBuf state; // setjmp/longjmp storage
+ Int32 err; // Error code
+ } ErrExceptionType;
+typedef ErrExceptionType *ErrExceptionPtr;
+
+
+// Try & Catch macros
+#define ErrTry \
+ { \
+ ErrExceptionType _TryObject; \
+ _TryObject.err = 0; \
+ _TryObject.nextP = (ErrExceptionPtr)*ErrExceptionList(); \
+ *ErrExceptionList() = (MemPtr)&_TryObject; \
+ if (ErrSetJump(_TryObject.state) == 0) {
+
+
+// NOTE: All variables referenced in and after the ErrCatch must
+// be declared volatile. Here's how for variables and pointers:
+// volatile UInt16 oldMode;
+// ShlDBHdrTablePtr volatile hdrTabP = nil;
+// If you have many local variables after the ErrCatch you may
+// opt to put the ErrTry and ErrCatch in a separate enclosing function.
+#define ErrCatch(theErr) \
+ *ErrExceptionList() = (MemPtr)_TryObject.nextP; \
+ } \
+ else { \
+ Int32 theErr = _TryObject.err; \
+ *ErrExceptionList() = (MemPtr)_TryObject.nextP;
+
+
+#define ErrEndCatch \
+ } \
+ }
+
+
+
+/********************************************************************
+ * Error Manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if EMULATION_LEVEL != EMULATION_NONE
+ #define ErrSetJump(buf) setjmp(buf)
+ #define ErrLongJump(buf,res) longjmp(buf,res)
+
+#else
+ Int16 ErrSetJump(ErrJumpBuf buf)
+ SYS_TRAP(sysTrapErrSetJump);
+
+ void ErrLongJump(ErrJumpBuf buf, Int16 result)
+ SYS_TRAP(sysTrapErrLongJump);
+#endif
+
+MemPtr* ErrExceptionList(void)
+ SYS_TRAP(sysTrapErrExceptionList);
+
+void ErrThrow(Int32 err)
+ SYS_TRAP(sysTrapErrThrow);
+
+void ErrDisplayFileLineMsg(const Char * const filename, UInt16 lineNo,
+ const Char * const msg)
+ SYS_TRAP(sysTrapErrDisplayFileLineMsg);
+
+
+//---------------------------------------------------------------------
+// 2/25/98 - New routine for PalmOS >3.0 to display a UI alert for
+// run-time errors. This is most likely to be used by network applications
+// that are likely to encounter run-time errors like can't find the server,
+// network down, etc. etc.
+//
+// This routine will lookup the text associated with 'errCode' and display
+// it in an alert. If errMsgP is not NULL, then that text will be used
+// instead of the associated 'errCode' text. If 'preMsgP' or 'postMsgP'
+// is not null, then that text will be pre-pended or post-pended
+// respectively.
+//
+// Apps that don't use the extra parameters may want to just use the
+// macro below 'ErrAlert'
+//---------------------------------------------------------------------
+UInt16 ErrAlertCustom(Err errCode, Char *errMsgP, Char *preMsgP,
+ Char * postMsgP)
+ SYS_TRAP(sysTrapErrAlertCustom);
+
+#define ErrAlert(err) ErrAlertCustom(err, 0, 0, 0)
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+#endif // __ERRORBASE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h
new file mode 100644
index 0000000..ff9b2e5
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/FeatureMgr.h
@@ -0,0 +1,89 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FeatureMgr.h
+ *
+ * Description:
+ * Header for the Feature Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __FEATUREMGR_H__
+#define __FEATUREMGR_H__
+
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <ErrorBase.h>
+
+
+
+/************************************************************
+ * Feature manager error codes
+ * the constant ftrErrorClass is defined in ErrorBase.h
+ *************************************************************/
+#define ftrErrInvalidParam (ftrErrorClass | 1)
+#define ftrErrNoSuchFeature (ftrErrorClass | 2)
+#define ftrErrAlreadyExists (ftrErrorClass | 3)
+#define ftrErrROMBased (ftrErrorClass | 4)
+#define ftrErrInternalErr (ftrErrorClass | 5)
+
+
+/************************************************************
+ * Feature Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Init the feature Manager
+Err FtrInit(void)
+ SYS_TRAP(sysTrapFtrInit);
+
+
+// Get a feature
+Err FtrGet(UInt32 creator, UInt16 featureNum, UInt32 *valueP)
+ SYS_TRAP(sysTrapFtrGet);
+
+// Set/Create a feature.
+Err FtrSet(UInt32 creator, UInt16 featureNum, UInt32 newValue)
+ SYS_TRAP(sysTrapFtrSet);
+
+// Unregister a feature
+Err FtrUnregister(UInt32 creator, UInt16 featureNum)
+ SYS_TRAP(sysTrapFtrUnregister);
+
+// Get a feature by index
+Err FtrGetByIndex(UInt16 index, Boolean romTable,
+ UInt32 *creatorP, UInt16 *numP, UInt32 *valueP)
+ SYS_TRAP(sysTrapFtrGetByIndex);
+
+// Get temporary space from storage heap
+Err FtrPtrNew(UInt32 creator, UInt16 featureNum, UInt32 size,
+ void **newPtrP)
+ SYS_TRAP(sysTrapFtrPtrNew);
+
+// Release temporary space to storage heap
+Err FtrPtrFree(UInt32 creator, UInt16 featureNum)
+ SYS_TRAP(sysTrapFtrPtrFree);
+
+
+// Resize block of temporary storage
+Err FtrPtrResize(UInt32 creator, UInt16 featureNum, UInt32 newSize,
+ void **newPtrP)
+ SYS_TRAP(sysTrapFtrPtrResize);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __FEATUREMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Font.h b/SrcShared/Palm/Platform/Incs/Core/System/Font.h
new file mode 100644
index 0000000..1312a0a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Font.h
@@ -0,0 +1,150 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Font.h
+ *
+ * Description:
+ * This file defines font structures and routines.
+ *
+ * History:
+ * September 13, 1994 Created by Art Lamb
+ * 05/05/98 art Add structures for font mapping table.
+ * 07/03/98 kwk Added FntWidthToOffset.
+ * 10/23/98 kwk Changed fontMapTable to 0xC000 (was 0xFFFF).
+ * 10/20/99 kwk Moved private values to FontPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __FONT_H__
+#define __FONT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// Pixel width of tab stops in fields
+#define fntTabChrWidth 20
+
+// Width of character missing from font.
+#define fntMissingChar -1
+
+typedef struct {
+ Int8 offset;
+ Int8 width;
+} FontCharInfoType, * FontCharInfoPtr;
+
+typedef struct {
+ Int16 fontType; // font type
+ Int16 firstChar; // ASCII code of first character
+ Int16 lastChar; // ASCII code of last character
+ Int16 maxWidth; // maximum character width
+ Int16 kernMax; // negative of maximum character kern
+ Int16 nDescent; // negative of descent
+ Int16 fRectWidth; // width of font rectangle
+ Int16 fRectHeight; // height of font rectangle
+ Int16 owTLoc; // offset to offset/width table
+ Int16 ascent; // ascent
+ Int16 descent; // descent
+ Int16 leading; // leading
+ Int16 rowWords; // row width of bit image / 2
+} FontType;
+
+typedef FontType *FontPtr;
+
+typedef FontPtr *FontTablePtr;
+
+enum fontID {
+ stdFont = 0x00, // Small font used for the user's writing. Shows a good amount
+ boldFont, // Small font. Bold for easier reading. Used often for ui.
+ largeFont, // Larger font for easier reading. Shows a lot less.
+ symbolFont, // Various ui images like check boxes and arrows
+ symbol11Font, // Larger various ui images
+ symbol7Font, // Smaller various ui images
+ ledFont, // Calculator specific font
+ largeBoldFont, // A thicker version of the large font. More readable.
+ fntAppFontCustomBase = 0x80 // First available application-defined font ID
+};
+
+typedef enum fontID FontID;
+
+#define checkboxFont symbol11Font
+
+#define FntIsAppDefined(fnt) (fnt >= fntAppFontCustomBase)
+
+
+
+//--------------------------------------------------------------------
+//
+// Font Function
+//
+//--------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+FontID FntGetFont (void)
+ SYS_TRAP(sysTrapFntGetFont);
+
+FontID FntSetFont (FontID font)
+ SYS_TRAP(sysTrapFntSetFont);
+
+FontPtr FntGetFontPtr (void)
+ SYS_TRAP(sysTrapFntGetFontPtr);
+
+Int16 FntBaseLine (void)
+ SYS_TRAP(sysTrapFntBaseLine);
+
+Int16 FntCharHeight (void)
+ SYS_TRAP(sysTrapFntCharHeight);
+
+Int16 FntLineHeight (void)
+ SYS_TRAP(sysTrapFntLineHeight);
+
+Int16 FntAverageCharWidth (void)
+ SYS_TRAP(sysTrapFntAverageCharWidth);
+
+Int16 FntCharWidth (Char ch)
+ SYS_TRAP(sysTrapFntCharWidth);
+
+Int16 FntCharsWidth (Char const *chars, Int16 len)
+ SYS_TRAP(sysTrapFntCharsWidth);
+
+Int16 FntWidthToOffset (Char const *pChars, UInt16 length,
+ Int16 pixelWidth, Boolean *leadingEdge, Int16 *truncWidth)
+ SYS_TRAP(sysTrapFntWidthToOffset);
+
+void FntCharsInWidth (Char const *string,
+ Int16 *stringWidthP, Int16 *stringLengthP,
+ Boolean *fitWithinWidth)
+ SYS_TRAP(sysTrapFntCharsInWidth);
+
+Int16 FntDescenderHeight (void)
+ SYS_TRAP(sysTrapFntDescenderHeight);
+
+Int16 FntLineWidth (Char const *pChars, UInt16 length)
+ SYS_TRAP(sysTrapFntLineWidth);
+
+UInt16 FntWordWrap (Char const *chars, UInt16 maxWidth)
+ SYS_TRAP(sysTrapFntWordWrap);
+
+void FntWordWrapReverseNLines (Char const *const chars,
+ UInt16 maxWidth, UInt16 *linesToScrollP, UInt16 *scrollPosP)
+ SYS_TRAP(sysTrapFntWordWrapReverseNLines);
+
+void FntGetScrollValues (Char const *chars, UInt16 width,
+ UInt16 scrollPos, UInt16 *linesP, UInt16 *topLine)
+ SYS_TRAP(sysTrapFntGetScrollValues);
+
+Err FntDefineFont (FontID font, FontPtr fontP)
+ SYS_TRAP(sysTrapFntDefineFont);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __FONT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h
new file mode 100644
index 0000000..0adaf43
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/IntlMgr.h
@@ -0,0 +1,113 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1998-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: IntlMgr.h
+ *
+ * Description:
+ * This file defines public Int'l Mgr structures and routines.
+ *
+ * History:
+ * 03/21/98 kwk Created by Ken Krugler.
+ * 10/14/98 kwk Added intlIntlGetRoutineAddress selector and
+ * IntlGetRoutineAddress routine declaration.
+ * 08/05/99 kwk Added intlIntlHandleEvent selector and the
+ * IntlHandleEvent routine declaration.
+ * 09/22/99 kwk Added intlTxtParamString selector.
+ * 10/20/99 kwk Moved private stuff to IntlPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __INTLMGR_H__
+#define __INTLMGR_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+// If nobody has explicitly specified that we should or should not
+// use our international trap dispatcher, set it based on the emulation
+// level.
+
+#ifndef USE_INTL_TRAPS
+ #if EMULATION_LEVEL == EMULATION_NONE
+ #define USE_INTL_TRAPS 1
+ #else
+ #define USE_INTL_TRAPS 0
+ #endif
+#endif
+
+/***********************************************************************
+ * Public constants
+ ***********************************************************************/
+
+// Bits set for the Intl Mgr feature.
+
+#define intlMgrExists 0x00000001
+
+// International Manager trap macros.
+
+#if USE_INTL_TRAPS
+ #define INTL_TRAP(sel) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapIntlDispatch, sel)
+#else
+ #define INTL_TRAP(intlSelectorNum)
+#endif
+
+// Selectors for routines found in the international manager. The order
+// of these selectors MUST match the jump table in IntlDispatch.c.
+
+#define intlIntlInit 0
+#define intlTxtByteAttr 1
+#define intlTxtCharAttr 2
+#define intlTxtCharXAttr 3
+#define intlTxtCharSize 4
+#define intlTxtGetPreviousChar 5
+#define intlTxtGetNextChar 6
+#define intlTxtGetChar 7
+#define intlTxtSetNextChar 8
+#define intlTxtCharBounds 9
+#define intlTxtPrepFindString 10
+#define intlTxtFindString 11
+#define intlTxtReplaceStr 12
+#define intlTxtWordBounds 13
+#define intlTxtCharEncoding 14
+#define intlTxtStrEncoding 15
+#define intlTxtEncodingName 16
+#define intlTxtMaxEncoding 17
+#define intlTxtTransliterate 18
+#define intlTxtCharIsValid 19
+#define intlTxtCompare 20
+#define intlTxtCaselessCompare 21
+#define intlTxtCharWidth 22
+#define intlTxtGetTruncationOffset 23
+#define intlIntlGetRoutineAddress 24
+#define intlIntlHandleEvent 25 // New for Palm OS 3.5
+#define intlTxtParamString 26
+#define intlTxtConvertEncodingV35 27 // Patched for Palm OS 3.5.2
+#define intlTxtConvertEncoding 28 // New for Palm OS 4.0
+#define intlIntlSetRoutineAddress 29
+#define intlTxtGetWordWrapOffset 30
+#define intlTxtNameToEncoding 31
+#define intlIntlStrictChecks 32
+
+/***********************************************************************
+ * Public routines
+ ***********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+void *IntlGetRoutineAddress(IntlSelector inSelector)
+ INTL_TRAP(intlIntlGetRoutineAddress);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif // __INTLMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h
new file mode 100644
index 0000000..5a81a6a
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/KeyMgr.h
@@ -0,0 +1,76 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: KeyMgr.h
+ *
+ * Description:
+ * Include file for Key manager
+ *
+ * History:
+ * 9/13/95 Created by Ron Marianetti
+ * 2/04/98 srj- added contrast key defines
+ * 8/23/98 SCL- Cross-merged 3.1 and 3.2
+ *
+ *****************************************************************************/
+
+#ifndef __KEYMGR_H__
+#define __KEYMGR_H__
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+
+/********************************************************************
+ * Definition of bit field returned from KeyCurrentState
+ ********************************************************************/
+#define keyBitPower 0x0001 // Power key
+#define keyBitPageUp 0x0002 // Page-up
+#define keyBitPageDown 0x0004 // Page-down
+#define keyBitHard1 0x0008 // App #1
+#define keyBitHard2 0x0010 // App #2
+#define keyBitHard3 0x0020 // App #3
+#define keyBitHard4 0x0040 // App #4
+#define keyBitCradle 0x0080 // Button on cradle
+#define keyBitAntenna 0x0100 // Antenna "key" <chg 3-31-98 RM>
+#define keyBitContrast 0x0200 // Contrast key
+
+#define keyBitsAll 0xFFFFFFFF // all keys
+
+
+#define slowestKeyDelayRate 0xff
+#define slowestKeyPeriodRate 0xff
+
+
+/********************************************************************
+ * Key manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Set/Get the auto-key repeat rate
+Err KeyRates(Boolean set, UInt16 *initDelayP, UInt16 *periodP,
+ UInt16 *doubleTapDelayP, Boolean *queueAheadP)
+ SYS_TRAP(sysTrapKeyRates);
+
+// Get the current state of the hardware keys
+// This is now updated every tick, even when more than 1 key is held down.
+UInt32 KeyCurrentState(void)
+ SYS_TRAP(sysTrapKeyCurrentState);
+
+// Set the state of the hardware key mask which controls if the key
+// generates a keyDownEvent
+UInt32 KeySetMask(UInt32 keyMask)
+ SYS_TRAP(sysTrapKeySetMask);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__KEYMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h
new file mode 100644
index 0000000..0351640
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/LocaleMgr.h
@@ -0,0 +1,230 @@
+/******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: LocaleMgr.h
+ *
+ * Release:
+ *
+ * Description:
+ * Public header for routines that support locales (information specific
+ * to locales and regions).
+ *
+ * History:
+ * 04/28/00 CS Created by Chris Schneider.
+ * 05/16/00 CS LmCountryType/LmLanguageType are now back to
+ * CountryType/LanguageType.
+ * 05/31/00 CS Moved country and language codes to new Locale.h and removed
+ * kLanguageFirst, etc.
+ * 06/06/00 kwk Made _LmLocaleType's language & country fields be UInt16's,
+ * so that it's binary compatible with OmLocaleType.
+ * 07/28/00 CS Replaced lmChoiceMinutesWestOfGMT & lmChoiceDaylightSavings
+ * selectors with lmChoiceTimeZone.
+ * 08/08/00 CS Renamed LmGetLocaleSetting's <iMaxSize> parameter <iValueSize>
+ * to reflect the fact that the routine now checks to make sure
+ * that <oValue> is the correct size for all fixed-size settings.
+ * 09/29/00 CS Made iLocale parm of LmLocaleToIndex const.
+ * 11/17/00 CS Removed support for lmChoiceLanguage & lmChoiceCountry,
+ * since these guys were returning UInt8's, which probably
+ * won't cut it at some point in the future. Callers can use
+ * lmChoiceLocale, which returns an LmLocaleType struct that
+ * places the country and language into UInt16 fields.
+ * CS Defined lmAnyCountry & lmAnyLanguage, which can now be passed
+ * in LmLocaleToIndex's iLocale parameter (as wildcards).
+ *
+ *****************************************************************************/
+
+#ifndef __LOCALEMGR_H__
+#define __LOCALEMGR_H__
+
+/* Supporting lmChoiceLanguageName would add over 3K to the 'locs' resource.
+ DOLATER CS - either do it or punt.
+*/
+#define SUPPORT_LANGUAGE_NAME 0
+
+#include <CoreTraps.h>
+
+/***********************************************************************
+ * Locale Manager errors
+ **********************************************************************/
+
+/* Locale not found in 'locs' resource.
+*/
+#define lmErrUnknownLocale (lmErrorClass | 1)
+
+/* Locale index >= LmGetNumLocales().
+*/
+#define lmErrBadLocaleIndex (lmErrorClass | 2)
+
+/* LmLocaleSettingChoice out of bounds.
+*/
+#define lmErrBadLocaleSettingChoice (lmErrorClass | 3)
+
+/* Data for locale setting too big for destination.
+*/
+#define lmErrSettingDataOverflow (lmErrorClass | 4)
+
+/***********************************************************************
+ * Locale Manager settings (pass to LmGetLocaleSetting)
+ **********************************************************************/
+
+typedef UInt16 LmLocaleSettingChoice;
+
+/* LmLocaleType
+*/
+#define lmChoiceLocale ((LmLocaleSettingChoice)1)
+
+/* Char[kMaxLanguageNameLen+1] - Name of the language spoken there (localized)
+*/
+#if SUPPORT_LANGUAGE_NAME
+ #define lmChoiceLanguageName ((LmLocaleSettingChoice)4)
+#else
+ #define lmChoiceLanguageName #error lmChoiceLanguageName not supported
+#endif
+
+/* Char[kMaxCountryNameLen+1] - Name of the country (localized)
+*/
+#define lmChoiceCountryName ((LmLocaleSettingChoice)5)
+
+/* DateFormatType
+*/
+#define lmChoiceDateFormat ((LmLocaleSettingChoice)6)
+
+/* DateFormatType
+*/
+#define lmChoiceLongDateFormat ((LmLocaleSettingChoice)7)
+
+/* TimeFormatType
+*/
+#define lmChoiceTimeFormat ((LmLocaleSettingChoice)8)
+
+/* UInt16 - Weekday for calendar column 1 (sunday=0, monday=1, etc.)
+*/
+#define lmChoiceWeekStartDay ((LmLocaleSettingChoice)9)
+
+/* Int16 - Default GMT offset minutes, + for east of GMT, - for west
+*/
+#define lmChoiceTimeZone ((LmLocaleSettingChoice)10)
+
+/* NumberFormatType - Specifies decimal and thousands separator characters
+*/
+#define lmChoiceNumberFormat ((LmLocaleSettingChoice)11)
+
+/* Char[kMaxCurrencyNameLen+1] - Name of local currency (e.g., "US Dollar")
+*/
+#define lmChoiceCurrencyName ((LmLocaleSettingChoice)12)
+
+/* Char[kMaxCurrencySymbolLen+1] - Currency symbol (e.g., "$")
+*/
+#define lmChoiceCurrencySymbol ((LmLocaleSettingChoice)13)
+
+/* Char[kMaxCurrencySymbolLen+1] - Unique currency symbol (e.g., "US$")
+*/
+#define lmChoiceUniqueCurrencySymbol ((LmLocaleSettingChoice)14)
+
+/* UInt16 - Number of decimals for currency (e.g., 2 for $10.12)
+*/
+#define lmChoiceCurrencyDecimalPlaces ((LmLocaleSettingChoice)15)
+
+/* MeasurementSystemType - Metric, English, etc.
+*/
+#define lmChoiceMeasurementSystem ((LmLocaleSettingChoice)16)
+
+/***********************************************************************
+ * Locale Manager constants
+ **********************************************************************/
+#define lmAnyCountry 65535U // Pass LmLocaleToIndex's iLocale
+#define lmAnyLanguage 65535U // Pass LmLocaleToIndex's iLocale
+
+#define kMaxCountryNameLen 19
+#if SUPPORT_LANGUAGE_NAME
+ #define kMaxLanguageNameLen 19
+#endif
+#define kMaxCurrencyNameLen 19
+#define kMaxCurrencySymbolLen 5
+
+/***********************************************************************
+ * Selectors & macros used for calling Locale Manager routines
+ **********************************************************************/
+
+#ifndef DIRECT_LOCALE_CALLS
+ #define DIRECT_LOCALE_CALLS 0
+#endif
+#if DIRECT_LOCALE_CALLS
+ #define LMDISPATCH_TRAP(routineSelector)
+#else
+ #define LMDISPATCH_TRAP(routineSelector) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, \
+ sysTrapLmDispatch, \
+ routineSelector)
+#endif
+
+/* Selectors used for getting to the right Locale Manager routine via
+the LmDispatch trap. */
+
+// DOLATER:jwm: remove me after fixing LocaleMgr.c:PrvSelectorError
+typedef UInt16 LmRoutineSelector;
+#define lmInit 0
+#define lmGetNumLocales 1
+#define lmLocaleToIndex 2
+#define lmGetLocaleSetting 3
+
+#define lmMaxRoutineSelector lmGetLocaleSetting
+
+/***********************************************************************
+ * Locale Manager types
+ **********************************************************************/
+
+typedef UInt8 LanguageType;
+typedef UInt8 CountryType;
+
+typedef struct _LmLocaleType LmLocaleType;
+struct _LmLocaleType
+{
+ UInt16 language; // Language spoken in locale (LanguageType)
+ UInt16 country; // Specifies "dialect" of language (CountryType)
+};
+
+/***********************************************************************
+ * Locale Manager routines
+ **********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Return the number of known locales (maximum locale index + 1).
+*/
+UInt16
+LmGetNumLocales(void)
+ LMDISPATCH_TRAP(lmGetNumLocales);
+
+/* Convert <iLocale> to <oLocaleIndex> by locating it within the set of known
+locales.
+*/
+Err
+LmLocaleToIndex( const
+ LmLocaleType* iLocale,
+ UInt16* oLocaleIndex)
+ LMDISPATCH_TRAP(lmLocaleToIndex);
+
+/* Return in <oValue> the setting identified by <iChoice> which is appropriate for
+the locale identified by <iLocaleIndex>. Return lmErrSettingDataOverflow if the
+data for <iChoice> occupies more than <iValueSize> bytes. Display a non-fatal
+error if <iValueSize> is larger than the data for a fixed-size setting.
+*/
+Err
+LmGetLocaleSetting( UInt16 iLocaleIndex,
+ LmLocaleSettingChoice iChoice,
+ void* oValue,
+ UInt16 iValueSize)
+ LMDISPATCH_TRAP(lmGetLocaleSetting);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Localize.h b/SrcShared/Palm/Platform/Incs/Core/System/Localize.h
new file mode 100644
index 0000000..6bf9e92
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Localize.h
@@ -0,0 +1,54 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Localize.h
+ *
+ * Description:
+ * Functions to localize data.
+ *
+ * History:
+ * 8/28/96 Roger - Initial version
+ *
+ *****************************************************************************/
+
+#ifndef __LOCALIZE_H__
+#define __LOCALIZE_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+typedef enum {
+ nfCommaPeriod,
+ nfPeriodComma,
+ nfSpaceComma,
+ nfApostrophePeriod,
+ nfApostropheComma
+ } NumberFormatType;
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void LocGetNumberSeparators(NumberFormatType numberFormat,
+ Char *thousandSeparator, Char *decimalSeparator)
+ SYS_TRAP(sysTrapLocGetNumberSeparators);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __LOCALIZE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h
new file mode 100644
index 0000000..c0b7f6d
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/MemoryMgr.h
@@ -0,0 +1,341 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: MemoryMgr.h
+ *
+ * Description:
+ * Include file for Memory Manager
+ *
+ * History:
+ * 10/25/94 RM Created by Ron Marianetti
+ * 10/28/99 kwk Added memErrROMOnlyCard.
+ *
+ *****************************************************************************/
+
+#ifndef __MEMORYMGR_H__
+#define __MEMORYMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+#include <ErrorBase.h>
+
+
+/************************************************************
+ * Memory Manager Types
+ *************************************************************/
+typedef enum { memIDPtr, memIDHandle } LocalIDKind;
+
+
+/************************************************************
+ * Flags accepted as parameter for MemNewChunk.
+ *************************************************************/
+#define memNewChunkFlagPreLock 0x0100
+#define memNewChunkFlagNonMovable 0x0200
+#define memNewChunkFlagAtStart 0x0400 // force allocation at front of heap
+#define memNewChunkFlagAtEnd 0x0800 // force allocation at end of heap
+
+
+/************************************************************
+ * Memory Manager Debug settings for the MemSetDebugMode function
+ *************************************************************/
+#define memDebugModeCheckOnChange 0x0001
+#define memDebugModeCheckOnAll 0x0002
+#define memDebugModeScrambleOnChange 0x0004
+#define memDebugModeScrambleOnAll 0x0008
+#define memDebugModeFillFree 0x0010
+#define memDebugModeAllHeaps 0x0020
+#define memDebugModeRecordMinDynHeapFree 0x0040
+
+
+
+
+/************************************************************
+ * Memory Manager result codes
+ *************************************************************/
+#define memErrChunkLocked (memErrorClass | 1)
+#define memErrNotEnoughSpace (memErrorClass | 2)
+#define memErrInvalidParam (memErrorClass | 3) /* invalid param or requested size is too big */
+#define memErrChunkNotLocked (memErrorClass | 4)
+#define memErrCardNotPresent (memErrorClass | 5)
+#define memErrNoCardHeader (memErrorClass | 6)
+#define memErrInvalidStoreHeader (memErrorClass | 7)
+#define memErrRAMOnlyCard (memErrorClass | 8)
+#define memErrWriteProtect (memErrorClass | 9)
+#define memErrNoRAMOnCard (memErrorClass | 10)
+#define memErrNoStore (memErrorClass | 11)
+#define memErrROMOnlyCard (memErrorClass | 12)
+
+
+/********************************************************************
+ * Memory Manager Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+Err MemInit(void)
+ SYS_TRAP(sysTrapMemInit);
+
+Err MemKernelInit(void)
+ SYS_TRAP(sysTrapMemKernelInit);
+
+Err MemInitHeapTable(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemInitHeapTable);
+
+//-------------------------------------------------------------------
+// Card formatting and Info
+//-------------------------------------------------------------------
+UInt16 MemNumCards(void)
+ SYS_TRAP(sysTrapMemNumCards);
+
+Err MemCardFormat(UInt16 cardNo, Char *cardNameP,
+ Char *manufNameP, Char *ramStoreNameP)
+ SYS_TRAP(sysTrapMemCardFormat);
+
+Err MemCardInfo(UInt16 cardNo,
+ Char *cardNameP, Char *manufNameP,
+ UInt16 *versionP, UInt32 *crDateP,
+ UInt32 *romSizeP, UInt32 *ramSizeP,
+ UInt32 *freeBytesP)
+ SYS_TRAP(sysTrapMemCardInfo);
+
+
+//-------------------------------------------------------------------
+// Store Info
+//-------------------------------------------------------------------
+Err MemStoreInfo(UInt16 cardNo, UInt16 storeNumber,
+ UInt16 *versionP, UInt16 *flagsP, Char *nameP,
+ UInt32 * crDateP, UInt32 *bckUpDateP,
+ UInt32 * heapListOffsetP, UInt32 *initCodeOffset1P,
+ UInt32 *initCodeOffset2P, LocalID* databaseDirIDP)
+ SYS_TRAP(sysTrapMemStoreInfo);
+
+Err MemStoreSetInfo(UInt16 cardNo, UInt16 storeNumber,
+ UInt16 *versionP, UInt16 *flagsP, Char *nameP,
+ UInt32 *crDateP, UInt32 *bckUpDateP,
+ UInt32 *heapListOffsetP, UInt32 *initCodeOffset1P,
+ UInt32 *initCodeOffset2P, LocalID* databaseDirIDP)
+ SYS_TRAP(sysTrapMemStoreSetInfo);
+
+
+//-------------------------------------------------------------------
+// Heap Info & Utilities
+//-------------------------------------------------------------------
+UInt16 MemNumHeaps(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemNumHeaps);
+
+UInt16 MemNumRAMHeaps(UInt16 cardNo)
+ SYS_TRAP(sysTrapMemNumRAMHeaps);
+
+UInt16 MemHeapID(UInt16 cardNo, UInt16 heapIndex)
+ SYS_TRAP(sysTrapMemHeapID);
+
+Boolean MemHeapDynamic(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapDynamic);
+
+Err MemHeapFreeBytes(UInt16 heapID, UInt32 *freeP, UInt32 *maxP)
+ SYS_TRAP(sysTrapMemHeapFreeBytes);
+
+UInt32 MemHeapSize(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapSize);
+
+UInt16 MemHeapFlags(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapFlags);
+
+
+// Heap utilities
+Err MemHeapCompact(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapCompact);
+
+Err MemHeapInit(UInt16 heapID, Int16 numHandles, Boolean initContents)
+ SYS_TRAP(sysTrapMemHeapInit);
+
+Err MemHeapFreeByOwnerID(UInt16 heapID, UInt16 ownerID)
+ SYS_TRAP(sysTrapMemHeapFreeByOwnerID);
+
+
+//-------------------------------------------------------------------
+// Low Level Allocation
+//-------------------------------------------------------------------
+MemPtr MemChunkNew(UInt16 heapID, UInt32 size, UInt16 attr)
+ SYS_TRAP(sysTrapMemChunkNew);
+
+Err MemChunkFree(MemPtr chunkDataP)
+ SYS_TRAP(sysTrapMemChunkFree);
+
+
+
+//-------------------------------------------------------------------
+// Pointer (Non-Movable) based Chunk Routines
+//-------------------------------------------------------------------
+MemPtr MemPtrNew(UInt32 size)
+ SYS_TRAP(sysTrapMemPtrNew);
+
+#define MemPtrFree( p) \
+ MemChunkFree(p)
+
+// Getting Attributes
+MemHandle MemPtrRecoverHandle(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrRecoverHandle);
+
+UInt16 MemPtrFlags(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrFlags);
+
+UInt32 MemPtrSize(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrSize);
+
+UInt16 MemPtrOwner(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrOwner);
+
+UInt16 MemPtrHeapID(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrHeapID);
+
+Boolean MemPtrDataStorage(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrDataStorage);
+
+UInt16 MemPtrCardNo(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrCardNo);
+
+LocalID MemPtrToLocalID(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrToLocalID);
+
+// Setting Attributes
+Err MemPtrSetOwner(MemPtr p, UInt16 owner)
+ SYS_TRAP(sysTrapMemPtrSetOwner);
+
+Err MemPtrResize(MemPtr p, UInt32 newSize)
+ SYS_TRAP(sysTrapMemPtrResize);
+
+Err MemPtrResetLock(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrResetLock);
+
+Err MemPtrUnlock(MemPtr p)
+ SYS_TRAP(sysTrapMemPtrUnlock);
+
+
+//-------------------------------------------------------------------
+// MemHandle (Movable) based Chunk Routines
+//-------------------------------------------------------------------
+MemHandle MemHandleNew(UInt32 size)
+ SYS_TRAP(sysTrapMemHandleNew);
+
+Err MemHandleFree(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleFree);
+
+// Getting Attributes
+UInt16 MemHandleFlags(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleFlags);
+
+UInt32 MemHandleSize(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleSize);
+
+UInt16 MemHandleOwner(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleOwner);
+
+UInt16 MemHandleLockCount(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleLockCount);
+
+UInt16 MemHandleHeapID(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleHeapID);
+
+Boolean MemHandleDataStorage(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleDataStorage);
+
+UInt16 MemHandleCardNo(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleCardNo);
+
+LocalID MemHandleToLocalID(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleToLocalID);
+
+
+// Setting Attributes
+Err MemHandleSetOwner( MemHandle h, UInt16 owner)
+ SYS_TRAP(sysTrapMemHandleSetOwner);
+
+Err MemHandleResize(MemHandle h, UInt32 newSize)
+ SYS_TRAP(sysTrapMemHandleResize);
+
+MemPtr MemHandleLock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleLock);
+
+Err MemHandleUnlock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleUnlock);
+
+Err MemHandleResetLock(MemHandle h)
+ SYS_TRAP(sysTrapMemHandleResetLock);
+
+
+
+
+//-------------------------------------------------------------------
+// Local ID based routines
+//-------------------------------------------------------------------
+MemPtr MemLocalIDToGlobal(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToGlobal);
+
+LocalIDKind MemLocalIDKind(LocalID local)
+ SYS_TRAP(sysTrapMemLocalIDKind);
+
+MemPtr MemLocalIDToPtr(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToPtr);
+
+MemPtr MemLocalIDToLockedPtr(LocalID local, UInt16 cardNo)
+ SYS_TRAP(sysTrapMemLocalIDToLockedPtr);
+
+
+//-------------------------------------------------------------------
+// Utilities
+//-------------------------------------------------------------------
+Err MemMove(void *dstP, const void *sP, Int32 numBytes)
+ SYS_TRAP(sysTrapMemMove);
+
+Err MemSet(void *dstP, Int32 numBytes, UInt8 value)
+ SYS_TRAP(sysTrapMemSet);
+
+Int16 MemCmp (const void *s1, const void *s2, Int32 numBytes)
+ SYS_TRAP(sysTrapMemCmp);
+
+Err MemSemaphoreReserve(Boolean writeAccess)
+ SYS_TRAP(sysTrapMemSemaphoreReserve);
+
+Err MemSemaphoreRelease(Boolean writeAccess)
+ SYS_TRAP(sysTrapMemSemaphoreRelease);
+
+//-------------------------------------------------------------------
+// Debugging Support
+//-------------------------------------------------------------------
+UInt16 MemDebugMode(void)
+ SYS_TRAP(sysTrapMemDebugMode);
+
+Err MemSetDebugMode(UInt16 flags)
+ SYS_TRAP(sysTrapMemSetDebugMode);
+
+Err MemHeapScramble(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapScramble);
+
+Err MemHeapCheck(UInt16 heapID)
+ SYS_TRAP(sysTrapMemHeapCheck);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+
+
+#endif // __MEMORYMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h b/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h
new file mode 100644
index 0000000..9eb9f15
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/NetBitUtils.h
@@ -0,0 +1,135 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1997-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetBitUtils.h
+ *
+ * Description:
+ * Header file for bit manipulation routines used primarily
+ * by wireless network protocols.
+ *
+ * These routines live in the NetLib but are broken out here into
+ * a separate header so that they can be more easily used by source
+ * files that don't need access to the other NetLib functions.
+ *
+ * History:
+ * 6/11/97 Created by Ron Marianetti
+ * Name Date Description
+ * ---- ---- -----------
+ * vmk 8/25/98 Defined bitVarIntMaxBits and bitVarIntMaxBytes
+ *
+ *****************************************************************************/
+
+#ifndef __NETBITUTILS_H__
+#define __NETBITUTILS_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+
+#include <NetMgr.h>
+
+// # of bits in a byte
+#define bitsInByte 8
+
+
+// Maximum size of variable-size ints in # of bits and bytes. This is based on
+// the largest variable size int, which is encoded as follows: 1111 Bit[32]
+#define bitVarIntMaxBits 36
+#define bitVarIntMaxBytes ((bitVarIntMaxBits + bitsInByte - 1) / bitsInByte)
+
+
+//=====================================================
+// BitXXX Macros
+//
+// The following macros are handy because they don't require that
+// the source code pass in the NetLib library refnum to every
+// call.
+//
+// When building server code or other emulation code where th
+// library trap dispatcher is not used, the libRefNUm is unused
+// and can be 0.
+//
+// When building for the viewer, the libRefNum must be the refNum
+// of the NetLib. For applications, this libRefNum must be put
+// into an application global named 'AppNetRefnum'.
+//
+//====================================================
+#if USE_TRAPS == 0
+ #define netPrvRefnum 0
+#else
+ #define netPrvRefnum AppNetRefnum
+#endif
+
+
+#define BitMove( dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits) \
+ NetLibBitMove(netPrvRefnum, dstP, dstBitOffsetP, srcP, srcBitOffsetP, numBits)
+
+#define BitPutFixed( dstP, dstBitOffsetP, value, numBits) \
+ NetLibBitPutFixed(netPrvRefnum, dstP, dstBitOffsetP, value, numBits)
+
+#define BitGetFixed(srcP, srcBitOffsetP, numBits) \
+ NetLibBitGetFixed(netPrvRefnum, srcP, srcBitOffsetP, numBits)
+
+#define BitPutUIntV(dstP, dstBitOffsetP, value) \
+ NetLibBitPutUIntV(netPrvRefnum, dstP, dstBitOffsetP, value)
+
+#define BitGetUIntV(srcP, srcBitOffsetP) \
+ NetLibBitGetUIntV(netPrvRefnum, srcP, srcBitOffsetP)
+
+#define BitPutIntV(dstP, dstBitOffsetP, value) \
+ NetLibBitPutIntV(netPrvRefnum, dstP, dstBitOffsetP, value)
+
+#define BitGetIntV(srcP, srcBitOffsetP) \
+ NetLibBitGetIntV(netPrvRefnum, srcP, srcBitOffsetP)
+
+
+
+
+//=====================================================
+// Functions
+//====================================================
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//--------------------------------------------------
+// Bit Moving functions. For "slim" bit packing protocols
+// used over wireless.
+//--------------------------------------------------
+void NetLibBitMove(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt8 *srcP, UInt32 *srcBitOffsetP,
+ UInt32 numBits)
+ SYS_TRAP(netLibTrapBitMove);
+
+
+void NetLibBitPutFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt32 value, UInt16 numBits)
+ SYS_TRAP(netLibTrapBitPutFixed);
+
+UInt32 NetLibBitGetFixed(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt16 numBits)
+ SYS_TRAP(netLibTrapBitGetFixed);
+
+void NetLibBitPutUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ UInt32 value)
+ SYS_TRAP(netLibTrapBitPutUIntV);
+
+UInt32 NetLibBitGetUIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP)
+ SYS_TRAP(netLibTrapBitGetUIntV);
+
+void NetLibBitPutIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP,
+ Int32 value)
+ SYS_TRAP(netLibTrapBitPutUIntV);
+
+Int32 NetLibBitGetIntV(UInt16 libRefNum, UInt8 *dstP, UInt32 *dstBitOffsetP)
+ SYS_TRAP(netLibTrapBitGetUIntV);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif // __NETBITUTILS_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h
new file mode 100644
index 0000000..ba0064e
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/NetMgr.h
@@ -0,0 +1,1515 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1996-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetMgr.h
+ *
+ * Description:
+ * This module contains the interface definition for the TCP/IP
+ * library on Pilot.
+ *
+ * History:
+ * 2/14/96 Created by Ron Marianetti
+ * Name Date Description
+ * ---- ---- -----------
+ * jrb 3/13/98 Removed NetIFSettings that are Mobitex specific.
+ * Added RadioStateEnum for the setting.
+ * Added NetIFSettingSpecificMobitex
+ * Added what are considered "generic" wirless settings.
+ * jaq 10/1/98 added netMaxIPAddrStrLen constant
+ * scl 3/ 5/99 integrated Eleven's changes into Main
+ *
+ *****************************************************************************/
+
+#ifndef __NETMGR_H__
+#define __NETMGR_H__
+
+#include <PalmTypes.h>
+#include <LibTraps.h>
+#include <SysEvent.h>
+
+// Get rid of warnings about unused pragmas when compiling with
+// Visual C
+#ifdef _MSC_VER
+#pragma warning( disable : 4068)
+#endif
+
+/********************************************************************
+ * Type and creator of Net Library database
+ ********************************************************************/
+
+// Creator. Used for both the database that contains the Net Library and
+// it's preferences database.
+#define netCreator 'netl' // Our Net Library creator
+
+// Feature Creators and numbers, for use with the FtrGet() call. This
+// feature can be obtained to get the current version of the Net Library
+#define netFtrCreator netCreator
+#define netFtrNumVersion 0 // get version of Net Library
+ // 0xMMmfsbbb, where MM is major version, m is minor version
+ // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development,
+ // bbb is build number for non-releases
+ // V1.12b3 would be: 0x01122003
+ // V2.00a2 would be: 0x02001002
+ // V1.01 would be: 0x01013000
+
+
+// Types. Used to identify the Net Library from it's prefs.
+#define netLibType 'libr' // Our Net Code Resources Database type
+#define netPrefsType 'rsrc' // Our Net Preferences Database type
+
+
+// All Network interface's have the following type:
+#define netIFFileType 'neti' // The filetype of all Network Interfaces
+
+// Each Network interface has a unique creator:
+#define netIFCreatorLoop 'loop' // Loopback network interface creator.
+#define netIFCreatorSLIP 'slip' // SLIP network interface creator.
+#define netIFCreatorPPP 'ppp_' // PPP network interface creator.
+//<chg 1-28-98 RM>
+#define netIFCreatorRAM 'ram_' // Mobitex network interface creator
+
+
+// Special value for configIndex parameter to NetLibOpenConfig that tells it
+// to use the current settings - even if they are not the defined default settings
+// This is provided for testing purposes
+#define netConfigIndexCurSettings 0xFFFF
+
+// <SCL 3/5/99> Commented out netMaxNetIFs since Tim says it should NOT be here!!
+// Still need to fix (Eleven) code that currently depends on it...
+// Max # of interfaces that can be installed
+//#define netMaxNetIFs 4
+
+
+//-----------------------------------------------------------------------------
+// Misc. constants
+//-----------------------------------------------------------------------------
+#define netDrvrTypeNameLen 8 // Maximum driver type length
+#define netDrvrHWNameLen 16 // Maximum driver hardware name length
+#define netIFNameLen 10 // Maximum interface name (driver type + instance num)
+#define netIFMaxHWAddrLen 14 // Maximum size of a hardware address
+#define netMaxIPAddrStrLen 16 // Max length of an IP address string with null terminator (255.255.255.255)
+
+
+
+//-----------------------------------------------------------------------------
+// Names of built-in configuration aliases available through the
+// NetLibConfigXXX calls
+//-----------------------------------------------------------------------------
+#define netCfgNameDefault ".Default" // The default configuration
+#define netCfgNameDefWireline ".DefWireline" // The default wireline configuration
+#define netCfgNameDefWireless ".DefWireless" // The default wireless configuration
+#define netCfgNameCTPWireline ".CTPWireline" // Wireline through the Jerry Proxy
+#define netCfgNameCTPWireless ".CTPWireless" // Wireless through the Jerry Proxy
+
+
+//-----------------------------------------------------------------------------
+//Flags for the NetUWirelessAppHandleEvent() utility routine
+//-----------------------------------------------------------------------------
+#define netWLAppEventFlagCTPOnly 0x00000001 // using wireless radio for CTP protocol only
+#define netWLAppEventFlagDisplayErrs 0x00000002 // Show error alerts for any errors
+
+//-----------------------------------------------------------------------------
+// Option constants that can be passed to NetSocketOptionSet and NetSocketOptionGet
+// When an option is set or retrieved, both the level of the option and the
+// option number must be specified. The level refers to which layer the option
+// refers to, like the uppermost socket layer, for example.
+//-----------------------------------------------------------------------------
+
+// Socket level options
+typedef enum {
+ // IP Level options
+ netSocketOptIPOptions = 1, // options in IP header (IP_OPTIONS)
+
+ // TCP Level options
+ netSocketOptTCPNoDelay = 1, // don't delay send to coalesce packets
+ netSocketOptTCPMaxSeg = 2, // TCP maximum segment size (TCP_MAXSEG)
+
+ // Socket level options
+ netSocketOptSockDebug = 0x0001, // turn on debugging info recording
+ netSocketOptSockAcceptConn = 0x0002, // socket has had listen
+ netSocketOptSockReuseAddr = 0x0004, // allow local address reuse
+ netSocketOptSockKeepAlive = 0x0008, // keep connections alive
+ netSocketOptSockDontRoute = 0x0010, // just use interface addresses
+ netSocketOptSockBroadcast = 0x0020, // permit sending of broadcast msgs
+ netSocketOptSockUseLoopback = 0x0040, // bypass hardware when possible
+ netSocketOptSockLinger = 0x0080, // linger on close if data present
+ netSocketOptSockOOBInLine = 0x0100, // leave received OutOfBand data in line
+
+ netSocketOptSockSndBufSize = 0x1001, // send buffer size
+ netSocketOptSockRcvBufSize = 0x1002, // receive buffer size
+ netSocketOptSockSndLowWater = 0x1003, // send low-water mark
+ netSocketOptSockRcvLowWater = 0x1004, // receive low-water mark
+ netSocketOptSockSndTimeout = 0x1005, // send timeout
+ netSocketOptSockRcvTimeout = 0x1006, // receive timeout
+ netSocketOptSockErrorStatus= 0x1007, // get error status and clear
+ netSocketOptSockSocketType = 0x1008, // get socket type
+
+ // The following are Pilot specific options
+ netSocketOptSockNonBlocking = 0x2000, // set non-blocking mode on or off
+ netSocketOptSockRequireErrClear = 0x2001, // return error from all further calls to socket
+ // unless netSocketOptSockErrorStatus is cleared.
+ netSocketOptSockMultiPktAddr = 0x2002 // for SOCK_RDM (RMP) sockets. This is the
+ // fixed IP addr (i.e. Mobitex MAN #) to use
+ // for multiple packet requests.
+ } NetSocketOptEnum;
+
+
+
+
+// Option levels for SocketOptionSet and SocketOptionGet
+typedef enum {
+ netSocketOptLevelIP = 0, // IP level options (IPPROTO_IP)
+ netSocketOptLevelTCP = 6, // TCP level options (IPPROTO_TCP)
+ netSocketOptLevelSocket = 0xFFFF // Socket level options (SOL_SOCKET)
+ } NetSocketOptLevelEnum;
+
+
+// Structure used for manipulating the linger option
+typedef struct {
+ Int16 onOff; // option on/off
+ Int16 time; // linger time in seconds
+ } NetSocketLingerType;
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket domains and types passed to NetSocketOpen
+//-----------------------------------------------------------------------------
+typedef enum {
+ netSocketAddrRaw=0, // (AF_UNSPEC, AF_RAW)
+ netSocketAddrINET=2 // (AF_INET)
+ } NetSocketAddrEnum;
+
+typedef enum {
+ netSocketTypeStream=1, // (SOCK_STREAM)
+ netSocketTypeDatagram=2, // (SOCK_DGRAM)
+ netSocketTypeRaw=3, // (SOCK_RAW)
+ netSocketTypeReliableMsg=4, // (SOCK_RDM)
+ netSocketTypeLicensee=8 // Socket entry reserved for licensees.
+ } NetSocketTypeEnum;
+
+// Protocols, passed in the protocol parameter to NetLibSocketOpen
+#define netSocketProtoIPICMP 1 // IPPROTO_ICMP
+#define netSocketProtoIPTCP 6 // IPPROTO_TCP
+#define netSocketProtoIPUDP 17 // IPPROTO_UDP
+#define netSocketProtoIPRAW 255 // IPPROTO_RAW
+
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket direction, passed to NetSocketShutdown
+//-----------------------------------------------------------------------------
+typedef enum {
+ netSocketDirInput=0,
+ netSocketDirOutput=1,
+ netSocketDirBoth=2
+ } NetSocketDirEnum;
+
+
+//-----------------------------------------------------------------------------
+// Basic Types
+//-----------------------------------------------------------------------------
+// Socket refnum
+typedef Int16 NetSocketRef;
+
+// Type used to hold internet addresses
+typedef UInt32 NetIPAddr; // a 32-bit IP address.
+
+
+
+//-----------------------------------------------------------------------------
+// Structure used to hold an internet socket address. This includes the internet
+// address and the port number. This structure directly maps to the BSD unix
+// struct sockaddr_in.
+//-----------------------------------------------------------------------------
+typedef struct NetSocketAddrINType {
+ Int16 family; // Address family in HBO (Host UInt8 Order)
+ UInt16 port; // the UDP port in NBO (Network UInt8 Order)
+ NetIPAddr addr; // IP address in NBO (Network UInt8 Order)
+ } NetSocketAddrINType;
+
+// Constant that means "use the local machine's IP address"
+#define netIPAddrLocal 0 // Can be used in NetSockAddrINType.addr
+
+
+// Structure used to hold a generic socket address. This is a generic struct
+// designed to hold any type of address including internet addresses. This
+// structure directly maps to the BSD unix struct sockaddr.
+typedef struct NetSocketAddrType {
+ Int16 family; // Address family
+ UInt8 data[14]; // 14 bytes of address
+ } NetSocketAddrType;
+
+
+// Structure used to hold a raw socket address. When using the netSocketAddrRaw
+// protocol family, the caller must bind() the socket to an interface and
+// specifies the interface using this structure. IMPORTANT: NUMEROUS
+// ROUTINES IN NETLIB RELY ON THE FACT THAT THIS STRUCTURE IS THE SAME
+// SIZE AS A NetSocketAddrINType STRUCTURE.
+typedef struct NetSocketAddrRawType {
+ Int16 family; // Address family in HBO (Host UInt8 Order)
+ UInt16 ifInstance; // the interface instance number
+ UInt32 ifCreator; // the interface creator
+ } NetSocketAddrRawType;
+
+
+
+//-----------------------------------------------------------------------------
+// Structure used to hold information about data to be sent. This structure
+// is passed to NetLibSendMsg and contains the optional address to send to,
+// a scatter-write array of data to be sent, and optional access rights
+//-----------------------------------------------------------------------------
+
+// Scatter/Gather array type. A pointer to an array of these structs is
+// passed to the NetLibSendPB and NetLibRecvPB calls. It specifies where
+// data should go to or come from as a list of buffer addresses and sizes.
+typedef struct NetIOVecType {
+ UInt8 * bufP; // buffer address
+ UInt16 bufLen; // buffer length
+ } NetIOVecType, *NetIOVecPtr;
+
+#define netIOVecMaxLen 16 // max# of NetIOVecTypes in an array
+
+// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls.
+typedef struct {
+ UInt8 * addrP; // address - or 0 for default
+ UInt16 addrLen; // length of address
+ NetIOVecPtr iov; // scatter/gather array
+ UInt16 iovLen; // length of above array
+ UInt8 * accessRights; // access rights
+ UInt16 accessRightsLen; // length of accessrights
+ } NetIOParamType, *NetIOParamPtr;
+
+// Flags values for the NetLibSend, NetLibReceive calls
+#define netIOFlagOutOfBand 0x01 // process out-of-band data
+#define netIOFlagPeek 0x02 // peek at incoming message
+#define netIOFlagDontRoute 0x04 // send without using routing
+
+
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a host by name or address (NetLibGetHostByName)
+//-----------------------------------------------------------------------------
+
+// Equates for DNS names, from RFC-1035
+#define netDNSMaxDomainName 255
+#define netDNSMaxDomainLabel 63
+
+#define netDNSMaxAliases 1 // max # of aliases for a host
+#define netDNSMaxAddresses 4 // max # of addresses for a host
+
+
+// The actual results of NetLibGetHostByName() are returned in this structure.
+// This structure is designed to match the "struct hostent" structure in Unix.
+typedef struct {
+ Char * nameP; // official name of host
+ Char ** nameAliasesP; // array of alias's for the name
+ UInt16 addrType; // address type of return addresses
+ UInt16 addrLen; // the length, in bytes, of the addresses
+ UInt8 ** addrListP; // array of ptrs to addresses in HBO
+ } NetHostInfoType, *NetHostInfoPtr;
+
+
+// "Buffer" passed to call as a place to store the results
+typedef struct {
+ NetHostInfoType hostInfo; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // hostInfo points to
+ Char name[netDNSMaxDomainName+1]; // hostInfo->name
+
+ Char *aliasList[netDNSMaxAliases+1]; // +1 for 0 termination.
+ Char aliases[netDNSMaxAliases][netDNSMaxDomainName+1];
+
+ NetIPAddr* addressList[netDNSMaxAddresses];
+ NetIPAddr address[netDNSMaxAddresses];
+
+ } NetHostInfoBufType, *NetHostInfoBufPtr;
+
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a service (NetLibGetServByName)
+//-----------------------------------------------------------------------------
+
+// Equates for service names
+#define netServMaxName 15 // max # characters in service name
+#define netProtoMaxName 15 // max # characters in protocol name
+#define netServMaxAliases 1 // max # of aliases for a service
+
+
+// The actual results of NetLibGetServByName() are returned in this structure.
+// This structure is designed to match the "struct servent" structure in Unix.
+typedef struct {
+ Char * nameP; // official name of service
+ Char ** nameAliasesP; // array of alias's for the name
+ UInt16 port; // port number for this service
+ Char * protoP; // name of protocol to use
+ } NetServInfoType, *NetServInfoPtr;
+
+// "Buffer" passed to call as a place to store the results
+typedef struct {
+ NetServInfoType servInfo; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // servInfo points to
+ Char name[netServMaxName+1]; // hostInfo->name
+
+ Char * aliasList[netServMaxAliases+1]; // +1 for 0 termination.
+ Char aliases[netServMaxAliases][netServMaxName];
+ Char protoName[netProtoMaxName+1];
+
+ UInt8 reserved;
+ } NetServInfoBufType, *NetServInfoBufPtr;
+
+
+
+//--------------------------------------------------------------------
+// Structure of a configuration name. Used by NetLibConfigXXX calls
+// <chg 1-28-98 RM> added for the new Config calls.
+//---------------------------------------------------------------------
+#define netConfigNameSize 32
+typedef struct {
+ Char name[netConfigNameSize]; // name of configuration
+ } NetConfigNameType, *NetConfigNamePtr;
+
+
+
+/********************************************************************
+ * Tracing Flags. These flags are ORed together and passed as a UInt32
+ * in the netSettingTraceFlags setting and netIFSettingTraceFlags to
+ * enable/disable various trace options.
+ ********************************************************************/
+#define netTracingErrors 0x00000001 // record errors
+#define netTracingMsgs 0x00000002 // record messages
+#define netTracingPktIP 0x00000004 // record packets sent/received
+ // to/from interfaces at the IP layer
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingFuncs 0x00000008 // record function flow
+#define netTracingAppMsgs 0x00000010 // record application messages
+ // (NetLibTracePrintF, NetLibTracePutS)
+#define netTracingPktData40 0x00000020 // record first 40 bytes of packets
+ // when netTracingPktsXX is also on.
+ // NOTE: Mutually exclusive with
+ // netTracingPktData and only applicable if
+ // one of the netTracingPktsXX bits is also set
+#define netTracingPktData 0x00000040 // record all bytes of IP packets
+ // sent/received to/from interfaces
+ // NOTE: Mutually exclusive with
+ // netTracingPkts & netTracingPktData64
+#define netTracingPktIFHi 0x00000080 // record packets sent/received at highest layer
+ // of interface (just below IP layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingPktIFMid 0x00000100 // record packets sent/received at mid layer
+ // of interface (just below IFHi layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+#define netTracingPktIFLow 0x00000200 // record packets sent/received at low layer
+ // of interface (just below IFMid layer).
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+
+
+// OBSOLETE tracing bit, still used by Network Panel
+#define netTracingPkts netTracingPktIP
+
+
+/********************************************************************
+ * Command numbers and parameter blocks for the NetLibMaster() call.
+ * This call is used to put the Net library into certain debugging modes
+ * or for obtaining statistics from the Net Library.
+ *
+ ********************************************************************/
+#pragma mark Master
+typedef enum {
+ // These calls return info
+ netMasterInterfaceInfo,
+ netMasterInterfaceStats,
+ netMasterIPStats,
+ netMasterICMPStats,
+ netMasterUDPStats,
+ netMasterTCPStats,
+
+ // This call used to read the trace buffer.
+ netMasterTraceEventGet // get trace event by index
+
+ } NetMasterEnum;
+
+
+typedef struct NetMasterPBType {
+
+ // These fields are specific to each command
+ union {
+
+ //.............................................................
+ // InterfaceInfo command
+ //.............................................................
+ struct {
+ UInt16 index; // -> index of interface
+ UInt32 creator; // <- creator
+ UInt16 instance; // <- instance
+ void * netIFP; // <- net_if pointer
+
+ // driver level info
+ Char drvrName[netDrvrTypeNameLen]; // <- type of driver (SLIP,PPP, etc)
+ Char hwName[netDrvrHWNameLen]; // <- hardware name (Serial Library, etc)
+ UInt8 localNetHdrLen; // <- local net header length
+ UInt8 localNetTrailerLen; // <- local net trailer length
+ UInt16 localNetMaxFrame; // <- local net maximum frame size
+
+ // media layer info
+ Char ifName[netIFNameLen];// <- interface name w/instance
+ Boolean driverUp; // <- true if interface driver up
+ Boolean ifUp; // <- true if interface is up
+ UInt16 hwAddrLen; // <- length of hardware address
+ UInt8 hwAddr[netIFMaxHWAddrLen]; // <- hardware address
+ UInt16 mtu; // <- maximum transfer unit of interface
+ UInt32 speed; // <- speed in bits/sec.
+ UInt32 lastStateChange; // <- time in milliseconds of last state change
+
+ // Address info
+ NetIPAddr ipAddr; // Address of this interface
+ NetIPAddr subnetMask; // subnet mask of local network
+ NetIPAddr broadcast; // broadcast address of local network
+ } interfaceInfo;
+
+ //.............................................................
+ // InterfaceStats command
+ //.............................................................
+ struct {
+ UInt16 index; // -> index of interface
+ UInt32 inOctets; // <- ....
+ UInt32 inUcastPkts;
+ UInt32 inNUcastPkts;
+ UInt32 inDiscards;
+ UInt32 inErrors;
+ UInt32 inUnknownProtos;
+ UInt32 outOctets;
+ UInt32 outUcastPkts;
+ UInt32 outNUcastPkts;
+ UInt32 outDiscards;
+ UInt32 outErrors;
+ } interfaceStats;
+
+ //.............................................................
+ // IPStats command
+ //.............................................................
+ struct {
+ UInt32 ipInReceives;
+ UInt32 ipInHdrErrors;
+ UInt32 ipInAddrErrors;
+ UInt32 ipForwDatagrams;
+ UInt32 ipInUnknownProtos;
+ UInt32 ipInDiscards;
+ UInt32 ipInDelivers;
+ UInt32 ipOutRequests;
+ UInt32 ipOutDiscards;
+ UInt32 ipOutNoRoutes;
+ UInt32 ipReasmReqds;
+ UInt32 ipReasmOKs;
+ UInt32 ipReasmFails;
+ UInt32 ipFragOKs;
+ UInt32 ipFragFails;
+ UInt32 ipFragCreates;
+ UInt32 ipRoutingDiscards;
+ UInt32 ipDefaultTTL;
+ UInt32 ipReasmTimeout;
+ } ipStats;
+
+ //.............................................................
+ // ICMPStats command
+ //.............................................................
+ struct {
+ UInt32 icmpInMsgs;
+ UInt32 icmpInErrors;
+ UInt32 icmpInDestUnreachs;
+ UInt32 icmpInTimeExcds;
+ UInt32 icmpInParmProbs;
+ UInt32 icmpInSrcQuenchs;
+ UInt32 icmpInRedirects;
+ UInt32 icmpInEchos;
+ UInt32 icmpInEchoReps;
+ UInt32 icmpInTimestamps;
+ UInt32 icmpInTimestampReps;
+ UInt32 icmpInAddrMasks;
+ UInt32 icmpInAddrMaskReps;
+ UInt32 icmpOutMsgs;
+ UInt32 icmpOutErrors;
+ UInt32 icmpOutDestUnreachs;
+ UInt32 icmpOutTimeExcds;
+ UInt32 icmpOutParmProbs;
+ UInt32 icmpOutSrcQuenchs;
+ UInt32 icmpOutRedirects;
+ UInt32 icmpOutEchos;
+ UInt32 icmpOutEchoReps;
+ UInt32 icmpOutTimestamps;
+ UInt32 icmpOutTimestampReps;
+ UInt32 icmpOutAddrMasks;
+ UInt32 icmpOutAddrMaskReps;
+ } icmpStats;
+
+ //.............................................................
+ // UDPStats command
+ //.............................................................
+ struct {
+ UInt32 udpInDatagrams;
+ UInt32 udpNoPorts;
+ UInt32 udpInErrors;
+ UInt32 udpOutDatagrams;
+ } udpStats;
+
+ //.............................................................
+ // TCPStats command
+ //.............................................................
+ struct {
+ UInt32 tcpRtoAlgorithm;
+ UInt32 tcpRtoMin;
+ UInt32 tcpRtoMax;
+ UInt32 tcpMaxConn;
+ UInt32 tcpActiveOpens;
+ UInt32 tcpPassiveOpens;
+ UInt32 tcpAttemptFails;
+ UInt32 tcpEstabResets;
+ UInt32 tcpCurrEstab;
+ UInt32 tcpInSegs;
+ UInt32 tcpOutSegs;
+ UInt32 tcpRetransSegs;
+ UInt32 tcpInErrs;
+ UInt32 tcpOutRsts;
+ } tcpStats;
+
+ //.............................................................
+ // TraceEventGet command
+ //.............................................................
+ struct {
+ UInt16 index; // which event
+ Char * textP; // ptr to text string to return it in
+ } traceEventGet;
+
+ } param;
+
+ } NetMasterPBType, *NetMasterPBPtr;
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// Enumeration of Net settings as passed to NetLibSettingGet/Set.
+//-----------------------------------------------------------------------------
+#pragma mark Settings
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Global environment settings common to all attached network interfaces,
+// passed to NetLibSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+typedef enum {
+ netSettingResetAll, // void, NetLibSettingSet only, resets all settings
+ // to their defaults.
+
+ netSettingPrimaryDNS, // UInt32, IP address of Primary DN Server
+ netSettingSecondaryDNS, // UInt32, IP address of Secondary DN Server
+ netSettingDefaultRouter, // UInt32, IP address of Default router
+ netSettingDefaultIFCreator, // UInt32, Creator type of default interface
+ netSettingDefaultIFInstance, // UInt16, Instance# of default interface
+ netSettingHostName, // Char[64], name of host (not including domain)
+ netSettingDomainName, // Char[256], domain name of hosts's domain
+ netSettingHostTbl, // Char[], host table
+ netSettingCloseWaitTime, // UInt32, time in milliseconds to stay in close-wait state
+ netSettingInitialTCPResendTime, // UInt32, time in milliseconds before TCP resends a packet.
+ // This is just the initial value, the timeout is adjusted
+ // from this initial value depending on history of ACK times.
+ // This is sometimes referred to as the RTO (Roundtrip Time Out)
+ // See RFC-1122 for additional information.
+
+
+ // The following settings are not used for configuration, but rather put the
+ // stack into various modes for debugging, etc.
+ netSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netSettingTraceSize, // UInt32, max trace buffer size in bytes. Default 0x800.
+ // Setting this will also clear the trace buffer.
+ netSettingTraceStart, // UInt32, for internal use ONLY!!
+ netSettingTraceRoll, // UInt8, if true, trace buffer will rollover after it fills.
+ // Default is true.
+
+ netSettingRTPrimaryDNS, // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+ netSettingRTSecondaryDNS, // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+
+ netSettingConfigTable // used internally by NetLib - NOT FOR USE BY
+ // APPLICATIONS!!
+
+ } NetSettingEnum;
+
+
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Settings for each Network Interface, passed to NetLibIFSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+typedef enum {
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Reset all settings to defaults
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingResetAll, // void, NetLibIFSettingSet only, resets all settings
+ // to their defaults.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Status - read only
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUp, // UInt8, true if interface is UP.
+ netIFSettingName, // Char[32], name of interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Addressing
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingReqIPAddr, // UInt32, requested IP address of this interface
+ netIFSettingSubnetMask, // UInt32, subnet mask of this interface
+ netIFSettingBroadcast, // UInt32, broadcast address for this interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // User Info
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUsername, // Char[], login script user name
+ // If 0 length, then user will be prompted for it
+ netIFSettingPassword, // Char[], login script user password
+ // If 0 length, then user will be prompted for it
+ netIFSettingDialbackUsername, // Char[], login script dialback user name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingDialbackPassword, // Char[], login script dialback user password.
+ // If 0 length, then user will be prompted for it
+ netIFSettingAuthUsername, // Char[], PAP/CHAP name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingAuthPassword, // Char[], PAP/CHAP password.
+ // If "$", then user will be prompted for it
+ // else If 0 length, then netIFSettingPassword or result
+ // of it's prompt (if it was empty) will be used
+ // else it is used as-is.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Connect Settings
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingServiceName, // Char[], name of service
+ netIFSettingLoginScript, // Char[], login script
+ netIFSettingConnectLog, // Char[], connect log
+ netIFSettingInactivityTimeout, // UInt16, # of seconds of inactivity allowed before
+ // interface is brought down. If 0 then
+ // no inactivity timeout enforced.
+ netIFSettingEstablishmentTimeout, // UInt16, max delay in seconds between connection
+ // establishment stages
+
+ // Serial based protocol options
+ netIFSettingDynamicIP, // UInt8, if true, get IP address from server
+ // N/A for SLIP
+ netIFSettingVJCompEnable, // UInt8, if true enable VJ Header compression
+ // Default is on for PPP, off for SLIP
+ netIFSettingVJCompSlots, // UInt8, # of slots to use for VJ compression.
+ // Default is 4 for PPP, 16 for SLIP
+ // (each slot uses 256 bytes of RAM).
+ netIFSettingMTU, // UInt16, maximum transmission unit in bytes
+ // ignored in current PPP and SLIP interfaces
+ netIFSettingAsyncCtlMap, // UInt32, bitmask of characters to escape
+ // ignored in current PPP interfaces
+
+ // Serial settings, used by serial based network interfaces
+ netIFSettingPortNum, // UInt16, port number to use
+ netIFSettingBaudRate, // UInt32, baud rate in bits/sec.
+ netIFSettingFlowControl, // UInt8, flow control setting bits. Set to 0x01 for
+ // hardware flow control, else set to 0x00.
+ netIFSettingStopBits, // UInt8, # of stop bits
+ netIFSettingParityOn, // UInt8, true if parity on
+ netIFSettingParityEven, // UInt8, true if parity even
+
+ // Modem settings, optionally used by serial based network interfaces
+ netIFSettingUseModem, // UInt8, if true dial-up through modem
+ netIFSettingPulseDial, // UInt8, if true use pulse dial, else tone
+ netIFSettingModemInit, // Char[], modem initialization string
+ netIFSettingModemPhone, // Char[], modem phone number string
+ netIFSettingRedialCount, // UInt16, # of times to redial
+
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.0
+ // Power control, usually only implemented by wireless interfaces
+ //---------------------------------------------------------------------------------
+ netIFSettingPowerUp, // UInt8, true if this interface is powered up
+ // false if this interface is in power-down mode
+ // interfaces that don't support power modes should
+ // quietly ignore this setting.
+
+ // Wireless or Wireline, read-only, returns true for wireless interfaces. this
+ // setting is used by application level functions to determine which interface(s)
+ // to attach/detach given user preference and/or state of the antenna.
+ netIFSettingWireless, // UInt8, true if this interface is wireless
+
+
+
+ // Option to query server for address of DNS servers
+ netIFSettingDNSQuery, // UInt8, if true PPP queries for DNS address. Default true
+
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.2
+ // Power control, usually only implemented by wireless interfaces
+ //---------------------------------------------------------------------------------
+
+ netIFSettingQuitOnTxFail, // BYTE W-only. Power down RF on tx fail
+ netIFSettingQueueSize, // UInt8 R-only. The size of the Tx queue in the RF interface
+ netIFSettingTxInQueue, // BYTE R-only. Packets remaining to be sent
+ netIFSettingTxSent, // BYTE R-only. Packets sent since SocketOpen
+ netIFSettingTxDiscard, // BYTE R-only. Packets discarded on SocketClose
+ netIFSettingRssi, // char R-only. signed value in dBm.
+ netIFSettingRssiAsPercent, // char R-only. signed value in percent, with 0 being no coverage and 100 being excellent.
+ netIFSettingRadioState, // enum R-only. current state of the radio
+ netIFSettingBase, // UInt32 R-only. Interface specific
+ netIFSettingRadioID, // UInt32[2] R-only, two 32-bit. interface specific
+ netIFSettingBattery, // UInt8, R-only. percentage of battery left
+ netIFSettingNetworkLoad, // UInt8, R-only. percent estimate of network loading
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.3
+ //---------------------------------------------------------------------------------
+
+ netIFSettingConnectionName, // Char [] Connection Profile Name
+
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // The following settings are not used for configuration, but rather put the
+ // stack into various modes for debugging, etc.
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingTraceBits = 0x1000, // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netIFSettingGlobalsPtr, // UInt32, (Read-Only) sinterface's globals ptr
+ netIFSettingActualIPAddr, // UInt32, (Read-Only) the actual IP address that the interface
+ // ends up using. The login script executor stores
+ // the result of the "g" script command here as does
+ // the PPP negotiations.
+ netIFSettingServerIPAddr, // UInt32, (Read-Only) the IP address of the PPP server
+ // we're connected to
+
+
+ // The following setting should be true if this network interface should be
+ // brought down when the Pilot is turned off.
+ netIFSettingBringDownOnPowerDown, // UInt8, if true interface will be brought down when
+ // Pilot is turned off.
+
+ // The following setting is used by the TCP/IP stack ONLY!! It tells the interface
+ // to pass all received packets as-is to the NetIFCallbacksPtr->raw_rcv() routine.
+ // This setting gets setup when an application creates a raw socket in the raw domain
+ netIFSettingRawMode, // UInt32, parameter to pass to raw_rcv() along with
+ // packet pointer.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // 3rd party settings start here...
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingCustom = 0x8000
+
+ } NetIFSettingEnum;
+
+
+
+//=========================================================================================
+// Enums for the netIFSettingRadioState setting
+//
+// JB added for the radio state setting.
+// <chg 3-17-98 RM> fixed naming conventions.
+//=========================================================================================
+typedef enum {
+ netRadioStateOffNotConnected=0,
+ netRadioStateOnNotConnected, // scanning
+ netRadioStateOnConnected, // have channel
+ netRadioStateOffConnected
+ } NetRadioStateEnum;
+
+
+
+/************************************************************
+ * Net Library Macros
+ *************************************************************/
+// Return current time in milliseconds.
+#define NetNow() (TimGetTicks() * 1000L/sysTicksPerSecond)
+
+
+// File Descriptor macros used for the NetLibSelect() call
+typedef UInt32 NetFDSetType;
+#define netFDSetSize 32
+
+#define netFDSet(n,p) ((*p) |= (1L << n))
+#define netFDClr(n,p) ((*p) &= ~(1L << n))
+#define netFDIsSet(n,p) ((*p) & (1L << n))
+#define netFDZero(p) ((*p) = 0)
+
+
+
+//-----------------------------------------------------------------------------
+// Net error codes
+//-----------------------------------------------------------------------------
+#pragma mark ErrorCodes
+#define netErrAlreadyOpen (netErrorClass | 1)
+#define netErrNotOpen (netErrorClass | 2)
+#define netErrStillOpen (netErrorClass | 3)
+#define netErrParamErr (netErrorClass | 4)
+#define netErrNoMoreSockets (netErrorClass | 5)
+#define netErrOutOfResources (netErrorClass | 6)
+#define netErrOutOfMemory (netErrorClass | 7)
+#define netErrSocketNotOpen (netErrorClass | 8)
+#define netErrSocketBusy (netErrorClass | 9) //EINPROGRESS
+#define netErrMessageTooBig (netErrorClass | 10)
+#define netErrSocketNotConnected (netErrorClass | 11)
+#define netErrNoInterfaces (netErrorClass | 12) //ENETUNREACH
+#define netErrBufTooSmall (netErrorClass | 13)
+#define netErrUnimplemented (netErrorClass | 14)
+#define netErrPortInUse (netErrorClass | 15) //EADDRINUSE
+#define netErrQuietTimeNotElapsed (netErrorClass | 16) //EADDRINUSE
+#define netErrInternal (netErrorClass | 17)
+#define netErrTimeout (netErrorClass | 18) //ETIMEDOUT
+#define netErrSocketAlreadyConnected (netErrorClass | 19) //EISCONN
+#define netErrSocketClosedByRemote (netErrorClass | 20)
+#define netErrOutOfCmdBlocks (netErrorClass | 21)
+#define netErrWrongSocketType (netErrorClass | 22)
+#define netErrSocketNotListening (netErrorClass | 23)
+#define netErrUnknownSetting (netErrorClass | 24)
+#define netErrInvalidSettingSize (netErrorClass | 25)
+#define netErrPrefNotFound (netErrorClass | 26)
+#define netErrInvalidInterface (netErrorClass | 27)
+#define netErrInterfaceNotFound (netErrorClass | 28)
+#define netErrTooManyInterfaces (netErrorClass | 29)
+#define netErrBufWrongSize (netErrorClass | 30)
+#define netErrUserCancel (netErrorClass | 31)
+#define netErrBadScript (netErrorClass | 32)
+#define netErrNoSocket (netErrorClass | 33)
+#define netErrSocketRcvBufFull (netErrorClass | 34)
+#define netErrNoPendingConnect (netErrorClass | 35)
+#define netErrUnexpectedCmd (netErrorClass | 36)
+#define netErrNoTCB (netErrorClass | 37)
+#define netErrNilRemoteWindowSize (netErrorClass | 38)
+#define netErrNoTimerProc (netErrorClass | 39)
+#define netErrSocketInputShutdown (netErrorClass | 40) // EOF to sockets API
+#define netErrCmdBlockNotCheckedOut (netErrorClass | 41)
+#define netErrCmdNotDone (netErrorClass | 42)
+#define netErrUnknownProtocol (netErrorClass | 43)
+#define netErrUnknownService (netErrorClass | 44)
+#define netErrUnreachableDest (netErrorClass | 45)
+#define netErrReadOnlySetting (netErrorClass | 46)
+#define netErrWouldBlock (netErrorClass | 47) //EWOULDBLOCK
+#define netErrAlreadyInProgress (netErrorClass | 48) //EALREADY
+#define netErrPPPTimeout (netErrorClass | 49)
+#define netErrPPPBroughtDown (netErrorClass | 50)
+#define netErrAuthFailure (netErrorClass | 51)
+#define netErrPPPAddressRefused (netErrorClass | 52)
+// The following map into the Epilogue DNS errors declared in DNS.ep.h:
+// and MUST be kept in this order!!
+#define netErrDNSNameTooLong (netErrorClass | 53)
+#define netErrDNSBadName (netErrorClass | 54)
+#define netErrDNSBadArgs (netErrorClass | 55)
+#define netErrDNSLabelTooLong (netErrorClass | 56)
+#define netErrDNSAllocationFailure (netErrorClass | 57)
+#define netErrDNSTimeout (netErrorClass | 58)
+#define netErrDNSUnreachable (netErrorClass | 59)
+#define netErrDNSFormat (netErrorClass | 60)
+#define netErrDNSServerFailure (netErrorClass | 61)
+#define netErrDNSNonexistantName (netErrorClass | 62)
+#define netErrDNSNIY (netErrorClass | 63)
+#define netErrDNSRefused (netErrorClass | 64)
+#define netErrDNSImpossible (netErrorClass | 65)
+#define netErrDNSNoRRS (netErrorClass | 66)
+#define netErrDNSAborted (netErrorClass | 67)
+#define netErrDNSBadProtocol (netErrorClass | 68)
+#define netErrDNSTruncated (netErrorClass | 69)
+#define netErrDNSNoRecursion (netErrorClass | 70)
+#define netErrDNSIrrelevant (netErrorClass | 71)
+#define netErrDNSNotInLocalCache (netErrorClass | 72)
+#define netErrDNSNoPort (netErrorClass | 73)
+// The following map into the Epilogue IP errors declared in IP.ep.h:
+// and MUST be kept in this order!!
+#define netErrIPCantFragment (netErrorClass | 74)
+#define netErrIPNoRoute (netErrorClass | 75)
+#define netErrIPNoSrc (netErrorClass | 76)
+#define netErrIPNoDst (netErrorClass | 77)
+#define netErrIPktOverflow (netErrorClass | 78)
+// End of Epilogue IP errors
+#define netErrTooManyTCPConnections (netErrorClass | 79)
+#define netErrNoDNSServers (netErrorClass | 80)
+#define netErrInterfaceDown (netErrorClass | 81)
+
+// Mobitex network radio interface error code returns
+#define netErrNoChannel (netErrorClass | 82) // The datalink layer cannot acquire a channel
+#define netErrDieState (netErrorClass | 83) // Mobitex network has issued a DIE command.
+#define netErrReturnedInMail (netErrorClass | 84) // The addressed of the transmitted packet was not available, and the message was placed in the network's mailbox.
+#define netErrReturnedNoTransfer (netErrorClass | 85) // This message cannot be transferred or put in the network mailbox.
+#define netErrReturnedIllegal (netErrorClass | 86) // The message could not be switched to the network
+#define netErrReturnedCongest (netErrorClass | 87) // Line, radio channels, or network nodes are congested.
+#define netErrReturnedError (netErrorClass | 88) // Technical error in the network.
+#define netErrReturnedBusy (netErrorClass | 89) // The B-party is busy.
+#define netErrGMANState (netErrorClass | 90) // The modem has not registered with the network.
+#define netErrQuitOnTxFail (netErrorClass | 91) // Couldn't get packet through, shutdown.
+#define netErrFlexListFull (netErrorClass | 92) // raw IF error message: see Mobitex spec.
+#define netErrSenderMAN (netErrorClass | 93) // ditto
+#define netErrIllegalType (netErrorClass | 94) // ditto
+#define netErrIllegalState (netErrorClass | 95) // ditto
+#define netErrIllegalFlags (netErrorClass | 96) // ditto
+#define netErrIllegalSendlist (netErrorClass | 97) // ditto
+#define netErrIllegalMPAKLength (netErrorClass | 98) // ditto
+#define netErrIllegalAddressee (netErrorClass | 99) // ditto
+#define netErrIllegalPacketClass (netErrorClass | 100) // ditto
+#define netErrBufferLength (netErrorClass | 101) // any
+#define netErrNiCdLowBattery (netErrorClass | 102) // any
+#define netErrRFinterfaceFatal (netErrorClass | 103) // any
+#define netErrIllegalLogout (netErrorClass | 104) // raw IF error message
+#define netErrAAARadioLoad (netErrorClass | 105) // 7/20/98 JB. If there is insufficient AAA
+#define netErrAntennaDown (netErrorClass | 106)
+#define netErrNiCdCharging (netErrorClass | 107) // just for charging
+#define netErrAntennaWentDown (netErrorClass | 108)
+#define netErrNotActivated (netErrorClass | 109) // The unit has not been FULLY activated. George and Morty completed.
+#define netErrRadioTemp (netErrorClass | 110) // Radio's temp is too high for FCC compliant TX
+#define netErrNiCdChargeError (netErrorClass | 111) // Charging stopped due to NiCd charging characteristic
+#define netErrNiCdSag (netErrorClass | 112) // the computed sag or actual sag indicates a NiCd with diminished capacity.
+#define netErrNiCdChargeSuspend (netErrorClass | 113) // Charging has been suspended due to low AAA batteries.
+// Left room for more Mobitex errors
+
+// Configuration errors
+#define netErrConfigNotFound (netErrorClass | 115)
+#define netErrConfigCantDelete (netErrorClass | 116)
+#define netErrConfigTooMany (netErrorClass | 117)
+#define netErrConfigBadName (netErrorClass | 118)
+#define netErrConfigNotAlias (netErrorClass | 119)
+#define netErrConfigCantPointToAlias (netErrorClass | 120)
+#define netErrConfigEmpty (netErrorClass | 121)
+#define netErrAlreadyOpenWithOtherConfig (netErrorClass | 122)
+#define netErrConfigAliasErr (netErrorClass | 123)
+#define netErrNoMultiPktAddr (netErrorClass | 124)
+#define netErrOutOfPackets (netErrorClass | 125)
+#define netErrMultiPktAddrReset (netErrorClass | 126)
+#define netErrStaleMultiPktAddr (netErrorClass | 127)
+
+// Login scripting plugin errors
+#define netErrScptPluginMissing (netErrorClass | 128)
+#define netErrScptPluginLaunchFail (netErrorClass | 129)
+#define netErrScptPluginCmdFail (netErrorClass | 130)
+#define netErrScptPluginInvalidCmd (netErrorClass | 131)
+
+#define netErrMobitexStart netErrNoChannel
+#define netErrMobitexEnd netErrNiCdChargeSuspend
+
+//-----------------------------------------------------------------------------
+// Net library call ID's. Each library call gets the trap number:
+// netTrapXXXX which serves as an index into the library's dispatch table.
+// The constant sysLibTrapCustom is the first available trap number after
+// the system predefined library traps Open,Close,Sleep & Wake.
+//
+// WARNING!!! This order of these traps MUST match the order of the dispatch
+// table in NetDispatch.c!!!
+//-----------------------------------------------------------------------------
+#pragma mark Traps
+typedef enum {
+ netLibTrapAddrINToA = sysLibTrapCustom,
+ netLibTrapAddrAToIN,
+
+ netLibTrapSocketOpen,
+ netLibTrapSocketClose,
+ netLibTrapSocketOptionSet,
+ netLibTrapSocketOptionGet,
+ netLibTrapSocketBind,
+ netLibTrapSocketConnect,
+ netLibTrapSocketListen,
+ netLibTrapSocketAccept,
+ netLibTrapSocketShutdown,
+
+ netLibTrapSendPB,
+ netLibTrapSend,
+ netLibTrapReceivePB,
+ netLibTrapReceive,
+ netLibTrapDmReceive,
+ netLibTrapSelect,
+
+ netLibTrapPrefsGet,
+ netLibTrapPrefsSet,
+
+ // The following traps are for internal and Network interface
+ // use only.
+ netLibTrapDrvrWake,
+ netLibTrapInterfacePtr,
+ netLibTrapMaster,
+
+ // New Traps
+ netLibTrapGetHostByName,
+ netLibTrapSettingGet,
+ netLibTrapSettingSet,
+ netLibTrapIFAttach,
+ netLibTrapIFDetach,
+ netLibTrapIFGet,
+ netLibTrapIFSettingGet,
+ netLibTrapIFSettingSet,
+ netLibTrapIFUp,
+ netLibTrapIFDown,
+ netLibTrapIFMediaUp,
+ netLibTrapScriptExecuteV32,
+ netLibTrapGetHostByAddr,
+ netLibTrapGetServByName,
+ netLibTrapSocketAddr,
+ netLibTrapFinishCloseWait,
+ netLibTrapGetMailExchangeByName,
+ netLibTrapPrefsAppend,
+ netLibTrapIFMediaDown,
+ netLibTrapOpenCount,
+
+ netLibTrapTracePrintF,
+ netLibTrapTracePutS,
+
+ netLibTrapOpenIfCloseWait,
+ netLibTrapHandlePowerOff,
+
+ netLibTrapConnectionRefresh,
+
+ // Traps added after 1.0 release of NetLib
+ netLibTrapBitMove,
+ netLibTrapBitPutFixed,
+ netLibTrapBitGetFixed,
+ netLibTrapBitPutUIntV,
+ netLibTrapBitGetUIntV,
+ netLibTrapBitPutIntV,
+ netLibTrapBitGetIntV,
+
+ // Traps added after 2.0 release of NetLib
+ netLibOpenConfig,
+ netLibConfigMakeActive,
+ netLibConfigList,
+ netLibConfigIndexFromName,
+ netLibConfigDelete,
+ netLibConfigSaveAs,
+ netLibConfigRename,
+ netLibConfigAliasSet,
+ netLibConfigAliasGet,
+
+ // Traps added after 3.2 release of NetLib
+ netLibTrapScriptExecute,
+
+ netLibTrapLast
+ } NetLibTrapNumberEnum;
+
+
+
+/************************************************************
+ * Net Library procedures.
+ *************************************************************/
+#pragma mark Functions
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+Err NetLibOpen (UInt16 libRefnum, UInt16 *netIFErrsP)
+ SYS_TRAP(sysLibTrapOpen);
+
+Err NetLibClose (UInt16 libRefnum, UInt16 immediate)
+ SYS_TRAP(sysLibTrapClose);
+
+Err NetLibSleep (UInt16 libRefnum)
+ SYS_TRAP(sysLibTrapSleep);
+
+Err NetLibWake (UInt16 libRefnum)
+ SYS_TRAP(sysLibTrapWake);
+
+
+// This call forces the library to complete a close if it's
+// currently in the close-wait state. Returns 0 if library is closed,
+// Returns netErrFullyOpen if library is still open by some other task.
+Err NetLibFinishCloseWait(UInt16 libRefnum)
+ SYS_TRAP(netLibTrapFinishCloseWait);
+
+// This call is for use by the Network preference panel only. It
+// causes the NetLib to fully open if it's currently in the close-wait
+// state. If it's not in the close wait state, it returns an error code
+Err NetLibOpenIfCloseWait(UInt16 libRefnum)
+ SYS_TRAP(netLibTrapOpenIfCloseWait);
+
+// Get the open Count of the NetLib
+Err NetLibOpenCount (UInt16 refNum, UInt16 *countP)
+ SYS_TRAP(netLibTrapOpenCount);
+
+// Give NetLib a chance to close the connection down in response
+// to a power off event. Returns non-zero if power should not be
+// turned off. EventP points to the event that initiated the power off
+// which is either a keyDownEvent of the hardPowerChr or the autoOffChr.
+// Don't include unless building for Viewer
+#ifdef __SYSEVENT_H__
+Err NetLibHandlePowerOff (UInt16 refNum, SysEventType *eventP)
+ SYS_TRAP(netLibTrapHandlePowerOff);
+#endif
+
+
+// Check status or try and reconnect any interfaces which have come down.
+// This call can be made by applications when they suspect that an interface
+// has come down (like PPP or SLIP). NOTE: This call can display UI
+// (if 'refresh' is true) so it MUST be called from the UI task.
+Err NetLibConnectionRefresh(UInt16 refNum, Boolean refresh,
+ UInt8 *allInterfacesUpP, UInt16 *netIFErrP)
+ SYS_TRAP(netLibTrapConnectionRefresh);
+
+
+
+//--------------------------------------------------
+// Net address translation and conversion routines.
+//--------------------------------------------------
+
+// convert host Int16 to network Int16
+#define NetHToNS(x) (x)
+
+// convert host long to network long
+#define NetHToNL(x) (x)
+
+// convert network Int16 to host Int16
+#define NetNToHS(x) (x)
+
+// convert network long to host long
+#define NetNToHL(x) (x)
+
+// Convert 32-bit IP address to ascii dotted decimal form. The Sockets glue
+// macro inet_ntoa will pass the address of an application global string in
+// spaceP.
+Char * NetLibAddrINToA(UInt16 libRefnum, NetIPAddr inet, Char *spaceP)
+ SYS_TRAP(netLibTrapAddrINToA);
+
+// Convert a dotted decimal ascii string format of an IP address into
+// a 32-bit value.
+NetIPAddr NetLibAddrAToIN(UInt16 libRefnum, Char *a)
+ SYS_TRAP(netLibTrapAddrAToIN);
+
+
+
+//--------------------------------------------------
+// Socket creation and option setting
+//--------------------------------------------------
+
+// Create a socket and return a refnum to it. Protocol is normally 0.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+NetSocketRef NetLibSocketOpen(UInt16 libRefnum, NetSocketAddrEnum domain,
+ NetSocketTypeEnum type, Int16 protocol, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketOpen);
+
+// Close a socket.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketClose(UInt16 libRefnum, NetSocketRef socket, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketClose);
+
+// Set a socket option. Level is usually netSocketOptLevelSocket. Option is one of
+// netSocketOptXXXXX. OptValueP is a pointer to the new value and optValueLen is
+// the length of the option value.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketOptionSet(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option,
+ void *optValueP, UInt16 optValueLen,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketOptionSet);
+
+// Get a socket option.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketOptionGet(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 /*NetSocketOptLevelEnum*/ level, UInt16 /*NetSocketOptEnum*/ option,
+ void *optValueP, UInt16 *optValueLenP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketOptionGet);
+
+
+//--------------------------------------------------
+// Socket Control
+//--------------------------------------------------
+
+// Bind a source address and port number to a socket. This makes the
+// socket accept incoming packets destined for the given socket address.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketBind(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketBind);
+
+
+// Connect to a remote socket. For a stream based socket (i.e. TCP), this initiates
+// a 3-way handshake with the remote machine to establish a connection. For
+// non-stream based socket, this merely specifies a destination address and port
+// number for future outgoing packets from this socket.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketConnect(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 addrLen, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketConnect);
+
+
+// Makes a socket ready to accept incoming connection requests. The queueLen
+// specifies the max number of pending connection requests that will be enqueued
+// while the server is busy handling other requests.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketListen(UInt16 libRefnum, NetSocketRef socket,
+ UInt16 queueLen, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketListen);
+
+
+// Blocks the current process waiting for an incoming connection request. The socket
+// must have previously be put into listen mode through the NetLibSocketListen call.
+// On return, *sockAddrP will have the remote machines address and port number.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketAccept(UInt16 libRefnum, NetSocketRef socket,
+ NetSocketAddrType *sockAddrP, Int16 *addrLenP, Int32 timeout,
+ Err *errP)
+ SYS_TRAP(netLibTrapSocketAccept);
+
+
+// Shutdown a connection in one or both directions.
+// Only applies to stream based (i.e. TCP) sockets.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketShutdown(UInt16 libRefnum, NetSocketRef socket,
+ Int16 /*NetSocketDirEnum*/ direction, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketShutdown);
+
+
+
+// Gets the local and remote addresses of a socket. Useful for TCP sockets that
+// get dynamically bound at connect time.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+Int16 NetLibSocketAddr(UInt16 libRefnum, NetSocketRef socketRef,
+ NetSocketAddrType *locAddrP, Int16 *locAddrLenP,
+ NetSocketAddrType *remAddrP, Int16 *remAddrLenP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSocketAddr);
+
+
+
+//--------------------------------------------------
+// Sending and Receiving
+//--------------------------------------------------
+// Send data through a socket. The data is specified through the NetIOParamType
+// structure.
+// Flags is one or more of netMsgFlagXXX.
+// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled
+// in with error code.
+Int16 NetLibSendPB(UInt16 libRefNum, NetSocketRef socket,
+ NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSendPB);
+
+// Send data through a socket. The data to send is passed in a single buffer,
+// unlike NetLibSendPB. If toAddrP is not nil, the data will be sent to
+// address *toAddrP.
+// Flags is one or more of netMsgFlagXXX.
+// Returns # of bytes sent on success, or -1 on error. If error, *errP gets filled
+// in with error code.
+Int16 NetLibSend(UInt16 libRefNum, NetSocketRef socket,
+ void *bufP, UInt16 bufLen, UInt16 flags,
+ void *toAddrP, UInt16 toLen, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSend);
+
+// Receive data from a socket. The data is gatthered into buffers specified in the
+// NetIOParamType structure.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibReceivePB(UInt16 libRefNum, NetSocketRef socket,
+ NetIOParamType *pbP, UInt16 flags, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapReceivePB);
+
+// Receive data from a socket. The data is read into a single buffer, unlike
+// NetLibReceivePB. If fromAddrP is not nil, *fromLenP must be initialized to
+// the size of the buffer that fromAddrP points to and on exit *fromAddrP will
+// have the address of the sender in it.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibReceive(UInt16 libRefNum, NetSocketRef socket,
+ void *bufP, UInt16 bufLen, UInt16 flags,
+ void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapReceive);
+
+
+// Receive data from a socket directly into a (write-protected) Data Manager
+// record.
+// If fromAddrP is not nil, *fromLenP must be initialized to
+// the size of the buffer that fromAddrP points to and on exit *fromAddrP will
+// have the address of the sender in it.
+// Flags is one or more of netMsgFlagXXX.
+// Timeout is max # of ticks to wait, or -1 for infinite, or 0 for none.
+// Returns # of bytes received, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibDmReceive(UInt16 libRefNum, NetSocketRef socket,
+ void *recordP, UInt32 recordOffset, UInt16 rcvLen, UInt16 flags,
+ void *fromAddrP, UInt16 *fromLenP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapDmReceive);
+
+
+//--------------------------------------------------
+// Name Lookups
+//--------------------------------------------------
+NetHostInfoPtr NetLibGetHostByName(UInt16 libRefNum, Char *nameP,
+ NetHostInfoBufPtr bufP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetHostByName);
+
+
+NetHostInfoPtr NetLibGetHostByAddr(UInt16 libRefNum, UInt8 *addrP, UInt16 len, UInt16 type,
+ NetHostInfoBufPtr bufP, Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetHostByAddr);
+
+
+NetServInfoPtr NetLibGetServByName(UInt16 libRefNum, const Char *servNameP,
+ const Char *protoNameP, NetServInfoBufPtr bufP,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetServByName);
+
+// Looks up a mail exchange name and returns a list of hostnames for it. Caller
+// must pass space for list of return names (hostNames), space for
+// list of priorities for those hosts (priorities) and max # of names to
+// return (maxEntries).
+// Returns # of entries found, or -1 on error. If error, *errP gets filled in
+// with error code.
+Int16 NetLibGetMailExchangeByName(UInt16 libRefNum, Char *mailNameP,
+ UInt16 maxEntries,
+ Char hostNames[][netDNSMaxDomainName+1], UInt16 priorities[],
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapGetMailExchangeByName);
+
+
+//--------------------------------------------------
+// Interface setup
+//--------------------------------------------------
+Err NetLibIFGet(UInt16 libRefNum, UInt16 index, UInt32 *ifCreatorP,
+ UInt16 *ifInstanceP)
+ SYS_TRAP(netLibTrapIFGet);
+
+Err NetLibIFAttach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFAttach);
+
+Err NetLibIFDetach(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFDetach);
+
+Err NetLibIFUp(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance)
+ SYS_TRAP(netLibTrapIFUp);
+
+Err NetLibIFDown(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapIFDown);
+
+
+
+
+//--------------------------------------------------
+// Settings
+//--------------------------------------------------
+// General settings
+Err NetLibSettingGet(UInt16 libRefNum,
+ UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 *valueLenP)
+ SYS_TRAP(netLibTrapSettingGet);
+
+Err NetLibSettingSet(UInt16 libRefNum,
+ UInt16 /*NetSettingEnum*/ setting, void *valueP, UInt16 valueLen)
+ SYS_TRAP(netLibTrapSettingSet);
+
+// Network interface specific settings.
+Err NetLibIFSettingGet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 *valueLenP)
+ SYS_TRAP(netLibTrapIFSettingGet);
+
+Err NetLibIFSettingSet(UInt16 libRefNum, UInt32 ifCreator, UInt16 ifInstance,
+ UInt16 /*NetIFSettingEnum*/ setting, void *valueP, UInt16 valueLen)
+ SYS_TRAP(netLibTrapIFSettingSet);
+
+
+
+//--------------------------------------------------
+// System level
+//--------------------------------------------------
+Int16 NetLibSelect(UInt16 libRefNum, UInt16 width, NetFDSetType *readFDs,
+ NetFDSetType *writeFDs, NetFDSetType *exceptFDs,
+ Int32 timeout, Err *errP)
+ SYS_TRAP(netLibTrapSelect);
+
+
+
+//--------------------------------------------------
+// Debugging support
+//--------------------------------------------------
+Err NetLibMaster(UInt16 libRefNum, UInt16 cmd, NetMasterPBPtr pbP,
+ Int32 timeout)
+ SYS_TRAP(netLibTrapMaster);
+
+Err NetLibTracePrintF(UInt16 libRefNum, Char *formatStr, ...)
+ SYS_TRAP(netLibTrapTracePrintF);
+
+Err NetLibTracePutS(UInt16 libRefNum, Char *strP)
+ SYS_TRAP(netLibTrapTracePutS);
+
+
+
+
+
+//--------------------------------------------------
+// Configuration Calls
+//--------------------------------------------------
+Err NetLibOpenConfig( UInt16 refNum, UInt16 configIndex, UInt32 openFlags,
+ UInt16 *netIFErrP)
+ SYS_TRAP(netLibOpenConfig);
+
+Err NetLibConfigMakeActive( UInt16 refNum, UInt16 configIndex)
+ SYS_TRAP(netLibConfigMakeActive);
+
+Err NetLibConfigList( UInt16 refNum, NetConfigNameType nameArray[],
+ UInt16 *arrayEntriesP)
+ SYS_TRAP(netLibConfigList);
+
+Err NetLibConfigIndexFromName( UInt16 refNum, NetConfigNamePtr nameP,
+ UInt16 *indexP)
+ SYS_TRAP(netLibConfigIndexFromName);
+
+Err NetLibConfigDelete( UInt16 refNum, UInt16 index)
+ SYS_TRAP(netLibConfigDelete);
+
+Err NetLibConfigSaveAs( UInt16 refNum, NetConfigNamePtr nameP)
+ SYS_TRAP(netLibConfigSaveAs);
+
+Err NetLibConfigRename( UInt16 refNum, UInt16 index,
+ NetConfigNamePtr newNameP)
+ SYS_TRAP(netLibConfigRename);
+
+Err NetLibConfigAliasSet( UInt16 refNum, UInt16 configIndex,
+ UInt16 aliasToIndex)
+ SYS_TRAP(netLibConfigAliasSet);
+
+Err NetLibConfigAliasGet( UInt16 refNum, UInt16 aliasIndex,
+ UInt16 *indexP, Boolean *isAnotherAliasP)
+ SYS_TRAP(netLibConfigAliasGet);
+
+
+#ifndef PUBLIC_STUFF_STRIPPED
+//--------------------------------------------------
+// Routines that must be linked in from the :Libraries:PalmOS:Src:NetSocket.c
+// source module.
+//
+// These are general convenience routines for applications that use the
+// NetLib. They are not part of the NetLib itself because they generally
+// need to keep track of state within the application and require the use
+// of application globals that are declared in NetSocket.c
+//--------------------------------------------------
+#ifdef __SYSEVENT_H__
+Boolean NetUWirelessAppHandleEvent(SysEventType *eventP, UInt32 flags, Err *errP);
+#endif
+#endif // PUBLIC_STUFF_STRIPPED
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+// Include the NetMgr Bit Utils
+#include <NetBitUtils.h>
+
+#endif // __NETMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h
new file mode 100644
index 0000000..7d4f4b9
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/OverlayMgr.h
@@ -0,0 +1,214 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: OverlayMgr.h
+ *
+ * Description:
+ * Public header for routines that support overlays & locales.
+ *
+ * History:
+ * Created by Ken Krugler
+ * 06/24/99 kwk Created by Ken Krugler.
+ * 07/06/99 CS Added omSpecAttrForBase
+ * (and renumbered omSpecAttrStripped).
+ * 07/29/99 CS Added omOverlayKindBase for the entries in the base
+ * DBs 'ovly' resource (they had been set to
+ * omOverlayKindReplace before).
+ * 07/29/99 CS Bumped version to 3, since now we're supposed to
+ * support omOverlayKindAdd.
+ * 09/29/99 kwk Bumped version to 4, since we added the baseChecksum
+ * field to OmOverlaySpecType, as a way of speeding up
+ * overlay validation.
+ * 09/29/99 CS Actually bumped version to 4, which Ken forgot.
+ * 10/08/99 kwk Added OmGetRoutineAddress selector/declaration.
+ * Moved OmDispatch, OmInit, and OmOpenOverlayDatabase
+ * into OverlayPrv.h
+ *
+ *****************************************************************************/
+
+#ifndef __OVERLAYMGR_H__
+#define __OVERLAYMGR_H__
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <DataMgr.h>
+
+#ifdef _WIN32
+ #pragma warning(disable: 4200) // nonstandard extension used : zero-sized array in struct/union
+#endif
+
+/***********************************************************************
+ * Overlay Manager constants
+ **********************************************************************/
+
+#define omOverlayVersion 0x0004 // Version of OmOverlaySpecType/OmOverlayRscType
+#define omOverlayDBType 'ovly' // Overlay database type
+#define omOverlayRscType 'ovly' // Overlay desc resource type
+#define omOverlayRscID 1000 // Overlay desc resource ID
+
+#define omFtrCreator 'ovly' // For get/set of Overlay features.
+#define omFtrShowErrorsFlag 0 // Boolean - True => display overlay errors.
+
+// Flags for OmOverlaySpecType.flags field
+#define omSpecAttrForBase 1 // 'ovly' (in base) describes base itself
+#define omSpecAttrStripped 2 // Localized resources stripped (base only)
+
+// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
+#define omErrBaseRequiresOverlay (omErrorClass | 1)
+
+// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
+#define omErrUnknownLocale (omErrorClass | 2)
+
+// OmOverlayDBNameToLocale was passed a poorly formed string.
+#define omErrBadOverlayDBName (omErrorClass | 3)
+
+// OmGetIndexedLocale was passed an invalid index.
+#define omErrInvalidLocaleIndex (omErrorClass | 4)
+
+// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
+// system overlay).
+
+#define omErrInvalidLocale (omErrorClass | 5)
+
+// OmSetSystemLocale was passed a locale that referenced an invalid system overlay
+// (missing one or more required resources)
+
+#define omErrInvalidSystemOverlay (omErrorClass | 6)
+
+// Values for OmOverlayKind
+#define omOverlayKindHide 0 // Hide base resource (not supported in version <= 3)
+#define omOverlayKindAdd 1 // Add new resource (not support in version <= 2)
+#define omOverlayKindReplace 2 // Replace base resource
+#define omOverlayKindBase 3 // Description of base resource itself (not supported in version <= 2)
+
+/***********************************************************************
+ * Selectors & macros used for calling Overlay Manager routines
+ **********************************************************************/
+
+#ifdef DIRECT_OVERLAY_CALLS
+ #define OMDISPATCH_TRAP(omSelectorNum)
+#else
+ #define OMDISPATCH_TRAP(sel) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapOmDispatch, sel)
+#endif
+
+// Selectors used for getting to the right Overlay Manager routine via
+// the OmDispatch trap.
+typedef enum {
+ omInit = 0,
+ omOpenOverlayDatabase,
+ omLocaleToOverlayDBName,
+ omOverlayDBNameToLocale,
+ omGetCurrentLocale,
+ omGetIndexedLocale,
+ omGetSystemLocale,
+ omSetSystemLocale,
+ omGetRoutineAddress,
+
+ omMaxSelector = omGetRoutineAddress,
+ omBigSelector = 0x7FFF // Force OmSelector to be 16 bits.
+} OmSelector;
+
+/***********************************************************************
+ * Overlay Manager types
+ **********************************************************************/
+
+typedef UInt16 OmOverlayKind;
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER kwk - figure out exact format for portable struct declaration.
+// We might also want to hide this information in a private header, and
+// just have OmLocaleType in here.
+#endif // PUBLIC_STUFF_STRIPPED
+
+typedef struct {
+ OmOverlayKind overlayType; // Replace, delete, etc.
+ UInt32 rscType; // Resource type to overlay
+ UInt16 rscID; // Resource ID to overlay
+ UInt32 rscLength; // Length of base resource
+ UInt32 rscChecksum; // Checksum of base resource data
+} OmOverlayRscType;
+
+typedef struct {
+ UInt16 language; // Language spoken in locale
+ UInt16 country; // Specifies "dialect" of language
+} OmLocaleType;
+
+// Definition of the Overlay Description Resource ('ovly')
+typedef struct {
+ UInt16 version; // Version of this structure
+ UInt32 flags; // Flags
+ UInt32 baseChecksum; // Checksum of all overlays[].checksum
+ OmLocaleType targetLocale; // Language, & country of overlay resources
+ UInt32 baseDBType; // Type of base DB to overlay
+ UInt32 baseDBCreator; // Creator of base DB to overlay
+ UInt32 baseDBCreateDate; // Date base DB was created
+ UInt32 baseDBModDate; // Date base DB was last modified
+ UInt16 numOverlays; // Number of resources to overlay
+ OmOverlayRscType overlays[0]; // Descriptions of resources to overlay
+} OmOverlaySpecType;
+
+
+/***********************************************************************
+ * Overlay Manager routines
+ **********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return in <overlayDBName> an overlay database name that's appropriate
+// for the base name <baseDBName> and the locale <targetLocale>. If the
+// <targetLocale> param in NULL, use the current locale. The <overlayDBName>
+// buffer must be at least dmDBNameLength bytes.
+
+Err OmLocaleToOverlayDBName(const Char *baseDBName, const OmLocaleType *targetLocale,
+ Char *overlayDBName)
+ OMDISPATCH_TRAP(omLocaleToOverlayDBName);
+
+// Given the name of an overlay database in <overlayDBName>, return back
+// the overlay in overlayLocale. If the name isn't an overlay name,
+// return omErrBadOverlayDBName.
+
+Err OmOverlayDBNameToLocale(const Char *overlayDBName, OmLocaleType *overlayLocale)
+ OMDISPATCH_TRAP(omOverlayDBNameToLocale);
+
+// Return the current locale in <currentLocale>. This may not be the same as
+// the system locale, which will take effect after the next reset.
+
+void OmGetCurrentLocale(OmLocaleType *currentLocale)
+ OMDISPATCH_TRAP(omGetCurrentLocale);
+
+// Return the nth available locale in <theLocale>. Indexes are zero-based, and the
+// omErrInvalidLocaleIndex result will be returned if <localeIndex> is out of bounds.
+
+Err OmGetIndexedLocale(UInt16 localeIndex, OmLocaleType *theLocale)
+ OMDISPATCH_TRAP(omGetIndexedLocale);
+
+// Return the system locale in <systemLocale>. This may not be the same as
+// the current locale.
+
+void OmGetSystemLocale(OmLocaleType *systemLocale)
+ OMDISPATCH_TRAP(omGetSystemLocale);
+
+// Set the post-reset system locale to be <systemLocale>. Return omErrInvalidLocale if
+// the passed locale doesnÕt correspond to a valid System.prc overlay.
+
+Err OmSetSystemLocale(const OmLocaleType *systemLocale)
+ OMDISPATCH_TRAP(omSetSystemLocale);
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+
+void *OmGetRoutineAddress(OmSelector inSelector)
+ OMDISPATCH_TRAP(omGetRoutineAddress);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h b/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h
new file mode 100644
index 0000000..895d5b4
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/PalmLocale.h
@@ -0,0 +1,1258 @@
+/******************************************************************************
+ *
+ * Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PalmLocale.h
+ *
+ * Release:
+ *
+ * Description:
+ * Public header for simple constants that support locales (information
+ * specific to locales and regions). This file is designed to support
+ * Rez in addition to C/C++.
+ *
+ * History:
+ * 05/31/00 CS Created by Chris Schneider (from LocaleMgr.h).
+ * 06/02/00 CS Moved character encoding constants in here (from TextMgr.h).
+ * 06/05/00 kwk Moved character encoding names in here (from TextMgr.h)
+ * Updated CP1252 charset name to "Windows-1252", as the new
+ * preferred standard. It was "ISO-8859-1-Windows-3.1-Latin-1".
+ * Added encodingNameUCS2. Fixed up some encoding constant names.
+ * 06/05/00 CS Hacked in changes for Rez, which doesn't support macro
+ * parameters in #defines.
+ * 06/06/00 CS Changed name form Locale.h to PalmLocale.h to avoid
+ * name collision with the Metrowerks Standard Library
+ * header Locale.h.
+ * CS Now use PALM_LOCALE_HAS_TYPES to control whether to
+ * use types (rather than just rez).
+ * 06/07/00 kwk Moved encoding name #defines out of conditional sections,
+ * since these don't depend on PALM_LOCALE_HAS_TYPES.
+ * kwk Fixed charEncodingMax - was 76, should be 75.
+ * 06/27/00 kwk Fixed charEncodingMax in the automatically generated section
+ * to also be 75.
+ * kwk Renumbered char encodings so that charEncodingUCS2 stays
+ * at 9 (where it was before I integrated with Michel), since
+ * the Sony version of TxtConvertEncoding relies on this.
+ * Basically swapped charEncodingUCS2 (was 25) with charEncodingEucJp
+ * (was 9).
+ * 07/21/00 kwk Added charEncodingUTF16, charEncodingUTF16BE, and charEncodingUTF16LE.
+ * The UTF16 encoding requires a BOM (byte order mark) in the text
+ * stream to identify big vs. little endian, while the other two
+ * are explicit. Note that for Palm OS, charEncodingUCS2 is the
+ * same as charEncodingUTF16BE without support for surrogates, but
+ * since we currently don't support characters > 16 bits, in reality
+ * charEncodingUTF16BE is more like charEncodingUCS2.
+ * kwk Updated charEncodingMax to be 77 (was 74).
+ * 08/01/00 kwk Changed cNewCalidonia to cNewCaledonia.
+ * 05/12/01 kwk Added charEncodingPalmGSM, and bumped the max encoding value to 78.
+ * kwk Added encodingNamePalmGSM, for when a MIME message is sent with
+ * any of the 10 special Greek characters.
+ * 07/01/01 kwk Changed charset name to be "palmGSM" to match Palm.net's current
+ * character set name.
+ * 07/15/01 kwk Added three additional Big5-based encodings (CP950, Big5Plus, PalmBig5).
+ * kwk Updated charEncodingMax to be 80 (was 77).
+ * kwk Added Big-5 related encoding names.
+ * 08/16/01 MT Added lLanguageNum and cCountryNum so Elaine has a compile warning
+ * when a new Lanaguage or Country (or Charset added with charEncodingMax)
+ * 10/25/01 kwk Merged w/GSM changes. charEncodingMax is now 81 (was 80).
+ * Shifted up the three new Big5-based encodings, since GSM
+ * has the encoding value of 78.
+ * 10/29/01 kwk Changed encodingNameBig5Plus to encodingNameBig5_HKSCS. Got rid
+ * of encodingNameCP950. Changed charEncodingCP950 to charEncodingBig5_HKSCS.
+ * 11/03/01 kwk Added GBK and PalmGB as character encoding values. Bumped max
+ * encoding to 83. Defined charset names for Simplified Chinese encodings.
+ *
+ *****************************************************************************/
+
+#ifndef __PALMLOCALE_H__
+#define __PALMLOCALE_H__
+
+
+// Names of the known encodings.
+#define encodingNameAscii "us-ascii"
+#define encodingNameISO8859_1 "ISO-8859-1"
+#define encodingNameCP1252 "Windows-1252"
+
+#define encodingNameShiftJIS "Shift_JIS"
+#define encodingNameCP932 "Windows-31J"
+
+#define encodingNameUTF8 "UTF-8"
+#define encodingNameUCS2 "ISO-10646-UCS-2"
+
+#define encodingNamePalmGSM "palmGSM"
+
+#define encodingNameBig5 "Big5"
+#define encodingNameBig5_HKSCS "Big5-HKSCS"
+
+// Note that as of 2001-11-03 there are no defined names for GBK/CP936 in the
+// IANA registry. It appears as though software uses GB2312 as the default name.
+#define encodingNameGB2312 "GB2312"
+#define encodingNameHZ "HZ-GB-2312"
+
+// Maximum length of any encoding name.
+#define maxEncodingNameLength 40
+
+/* Rez doesn't even support macros, so for Rez we must simplify all of the #defines.
+Thus, whenever you modify any constants, please do so in the !rez section,
+then execute the following MPW commands (from elsewhere with this file as the target)
+so that the Rez case will be automatically updated:
+
+Find ¥;Find /TAG SOURCE START/!1:/TAG SOURCE END/Á1
+Copy ¤
+Find ¥;Find /TAG DESTINATION START/!1:/TAG DESTINATION END/Á1
+Echo
+Paste ¤
+Find ¥;Find /TAG DESTINATION START/
+Replace -c ° /(#define[ ¶t]+l[a-z0-9_]+[ ¶t]+)¨1LANGUAGE_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+Replace -c ° /(#define[ ¶t]+c[a-z0-9_]+[ ¶t]+)¨1COUNTRY_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+Replace -c ° /(#define[ ¶t]+charEncoding[a-z0-9_]+[ ¶t]+)¨1CHAR_ENCODING_VALUE¶(([0-9]+)¨2¶)/ "¨1¨2"
+*/
+#if rez
+ #define PALM_LOCALE_HAS_TYPES 0
+#endif
+#ifndef PALM_LOCALE_HAS_TYPES
+ #define PALM_LOCALE_HAS_TYPES 1
+#endif
+
+
+#if PALM_LOCALE_HAS_TYPES // Normal (e.g., non-Rez) case
+
+/***********************************************************************
+ * Locale constants
+ **********************************************************************/
+
+/* Language codes (ISO 639). The first 8 preserve the old values for the deprecated
+LanguageType; the rest are sorted by the 2-character language code.
+
+WARNING! Keep in sync with BOTH:
+ 1) LanguageCode array in OverlayMgr.c
+ 2) localeLanguage #define in UIResDefs.r
+*/
+#define LANGUAGE_VALUE(value) ((LanguageType)value)
+
+// Leave the following line unchanged before 1st #define to be copied to rez section:
+// TAG SOURCE START
+
+#define lEnglish LANGUAGE_VALUE(0) // EN
+#define lFrench LANGUAGE_VALUE(1) // FR
+#define lGerman LANGUAGE_VALUE(2) // DE
+#define lItalian LANGUAGE_VALUE(3) // IT
+#define lSpanish LANGUAGE_VALUE(4) // ES
+#define lUnused LANGUAGE_VALUE(5) // Reserved
+
+// New in 3.1
+#define lJapanese LANGUAGE_VALUE(6) // JA (Palm calls this jp)
+#define lDutch LANGUAGE_VALUE(7) // NL
+
+// New in 4.0
+#define lAfar LANGUAGE_VALUE(8) // AA
+#define lAbkhazian LANGUAGE_VALUE(9) // AB
+#define lAfrikaans LANGUAGE_VALUE(10) // AF
+#define lAmharic LANGUAGE_VALUE(11) // AM
+#define lArabic LANGUAGE_VALUE(12) // AR
+#define lAssamese LANGUAGE_VALUE(13) // AS
+#define lAymara LANGUAGE_VALUE(14) // AY
+#define lAzerbaijani LANGUAGE_VALUE(15) // AZ
+#define lBashkir LANGUAGE_VALUE(16) // BA
+#define lByelorussian LANGUAGE_VALUE(17) // BE
+#define lBulgarian LANGUAGE_VALUE(18) // BG
+#define lBihari LANGUAGE_VALUE(19) // BH
+#define lBislama LANGUAGE_VALUE(20) // BI
+#define lBengali LANGUAGE_VALUE(21) // BN (Bangla)
+#define lTibetan LANGUAGE_VALUE(22) // BO
+#define lBreton LANGUAGE_VALUE(23) // BR
+#define lCatalan LANGUAGE_VALUE(24) // CA
+#define lCorsican LANGUAGE_VALUE(25) // CO
+#define lCzech LANGUAGE_VALUE(26) // CS
+#define lWelsh LANGUAGE_VALUE(27) // CY
+#define lDanish LANGUAGE_VALUE(28) // DA
+#define lBhutani LANGUAGE_VALUE(29) // DZ
+#define lGreek LANGUAGE_VALUE(30) // EL
+#define lEsperanto LANGUAGE_VALUE(31) // EO
+#define lEstonian LANGUAGE_VALUE(32) // ET
+#define lBasque LANGUAGE_VALUE(33) // EU
+#define lPersian LANGUAGE_VALUE(34) // FA (Farsi)
+#define lFinnish LANGUAGE_VALUE(35) // FI
+#define lFiji LANGUAGE_VALUE(36) // FJ
+#define lFaroese LANGUAGE_VALUE(37) // FO
+#define lFrisian LANGUAGE_VALUE(38) // FY
+#define lIrish LANGUAGE_VALUE(39) // GA
+#define lScotsGaelic LANGUAGE_VALUE(40) // GD
+#define lGalician LANGUAGE_VALUE(41) // GL
+#define lGuarani LANGUAGE_VALUE(42) // GN
+#define lGujarati LANGUAGE_VALUE(43) // GU
+#define lHausa LANGUAGE_VALUE(44) // HA
+#define lHindi LANGUAGE_VALUE(45) // HI
+#define lCroatian LANGUAGE_VALUE(46) // HR
+#define lHungarian LANGUAGE_VALUE(47) // HU
+#define lArmenian LANGUAGE_VALUE(48) // HY
+#define lInterlingua LANGUAGE_VALUE(49) // IA
+#define lInterlingue LANGUAGE_VALUE(50) // IE
+#define lInupiak LANGUAGE_VALUE(51) // IK
+#define lIndonesian LANGUAGE_VALUE(52) // IN
+#define lIcelandic LANGUAGE_VALUE(53) // IS
+#define lHebrew LANGUAGE_VALUE(54) // IW
+#define lYiddish LANGUAGE_VALUE(55) // JI
+#define lJavanese LANGUAGE_VALUE(56) // JW
+#define lGeorgian LANGUAGE_VALUE(57) // KA
+#define lKazakh LANGUAGE_VALUE(58) // KK
+#define lGreenlandic LANGUAGE_VALUE(59) // KL
+#define lCambodian LANGUAGE_VALUE(60) // KM
+#define lKannada LANGUAGE_VALUE(61) // KN
+#define lKorean LANGUAGE_VALUE(62) // KO
+#define lKashmiri LANGUAGE_VALUE(63) // KS
+#define lKurdish LANGUAGE_VALUE(64) // KU
+#define lKirghiz LANGUAGE_VALUE(65) // KY
+#define lLatin LANGUAGE_VALUE(66) // LA
+#define lLingala LANGUAGE_VALUE(67) // LN
+#define lLaothian LANGUAGE_VALUE(68) // LO
+#define lLithuanian LANGUAGE_VALUE(69) // LT
+#define lLatvian LANGUAGE_VALUE(70) // LV (Lettish)
+#define lMalagasy LANGUAGE_VALUE(71) // MG
+#define lMaori LANGUAGE_VALUE(72) // MI
+#define lMacedonian LANGUAGE_VALUE(73) // MK
+#define lMalayalam LANGUAGE_VALUE(74) // ML
+#define lMongolian LANGUAGE_VALUE(75) // MN
+#define lMoldavian LANGUAGE_VALUE(76) // MO
+#define lMarathi LANGUAGE_VALUE(77) // MR
+#define lMalay LANGUAGE_VALUE(78) // MS
+#define lMaltese LANGUAGE_VALUE(79) // MT
+#define lBurmese LANGUAGE_VALUE(80) // MY
+#define lNauru LANGUAGE_VALUE(81) // NA
+#define lNepali LANGUAGE_VALUE(82) // NE
+#define lNorwegian LANGUAGE_VALUE(83) // NO
+#define lOccitan LANGUAGE_VALUE(84) // OC
+#define lAfan LANGUAGE_VALUE(85) // OM (Oromo)
+#define lOriya LANGUAGE_VALUE(86) // OR
+#define lPunjabi LANGUAGE_VALUE(87) // PA
+#define lPolish LANGUAGE_VALUE(88) // PL
+#define lPashto LANGUAGE_VALUE(89) // PS (Pushto)
+#define lPortuguese LANGUAGE_VALUE(90) // PT
+#define lQuechua LANGUAGE_VALUE(91) // QU
+#define lRhaetoRomance LANGUAGE_VALUE(92) // RM
+#define lKurundi LANGUAGE_VALUE(93) // RN
+#define lRomanian LANGUAGE_VALUE(94) // RO
+#define lRussian LANGUAGE_VALUE(95) // RU
+#define lKinyarwanda LANGUAGE_VALUE(96) // RW
+#define lSanskrit LANGUAGE_VALUE(97) // SA
+#define lSindhi LANGUAGE_VALUE(98) // SD
+#define lSangho LANGUAGE_VALUE(99) // SG
+#define lSerboCroatian LANGUAGE_VALUE(100) // SH
+#define lSinghalese LANGUAGE_VALUE(101) // SI
+#define lSlovak LANGUAGE_VALUE(102) // SK
+#define lSlovenian LANGUAGE_VALUE(103) // SL
+#define lSamoan LANGUAGE_VALUE(104) // SM
+#define lShona LANGUAGE_VALUE(105) // SN
+#define lSomali LANGUAGE_VALUE(106) // SO
+#define lAlbanian LANGUAGE_VALUE(107) // SQ
+#define lSerbian LANGUAGE_VALUE(108) // SR
+#define lSiswati LANGUAGE_VALUE(109) // SS
+#define lSesotho LANGUAGE_VALUE(110) // ST
+#define lSudanese LANGUAGE_VALUE(111) // SU
+#define lSwedish LANGUAGE_VALUE(112) // SV
+#define lSwahili LANGUAGE_VALUE(113) // SW
+#define lTamil LANGUAGE_VALUE(114) // TA
+#define lTelugu LANGUAGE_VALUE(115) // TE
+#define lTajik LANGUAGE_VALUE(116) // TG
+#define lThai LANGUAGE_VALUE(117) // TH
+#define lTigrinya LANGUAGE_VALUE(118) // TI
+#define lTurkmen LANGUAGE_VALUE(119) // TK
+#define lTagalog LANGUAGE_VALUE(120) // TL
+#define lSetswana LANGUAGE_VALUE(121) // TN
+#define lTonga LANGUAGE_VALUE(122) // TO
+#define lTurkish LANGUAGE_VALUE(123) // TR
+#define lTsonga LANGUAGE_VALUE(124) // TS
+#define lTatar LANGUAGE_VALUE(125) // TT
+#define lTwi LANGUAGE_VALUE(126) // TW
+#define lUkrainian LANGUAGE_VALUE(127) // UK
+#define lUrdu LANGUAGE_VALUE(128) // UR
+#define lUzbek LANGUAGE_VALUE(129) // UZ
+#define lVietnamese LANGUAGE_VALUE(130) // VI
+#define lVolapuk LANGUAGE_VALUE(131) // VO
+#define lWolof LANGUAGE_VALUE(132) // WO
+#define lXhosa LANGUAGE_VALUE(133) // XH
+#define lYoruba LANGUAGE_VALUE(134) // YO
+#define lChinese LANGUAGE_VALUE(135) // ZH
+#define lZulu LANGUAGE_VALUE(136) // ZU
+//
+#define lLanguageNum LANGUAGE_VALUE(137) // Number of Languages
+
+/* Country codes (ISO 3166). The first 33 preserve the old values for the
+deprecated CountryType; the rest are sorted by the 2-character country code.
+
+WARNING! Keep in sync with BOTH:
+ 1) CountryCode array in OverlayMgr.c
+ 2) localeCountry #define in UIResDefs.r
+*/
+#define COUNTRY_VALUE(value) ((CountryType)value)
+
+#define cAustralia COUNTRY_VALUE(0) // AU
+#define cAustria COUNTRY_VALUE(1) // AT
+#define cBelgium COUNTRY_VALUE(2) // BE
+#define cBrazil COUNTRY_VALUE(3) // BR
+#define cCanada COUNTRY_VALUE(4) // CA
+#define cDenmark COUNTRY_VALUE(5) // DK
+#define cFinland COUNTRY_VALUE(6) // FI
+#define cFrance COUNTRY_VALUE(7) // FR
+#define cGermany COUNTRY_VALUE(8) // DE
+#define cHongKong COUNTRY_VALUE(9) // HK
+#define cIceland COUNTRY_VALUE(10) // IS
+#define cIreland COUNTRY_VALUE(11) // IE
+#define cItaly COUNTRY_VALUE(12) // IT
+#define cJapan COUNTRY_VALUE(13) // JP
+#define cLuxembourg COUNTRY_VALUE(14) // LU
+#define cMexico COUNTRY_VALUE(15) // MX
+#define cNetherlands COUNTRY_VALUE(16) // NL
+#define cNewZealand COUNTRY_VALUE(17) // NZ
+#define cNorway COUNTRY_VALUE(18) // NO
+#define cSpain COUNTRY_VALUE(19) // ES
+#define cSweden COUNTRY_VALUE(20) // SE
+#define cSwitzerland COUNTRY_VALUE(21) // CH
+#define cUnitedKingdom COUNTRY_VALUE(22) // GB (UK)
+#define cUnitedStates COUNTRY_VALUE(23) // US
+#define cIndia COUNTRY_VALUE(24) // IN
+#define cIndonesia COUNTRY_VALUE(25) // ID
+#define cRepublicOfKorea COUNTRY_VALUE(26) // KR
+#define cMalaysia COUNTRY_VALUE(27) // MY
+#define cChina COUNTRY_VALUE(28) // CN
+#define cPhilippines COUNTRY_VALUE(29) // PH
+#define cSingapore COUNTRY_VALUE(30) // SG
+#define cThailand COUNTRY_VALUE(31) // TH
+#define cTaiwan COUNTRY_VALUE(32) // TW
+
+// New in 4.0
+#define cAndorra COUNTRY_VALUE(33) // AD
+#define cUnitedArabEmirates COUNTRY_VALUE(34) // AE
+#define cAfghanistan COUNTRY_VALUE(35) // AF
+#define cAntiguaAndBarbuda COUNTRY_VALUE(36) // AG
+#define cAnguilla COUNTRY_VALUE(37) // AI
+#define cAlbania COUNTRY_VALUE(38) // AL
+#define cArmenia COUNTRY_VALUE(39) // AM
+#define cNetherlandsAntilles COUNTRY_VALUE(40) // AN
+#define cAngola COUNTRY_VALUE(41) // AO
+#define cAntarctica COUNTRY_VALUE(42) // AQ
+#define cArgentina COUNTRY_VALUE(43) // AR
+#define cAmericanSamoa COUNTRY_VALUE(44) // AS
+#define cAruba COUNTRY_VALUE(45) // AW
+#define cAzerbaijan COUNTRY_VALUE(46) // AZ
+#define cBosniaAndHerzegovina COUNTRY_VALUE(47) // BA
+#define cBarbados COUNTRY_VALUE(48) // BB
+#define cBangladesh COUNTRY_VALUE(49) // BD
+#define cBurkinaFaso COUNTRY_VALUE(50) // BF
+#define cBulgaria COUNTRY_VALUE(51) // BG
+#define cBahrain COUNTRY_VALUE(52) // BH
+#define cBurundi COUNTRY_VALUE(53) // BI
+#define cBenin COUNTRY_VALUE(54) // BJ
+#define cBermuda COUNTRY_VALUE(55) // BM
+#define cBruneiDarussalam COUNTRY_VALUE(56) // BN
+#define cBolivia COUNTRY_VALUE(57) // BO
+#define cBahamas COUNTRY_VALUE(58) // BS
+#define cBhutan COUNTRY_VALUE(59) // BT
+#define cBouvetIsland COUNTRY_VALUE(60) // BV
+#define cBotswana COUNTRY_VALUE(61) // BW
+#define cBelarus COUNTRY_VALUE(62) // BY
+#define cBelize COUNTRY_VALUE(63) // BZ
+#define cCocosIslands COUNTRY_VALUE(64) // CC
+#define cDemocraticRepublicOfTheCongo COUNTRY_VALUE(65) // CD
+#define cCentralAfricanRepublic COUNTRY_VALUE(66) // CF
+#define cCongo COUNTRY_VALUE(67) // CG
+#define cIvoryCoast COUNTRY_VALUE(68) // CI
+#define cCookIslands COUNTRY_VALUE(69) // CK
+#define cChile COUNTRY_VALUE(70) // CL
+#define cCameroon COUNTRY_VALUE(71) // CM
+#define cColumbia COUNTRY_VALUE(72) // CO
+#define cCostaRica COUNTRY_VALUE(73) // CR
+#define cCuba COUNTRY_VALUE(74) // CU
+#define cCapeVerde COUNTRY_VALUE(75) // CV
+#define cChristmasIsland COUNTRY_VALUE(76) // CX
+#define cCyprus COUNTRY_VALUE(77) // CY
+#define cCzechRepublic COUNTRY_VALUE(78) // CZ
+#define cDjibouti COUNTRY_VALUE(79) // DJ
+#define cDominica COUNTRY_VALUE(80) // DM
+#define cDominicanRepublic COUNTRY_VALUE(81) // DO
+#define cAlgeria COUNTRY_VALUE(82) // DZ
+#define cEcuador COUNTRY_VALUE(83) // EC
+#define cEstonia COUNTRY_VALUE(84) // EE
+#define cEgypt COUNTRY_VALUE(85) // EG
+#define cWesternSahara COUNTRY_VALUE(86) // EH
+#define cEritrea COUNTRY_VALUE(87) // ER
+#define cEthiopia COUNTRY_VALUE(88) // ET
+#define cFiji COUNTRY_VALUE(89) // FJ
+#define cFalklandIslands COUNTRY_VALUE(90) // FK
+#define cMicronesia COUNTRY_VALUE(91) // FM
+#define cFaeroeIslands COUNTRY_VALUE(92) // FO
+#define cMetropolitanFrance COUNTRY_VALUE(93) // FX
+#define cGabon COUNTRY_VALUE(94) // GA
+#define cGrenada COUNTRY_VALUE(95) // GD
+#define cGeorgia COUNTRY_VALUE(96) // GE
+#define cFrenchGuiana COUNTRY_VALUE(97) // GF
+#define cGhana COUNTRY_VALUE(98) // GH
+#define cGibraltar COUNTRY_VALUE(99) // GI
+#define cGreenland COUNTRY_VALUE(100) // GL
+#define cGambia COUNTRY_VALUE(101) // GM
+#define cGuinea COUNTRY_VALUE(102) // GN
+#define cGuadeloupe COUNTRY_VALUE(103) // GP
+#define cEquatorialGuinea COUNTRY_VALUE(104) // GQ
+#define cGreece COUNTRY_VALUE(105) // GR
+#define cSouthGeorgiaAndTheSouthSandwichIslands COUNTRY_VALUE(106) // GS
+#define cGuatemala COUNTRY_VALUE(107) // GT
+#define cGuam COUNTRY_VALUE(108) // GU
+#define cGuineaBisseu COUNTRY_VALUE(109) // GW
+#define cGuyana COUNTRY_VALUE(110) // GY
+#define cHeardAndMcDonaldIslands COUNTRY_VALUE(111) // HM
+#define cHonduras COUNTRY_VALUE(112) // HN
+#define cCroatia COUNTRY_VALUE(113) // HR
+#define cHaiti COUNTRY_VALUE(114) // HT
+#define cHungary COUNTRY_VALUE(115) // HU
+#define cIsrael COUNTRY_VALUE(116) // IL
+#define cBritishIndianOceanTerritory COUNTRY_VALUE(117) // IO
+#define cIraq COUNTRY_VALUE(118) // IQ
+#define cIran COUNTRY_VALUE(119) // IR
+#define cJamaica COUNTRY_VALUE(120) // JM
+#define cJordan COUNTRY_VALUE(121) // JO
+#define cKenya COUNTRY_VALUE(122) // KE
+#define cKyrgyzstan COUNTRY_VALUE(123) // KG (Kirgistan)
+#define cCambodia COUNTRY_VALUE(124) // KH
+#define cKiribati COUNTRY_VALUE(125) // KI
+#define cComoros COUNTRY_VALUE(126) // KM
+#define cStKittsAndNevis COUNTRY_VALUE(127) // KN
+#define cDemocraticPeoplesRepublicOfKorea COUNTRY_VALUE(128) // KP
+#define cKuwait COUNTRY_VALUE(129) // KW
+#define cCaymanIslands COUNTRY_VALUE(130) // KY
+#define cKazakhstan COUNTRY_VALUE(131) // KK
+#define cLaos COUNTRY_VALUE(132) // LA
+#define cLebanon COUNTRY_VALUE(133) // LB
+#define cStLucia COUNTRY_VALUE(134) // LC
+#define cLiechtenstein COUNTRY_VALUE(135) // LI
+#define cSriLanka COUNTRY_VALUE(136) // LK
+#define cLiberia COUNTRY_VALUE(137) // LR
+#define cLesotho COUNTRY_VALUE(138) // LS
+#define cLithuania COUNTRY_VALUE(139) // LT
+#define cLatvia COUNTRY_VALUE(140) // LV
+#define cLibya COUNTRY_VALUE(141) // LY
+#define cMorrocco COUNTRY_VALUE(142) // MA
+#define cMonaco COUNTRY_VALUE(143) // MC
+#define cMoldova COUNTRY_VALUE(144) // MD
+#define cMadagascar COUNTRY_VALUE(145) // MG
+#define cMarshallIslands COUNTRY_VALUE(146) // MH
+#define cMacedonia COUNTRY_VALUE(147) // MK
+#define cMali COUNTRY_VALUE(148) // ML
+#define cMyanmar COUNTRY_VALUE(149) // MM
+#define cMongolia COUNTRY_VALUE(150) // MN
+#define cMacau COUNTRY_VALUE(151) // MO
+#define cNorthernMarianaIslands COUNTRY_VALUE(152) // MP
+#define cMartinique COUNTRY_VALUE(153) // MQ
+#define cMauritania COUNTRY_VALUE(154) // MR
+#define cMontserrat COUNTRY_VALUE(155) // MS
+#define cMalta COUNTRY_VALUE(156) // MT
+#define cMauritius COUNTRY_VALUE(157) // MU
+#define cMaldives COUNTRY_VALUE(158) // MV
+#define cMalawi COUNTRY_VALUE(159) // MW
+#define cMozambique COUNTRY_VALUE(160) // MZ
+#define cNamibia COUNTRY_VALUE(161) // NA
+#define cNewCaledonia COUNTRY_VALUE(162) // NC
+#define cNiger COUNTRY_VALUE(163) // NE
+#define cNorfolkIsland COUNTRY_VALUE(164) // NF
+#define cNigeria COUNTRY_VALUE(165) // NG
+#define cNicaragua COUNTRY_VALUE(166) // NI
+#define cNepal COUNTRY_VALUE(167) // NP
+#define cNauru COUNTRY_VALUE(168) // NR
+#define cNiue COUNTRY_VALUE(169) // NU
+#define cOman COUNTRY_VALUE(170) // OM
+#define cPanama COUNTRY_VALUE(171) // PA
+#define cPeru COUNTRY_VALUE(172) // PE
+#define cFrenchPolynesia COUNTRY_VALUE(173) // PF
+#define cPapuaNewGuinea COUNTRY_VALUE(174) // PG
+#define cPakistan COUNTRY_VALUE(175) // PK
+#define cPoland COUNTRY_VALUE(176) // PL
+#define cStPierreAndMiquelon COUNTRY_VALUE(177) // PM
+#define cPitcairn COUNTRY_VALUE(178) // PN
+#define cPuertoRico COUNTRY_VALUE(179) // PR
+#define cPortugal COUNTRY_VALUE(180) // PT
+#define cPalau COUNTRY_VALUE(181) // PW
+#define cParaguay COUNTRY_VALUE(182) // PY
+#define cQatar COUNTRY_VALUE(183) // QA
+#define cReunion COUNTRY_VALUE(184) // RE
+#define cRomania COUNTRY_VALUE(185) // RO
+#define cRussianFederation COUNTRY_VALUE(186) // RU
+#define cRwanda COUNTRY_VALUE(187) // RW
+#define cSaudiArabia COUNTRY_VALUE(188) // SA
+#define cSolomonIslands COUNTRY_VALUE(189) // SB
+#define cSeychelles COUNTRY_VALUE(190) // SC
+#define cSudan COUNTRY_VALUE(191) // SD
+#define cStHelena COUNTRY_VALUE(192) // SH
+#define cSlovenia COUNTRY_VALUE(193) // SI
+#define cSvalbardAndJanMayenIslands COUNTRY_VALUE(194) // SJ
+#define cSlovakia COUNTRY_VALUE(195) // SK
+#define cSierraLeone COUNTRY_VALUE(196) // SL
+#define cSanMarino COUNTRY_VALUE(197) // SM
+#define cSenegal COUNTRY_VALUE(198) // SN
+#define cSomalia COUNTRY_VALUE(199) // SO
+#define cSuriname COUNTRY_VALUE(200) // SR
+#define cSaoTomeAndPrincipe COUNTRY_VALUE(201) // ST
+#define cElSalvador COUNTRY_VALUE(202) // SV
+#define cSyranArabRepublic COUNTRY_VALUE(203) // SY
+#define cSwaziland COUNTRY_VALUE(204) // SZ
+#define cTurksAndCaicosIslands COUNTRY_VALUE(205) // TC
+#define cChad COUNTRY_VALUE(206) // TD
+#define cFrenchSouthernTerritories COUNTRY_VALUE(207) // TF
+#define cTogo COUNTRY_VALUE(208) // TG
+#define cTajikistan COUNTRY_VALUE(209) // TJ
+#define cTokelau COUNTRY_VALUE(210) // TK
+#define cTurkmenistan COUNTRY_VALUE(211) // TM
+#define cTunisia COUNTRY_VALUE(212) // TN
+#define cTonga COUNTRY_VALUE(213) // TO
+#define cEastTimor COUNTRY_VALUE(214) // TP
+#define cTurkey COUNTRY_VALUE(215) // TR
+#define cTrinidadAndTobago COUNTRY_VALUE(216) // TT
+#define cTuvalu COUNTRY_VALUE(217) // TV
+#define cTanzania COUNTRY_VALUE(218) // TZ
+#define cUkraine COUNTRY_VALUE(219) // UA
+#define cUganda COUNTRY_VALUE(220) // UG
+#define cUnitedStatesMinorOutlyingIslands COUNTRY_VALUE(221) // UM
+#define cUruguay COUNTRY_VALUE(222) // UY
+#define cUzbekistan COUNTRY_VALUE(223) // UZ
+#define cHolySee COUNTRY_VALUE(224) // VA
+#define cStVincentAndTheGrenadines COUNTRY_VALUE(225) // VC
+#define cVenezuela COUNTRY_VALUE(226) // VE
+#define cBritishVirginIslands COUNTRY_VALUE(227) // VG
+#define cUSVirginIslands COUNTRY_VALUE(228) // VI
+#define cVietNam COUNTRY_VALUE(229) // VN
+#define cVanuatu COUNTRY_VALUE(230) // VU
+#define cWallisAndFutunaIslands COUNTRY_VALUE(231) // WF
+#define cSamoa COUNTRY_VALUE(232) // WS
+#define cYemen COUNTRY_VALUE(233) // YE
+#define cMayotte COUNTRY_VALUE(234) // YT
+#define cYugoslavia COUNTRY_VALUE(235) // YU
+#define cSouthAfrica COUNTRY_VALUE(236) // ZA
+#define cZambia COUNTRY_VALUE(237) // ZM
+#define cZimbabwe COUNTRY_VALUE(238) // ZW
+//
+#define cCountryNum COUNTRY_VALUE(239) // Number of Countries
+
+/* Various character encodings supported by the PalmOS. Actually these
+are a mixture of character sets (repetoires or coded character sets
+in Internet lingo) and character encodings (CES - character encoding
+standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS
+encoding of the JIS character set + Microsoft's extensions).
+
+The following character set values are used by:
+ a) Palm devices
+ b) Palm wireless servers
+
+WARNING! Be aware that a device supporting a new character set
+ will require some character set definition and maybe
+ some development on the wireless server side.
+*/
+#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value)
+
+// Unknown to this version of PalmOS.
+#define charEncodingUnknown CHAR_ENCODING_VALUE(0)
+
+// Maximum character encoding _currently_ defined
+#define charEncodingMax CHAR_ENCODING_VALUE(83)
+
+// Latin Palm OS character encoding, and subsets.
+// PalmOS variant of CP1252, with 10 extra Greek characters
+#define charEncodingPalmGSM CHAR_ENCODING_VALUE(78)
+// PalmOS version of CP1252
+#define charEncodingPalmLatin CHAR_ENCODING_VALUE(3)
+// Windows variant of 8859-1
+#define charEncodingCP1252 CHAR_ENCODING_VALUE(7)
+// ISO 8859 Part 1
+#define charEncodingISO8859_1 CHAR_ENCODING_VALUE(2)
+// ISO 646-1991
+#define charEncodingAscii CHAR_ENCODING_VALUE(1)
+
+// Japanese Palm OS character encoding, and subsets.
+// PalmOS version of CP932
+#define charEncodingPalmSJIS CHAR_ENCODING_VALUE(5)
+// Windows variant of ShiftJIS
+#define charEncodingCP932 CHAR_ENCODING_VALUE(8)
+// Encoding for JIS 0208-1990 + 1-byte katakana
+#define charEncodingShiftJIS CHAR_ENCODING_VALUE(4)
+
+// Unicode character encodings
+#define charEncodingUCS2 CHAR_ENCODING_VALUE(9)
+#define charEncodingUTF8 CHAR_ENCODING_VALUE(6)
+#define charEncodingUTF7 CHAR_ENCODING_VALUE(24)
+#define charEncodingUTF16 CHAR_ENCODING_VALUE(75)
+#define charEncodingUTF16BE CHAR_ENCODING_VALUE(76)
+#define charEncodingUTF16LE CHAR_ENCODING_VALUE(77)
+
+// Latin character encodings
+#define charEncodingCP850 CHAR_ENCODING_VALUE(12)
+#define charEncodingCP437 CHAR_ENCODING_VALUE(13)
+#define charEncodingCP865 CHAR_ENCODING_VALUE(14)
+#define charEncodingCP860 CHAR_ENCODING_VALUE(15)
+#define charEncodingCP861 CHAR_ENCODING_VALUE(16)
+#define charEncodingCP863 CHAR_ENCODING_VALUE(17)
+#define charEncodingCP775 CHAR_ENCODING_VALUE(18)
+#define charEncodingMacIslande CHAR_ENCODING_VALUE(19)
+#define charEncodingMacintosh CHAR_ENCODING_VALUE(20)
+#define charEncodingCP1257 CHAR_ENCODING_VALUE(21)
+#define charEncodingISO8859_3 CHAR_ENCODING_VALUE(22)
+#define charEncodingISO8859_4 CHAR_ENCODING_VALUE(23)
+
+// Extended Latin character encodings
+#define charEncodingISO8859_2 CHAR_ENCODING_VALUE(26)
+#define charEncodingCP1250 CHAR_ENCODING_VALUE(27)
+#define charEncodingCP852 CHAR_ENCODING_VALUE(28)
+#define charEncodingXKamenicky CHAR_ENCODING_VALUE(29)
+#define charEncodingMacXCroate CHAR_ENCODING_VALUE(30)
+#define charEncodingMacXLat2 CHAR_ENCODING_VALUE(31)
+#define charEncodingMacXRomania CHAR_ENCODING_VALUE(32)
+
+// Japanese character encodings
+#define charEncodingEucJp CHAR_ENCODING_VALUE(25)
+#define charEncodingISO2022Jp CHAR_ENCODING_VALUE(10)
+#define charEncodingXAutoJp CHAR_ENCODING_VALUE(11)
+
+// Greek character encodings
+#define charEncodingISO8859_7 CHAR_ENCODING_VALUE(33)
+#define charEncodingCP1253 CHAR_ENCODING_VALUE(34)
+#define charEncodingCP869 CHAR_ENCODING_VALUE(35)
+#define charEncodingCP737 CHAR_ENCODING_VALUE(36)
+#define charEncodingMacXGr CHAR_ENCODING_VALUE(37)
+
+// Cyrillic character encodings
+#define charEncodingCP1251 CHAR_ENCODING_VALUE(38)
+#define charEncodingISO8859_5 CHAR_ENCODING_VALUE(39)
+#define charEncodingKoi8R CHAR_ENCODING_VALUE(40)
+#define charEncodingKoi8 CHAR_ENCODING_VALUE(41)
+#define charEncodingCP855 CHAR_ENCODING_VALUE(42)
+#define charEncodingCP866 CHAR_ENCODING_VALUE(43)
+#define charEncodingMacCyr CHAR_ENCODING_VALUE(44)
+#define charEncodingMacUkraine CHAR_ENCODING_VALUE(45)
+
+// Turkish character encodings
+#define charEncodingCP1254 CHAR_ENCODING_VALUE(46)
+#define charEncodingISO8859_9 CHAR_ENCODING_VALUE(47)
+#define charEncodingCP857 CHAR_ENCODING_VALUE(48)
+#define charEncodingMacTurc CHAR_ENCODING_VALUE(49)
+#define charEncodingCP853 CHAR_ENCODING_VALUE(50)
+
+// Arabic character encodings
+#define charEncodingISO8859_6 CHAR_ENCODING_VALUE(51)
+#define charEncodingAsmo708 CHAR_ENCODING_VALUE(52)
+#define charEncodingCP1256 CHAR_ENCODING_VALUE(53)
+#define charEncodingCP864 CHAR_ENCODING_VALUE(54)
+#define charEncodingAsmo708Plus CHAR_ENCODING_VALUE(55)
+#define charEncodingAsmo708Fr CHAR_ENCODING_VALUE(56)
+#define charEncodingMacAra CHAR_ENCODING_VALUE(57)
+
+// Simplified Chinese character encodings
+#define charEncodingGB2312 CHAR_ENCODING_VALUE(58)
+#define charEncodingHZ CHAR_ENCODING_VALUE(59)
+#define charEncodingGBK CHAR_ENCODING_VALUE(82)
+#define charEncodingPalmGB CHAR_ENCODING_VALUE(83)
+
+// Traditional Chinese character encodings
+#define charEncodingBig5 CHAR_ENCODING_VALUE(60)
+#define charEncodingBig5_HKSCS CHAR_ENCODING_VALUE(79)
+#define charEncodingBig5Plus CHAR_ENCODING_VALUE(80)
+#define charEncodingPalmBig5 CHAR_ENCODING_VALUE(81)
+
+// Vietnamese character encodings
+#define charEncodingViscii CHAR_ENCODING_VALUE(61)
+#define charEncodingViqr CHAR_ENCODING_VALUE(62)
+#define charEncodingVncii CHAR_ENCODING_VALUE(63)
+#define charEncodingVietnet CHAR_ENCODING_VALUE(65)
+#define charEncodingCP1258 CHAR_ENCODING_VALUE(66)
+
+// Korean character encodings
+#define charEncodingKsc5601 CHAR_ENCODING_VALUE(67)
+#define charEncodingCP949 CHAR_ENCODING_VALUE(68)
+#define charEncodingISO2022Kr CHAR_ENCODING_VALUE(69)
+
+// Hebrew character encodings
+#define charEncodingISO8859_8I CHAR_ENCODING_VALUE(70)
+#define charEncodingISO8859_8 CHAR_ENCODING_VALUE(71)
+#define charEncodingCP1255 CHAR_ENCODING_VALUE(72)
+#define charEncodingCP1255V CHAR_ENCODING_VALUE(73)
+
+// Thai character encodings
+#define charEncodingTis620 CHAR_ENCODING_VALUE(74)
+#define charEncodingCP874 CHAR_ENCODING_VALUE(64)
+
+
+// Leave the following line unchanged at end of section:
+// TAG SOURCE END
+
+/* Rez doesn't even support macros, so for Rez we simplify all of the #defines.
+
+WARNING! This section is auto-generated (see comment near top of file).
+*/
+#else // !PALM_LOCALE_HAS_TYPES
+
+// Leave the following line unchanged at beginning of rez section
+// TAG DESTINATION START
+
+#define lEnglish 0 // EN
+#define lFrench 1 // FR
+#define lGerman 2 // DE
+#define lItalian 3 // IT
+#define lSpanish 4 // ES
+#define lUnused 5 // Reserved
+
+// New in 3.1
+#define lJapanese 6 // JA (Palm calls this jp)
+#define lDutch 7 // NL
+
+// New in 4.0
+#define lAfar 8 // AA
+#define lAbkhazian 9 // AB
+#define lAfrikaans 10 // AF
+#define lAmharic 11 // AM
+#define lArabic 12 // AR
+#define lAssamese 13 // AS
+#define lAymara 14 // AY
+#define lAzerbaijani 15 // AZ
+#define lBashkir 16 // BA
+#define lByelorussian 17 // BE
+#define lBulgarian 18 // BG
+#define lBihari 19 // BH
+#define lBislama 20 // BI
+#define lBengali 21 // BN (Bangla)
+#define lTibetan 22 // BO
+#define lBreton 23 // BR
+#define lCatalan 24 // CA
+#define lCorsican 25 // CO
+#define lCzech 26 // CS
+#define lWelsh 27 // CY
+#define lDanish 28 // DA
+#define lBhutani 29 // DZ
+#define lGreek 30 // EL
+#define lEsperanto 31 // EO
+#define lEstonian 32 // ET
+#define lBasque 33 // EU
+#define lPersian 34 // FA (Farsi)
+#define lFinnish 35 // FI
+#define lFiji 36 // FJ
+#define lFaroese 37 // FO
+#define lFrisian 38 // FY
+#define lIrish 39 // GA
+#define lScotsGaelic 40 // GD
+#define lGalician 41 // GL
+#define lGuarani 42 // GN
+#define lGujarati 43 // GU
+#define lHausa 44 // HA
+#define lHindi 45 // HI
+#define lCroatian 46 // HR
+#define lHungarian 47 // HU
+#define lArmenian 48 // HY
+#define lInterlingua 49 // IA
+#define lInterlingue 50 // IE
+#define lInupiak 51 // IK
+#define lIndonesian 52 // IN
+#define lIcelandic 53 // IS
+#define lHebrew 54 // IW
+#define lYiddish 55 // JI
+#define lJavanese 56 // JW
+#define lGeorgian 57 // KA
+#define lKazakh 58 // KK
+#define lGreenlandic 59 // KL
+#define lCambodian 60 // KM
+#define lKannada 61 // KN
+#define lKorean 62 // KO
+#define lKashmiri 63 // KS
+#define lKurdish 64 // KU
+#define lKirghiz 65 // KY
+#define lLatin 66 // LA
+#define lLingala 67 // LN
+#define lLaothian 68 // LO
+#define lLithuanian 69 // LT
+#define lLatvian 70 // LV (Lettish)
+#define lMalagasy 71 // MG
+#define lMaori 72 // MI
+#define lMacedonian 73 // MK
+#define lMalayalam 74 // ML
+#define lMongolian 75 // MN
+#define lMoldavian 76 // MO
+#define lMarathi 77 // MR
+#define lMalay 78 // MS
+#define lMaltese 79 // MT
+#define lBurmese 80 // MY
+#define lNauru 81 // NA
+#define lNepali 82 // NE
+#define lNorwegian 83 // NO
+#define lOccitan 84 // OC
+#define lAfan 85 // OM (Oromo)
+#define lOriya 86 // OR
+#define lPunjabi 87 // PA
+#define lPolish 88 // PL
+#define lPashto 89 // PS (Pushto)
+#define lPortuguese 90 // PT
+#define lQuechua 91 // QU
+#define lRhaetoRomance 92 // RM
+#define lKurundi 93 // RN
+#define lRomanian 94 // RO
+#define lRussian 95 // RU
+#define lKinyarwanda 96 // RW
+#define lSanskrit 97 // SA
+#define lSindhi 98 // SD
+#define lSangho 99 // SG
+#define lSerboCroatian 100 // SH
+#define lSinghalese 101 // SI
+#define lSlovak 102 // SK
+#define lSlovenian 103 // SL
+#define lSamoan 104 // SM
+#define lShona 105 // SN
+#define lSomali 106 // SO
+#define lAlbanian 107 // SQ
+#define lSerbian 108 // SR
+#define lSiswati 109 // SS
+#define lSesotho 110 // ST
+#define lSudanese 111 // SU
+#define lSwedish 112 // SV
+#define lSwahili 113 // SW
+#define lTamil 114 // TA
+#define lTelugu 115 // TE
+#define lTajik 116 // TG
+#define lThai 117 // TH
+#define lTigrinya 118 // TI
+#define lTurkmen 119 // TK
+#define lTagalog 120 // TL
+#define lSetswana 121 // TN
+#define lTonga 122 // TO
+#define lTurkish 123 // TR
+#define lTsonga 124 // TS
+#define lTatar 125 // TT
+#define lTwi 126 // TW
+#define lUkrainian 127 // UK
+#define lUrdu 128 // UR
+#define lUzbek 129 // UZ
+#define lVietnamese 130 // VI
+#define lVolapuk 131 // VO
+#define lWolof 132 // WO
+#define lXhosa 133 // XH
+#define lYoruba 134 // YO
+#define lChinese 135 // ZH
+#define lZulu 136 // ZU
+//
+#define lLanguageNum 137 // Number of Languages
+
+/* Country codes (ISO 3166). The first 33 preserve the old values for the
+deprecated CountryType; the rest are sorted by the 2-character country code.
+
+WARNING! Keep in sync with BOTH:
+ 1) CountryCode array in OverlayMgr.c
+ 2) localeCountry #define in UIResDefs.r
+*/
+#define COUNTRY_VALUE(value) ((CountryType)value)
+
+#define cAustralia 0 // AU
+#define cAustria 1 // AT
+#define cBelgium 2 // BE
+#define cBrazil 3 // BR
+#define cCanada 4 // CA
+#define cDenmark 5 // DK
+#define cFinland 6 // FI
+#define cFrance 7 // FR
+#define cGermany 8 // DE
+#define cHongKong 9 // HK
+#define cIceland 10 // IS
+#define cIreland 11 // IE
+#define cItaly 12 // IT
+#define cJapan 13 // JP
+#define cLuxembourg 14 // LU
+#define cMexico 15 // MX
+#define cNetherlands 16 // NL
+#define cNewZealand 17 // NZ
+#define cNorway 18 // NO
+#define cSpain 19 // ES
+#define cSweden 20 // SE
+#define cSwitzerland 21 // CH
+#define cUnitedKingdom 22 // GB (UK)
+#define cUnitedStates 23 // US
+#define cIndia 24 // IN
+#define cIndonesia 25 // ID
+#define cRepublicOfKorea 26 // KR
+#define cMalaysia 27 // MY
+#define cChina 28 // CN
+#define cPhilippines 29 // PH
+#define cSingapore 30 // SG
+#define cThailand 31 // TH
+#define cTaiwan 32 // TW
+
+// New in 4.0
+#define cAndorra 33 // AD
+#define cUnitedArabEmirates 34 // AE
+#define cAfghanistan 35 // AF
+#define cAntiguaAndBarbuda 36 // AG
+#define cAnguilla 37 // AI
+#define cAlbania 38 // AL
+#define cArmenia 39 // AM
+#define cNetherlandsAntilles 40 // AN
+#define cAngola 41 // AO
+#define cAntarctica 42 // AQ
+#define cArgentina 43 // AR
+#define cAmericanSamoa 44 // AS
+#define cAruba 45 // AW
+#define cAzerbaijan 46 // AZ
+#define cBosniaAndHerzegovina 47 // BA
+#define cBarbados 48 // BB
+#define cBangladesh 49 // BD
+#define cBurkinaFaso 50 // BF
+#define cBulgaria 51 // BG
+#define cBahrain 52 // BH
+#define cBurundi 53 // BI
+#define cBenin 54 // BJ
+#define cBermuda 55 // BM
+#define cBruneiDarussalam 56 // BN
+#define cBolivia 57 // BO
+#define cBahamas 58 // BS
+#define cBhutan 59 // BT
+#define cBouvetIsland 60 // BV
+#define cBotswana 61 // BW
+#define cBelarus 62 // BY
+#define cBelize 63 // BZ
+#define cCocosIslands 64 // CC
+#define cDemocraticRepublicOfTheCongo 65 // CD
+#define cCentralAfricanRepublic 66 // CF
+#define cCongo 67 // CG
+#define cIvoryCoast 68 // CI
+#define cCookIslands 69 // CK
+#define cChile 70 // CL
+#define cCameroon 71 // CM
+#define cColumbia 72 // CO
+#define cCostaRica 73 // CR
+#define cCuba 74 // CU
+#define cCapeVerde 75 // CV
+#define cChristmasIsland 76 // CX
+#define cCyprus 77 // CY
+#define cCzechRepublic 78 // CZ
+#define cDjibouti 79 // DJ
+#define cDominica 80 // DM
+#define cDominicanRepublic 81 // DO
+#define cAlgeria 82 // DZ
+#define cEcuador 83 // EC
+#define cEstonia 84 // EE
+#define cEgypt 85 // EG
+#define cWesternSahara 86 // EH
+#define cEritrea 87 // ER
+#define cEthiopia 88 // ET
+#define cFiji 89 // FJ
+#define cFalklandIslands 90 // FK
+#define cMicronesia 91 // FM
+#define cFaeroeIslands 92 // FO
+#define cMetropolitanFrance 93 // FX
+#define cGabon 94 // GA
+#define cGrenada 95 // GD
+#define cGeorgia 96 // GE
+#define cFrenchGuiana 97 // GF
+#define cGhana 98 // GH
+#define cGibraltar 99 // GI
+#define cGreenland 100 // GL
+#define cGambia 101 // GM
+#define cGuinea 102 // GN
+#define cGuadeloupe 103 // GP
+#define cEquatorialGuinea 104 // GQ
+#define cGreece 105 // GR
+#define cSouthGeorgiaAndTheSouthSandwichIslands 106 // GS
+#define cGuatemala 107 // GT
+#define cGuam 108 // GU
+#define cGuineaBisseu 109 // GW
+#define cGuyana 110 // GY
+#define cHeardAndMcDonaldIslands 111 // HM
+#define cHonduras 112 // HN
+#define cCroatia 113 // HR
+#define cHaiti 114 // HT
+#define cHungary 115 // HU
+#define cIsrael 116 // IL
+#define cBritishIndianOceanTerritory 117 // IO
+#define cIraq 118 // IQ
+#define cIran 119 // IR
+#define cJamaica 120 // JM
+#define cJordan 121 // JO
+#define cKenya 122 // KE
+#define cKyrgyzstan 123 // KG (Kirgistan)
+#define cCambodia 124 // KH
+#define cKiribati 125 // KI
+#define cComoros 126 // KM
+#define cStKittsAndNevis 127 // KN
+#define cDemocraticPeoplesRepublicOfKorea 128 // KP
+#define cKuwait 129 // KW
+#define cCaymanIslands 130 // KY
+#define cKazakhstan 131 // KK
+#define cLaos 132 // LA
+#define cLebanon 133 // LB
+#define cStLucia 134 // LC
+#define cLiechtenstein 135 // LI
+#define cSriLanka 136 // LK
+#define cLiberia 137 // LR
+#define cLesotho 138 // LS
+#define cLithuania 139 // LT
+#define cLatvia 140 // LV
+#define cLibya 141 // LY
+#define cMorrocco 142 // MA
+#define cMonaco 143 // MC
+#define cMoldova 144 // MD
+#define cMadagascar 145 // MG
+#define cMarshallIslands 146 // MH
+#define cMacedonia 147 // MK
+#define cMali 148 // ML
+#define cMyanmar 149 // MM
+#define cMongolia 150 // MN
+#define cMacau 151 // MO
+#define cNorthernMarianaIslands 152 // MP
+#define cMartinique 153 // MQ
+#define cMauritania 154 // MR
+#define cMontserrat 155 // MS
+#define cMalta 156 // MT
+#define cMauritius 157 // MU
+#define cMaldives 158 // MV
+#define cMalawi 159 // MW
+#define cMozambique 160 // MZ
+#define cNamibia 161 // NA
+#define cNewCaledonia 162 // NC
+#define cNiger 163 // NE
+#define cNorfolkIsland 164 // NF
+#define cNigeria 165 // NG
+#define cNicaragua 166 // NI
+#define cNepal 167 // NP
+#define cNauru 168 // NR
+#define cNiue 169 // NU
+#define cOman 170 // OM
+#define cPanama 171 // PA
+#define cPeru 172 // PE
+#define cFrenchPolynesia 173 // PF
+#define cPapuaNewGuinea 174 // PG
+#define cPakistan 175 // PK
+#define cPoland 176 // PL
+#define cStPierreAndMiquelon 177 // PM
+#define cPitcairn 178 // PN
+#define cPuertoRico 179 // PR
+#define cPortugal 180 // PT
+#define cPalau 181 // PW
+#define cParaguay 182 // PY
+#define cQatar 183 // QA
+#define cReunion 184 // RE
+#define cRomania 185 // RO
+#define cRussianFederation 186 // RU
+#define cRwanda 187 // RW
+#define cSaudiArabia 188 // SA
+#define cSolomonIslands 189 // SB
+#define cSeychelles 190 // SC
+#define cSudan 191 // SD
+#define cStHelena 192 // SH
+#define cSlovenia 193 // SI
+#define cSvalbardAndJanMayenIslands 194 // SJ
+#define cSlovakia 195 // SK
+#define cSierraLeone 196 // SL
+#define cSanMarino 197 // SM
+#define cSenegal 198 // SN
+#define cSomalia 199 // SO
+#define cSuriname 200 // SR
+#define cSaoTomeAndPrincipe 201 // ST
+#define cElSalvador 202 // SV
+#define cSyranArabRepublic 203 // SY
+#define cSwaziland 204 // SZ
+#define cTurksAndCaicosIslands 205 // TC
+#define cChad 206 // TD
+#define cFrenchSouthernTerritories 207 // TF
+#define cTogo 208 // TG
+#define cTajikistan 209 // TJ
+#define cTokelau 210 // TK
+#define cTurkmenistan 211 // TM
+#define cTunisia 212 // TN
+#define cTonga 213 // TO
+#define cEastTimor 214 // TP
+#define cTurkey 215 // TR
+#define cTrinidadAndTobago 216 // TT
+#define cTuvalu 217 // TV
+#define cTanzania 218 // TZ
+#define cUkraine 219 // UA
+#define cUganda 220 // UG
+#define cUnitedStatesMinorOutlyingIslands 221 // UM
+#define cUruguay 222 // UY
+#define cUzbekistan 223 // UZ
+#define cHolySee 224 // VA
+#define cStVincentAndTheGrenadines 225 // VC
+#define cVenezuela 226 // VE
+#define cBritishVirginIslands 227 // VG
+#define cUSVirginIslands 228 // VI
+#define cVietNam 229 // VN
+#define cVanuatu 230 // VU
+#define cWallisAndFutunaIslands 231 // WF
+#define cSamoa 232 // WS
+#define cYemen 233 // YE
+#define cMayotte 234 // YT
+#define cYugoslavia 235 // YU
+#define cSouthAfrica 236 // ZA
+#define cZambia 237 // ZM
+#define cZimbabwe 238 // ZW
+//
+#define cCountryNum 239 // Number of Countries
+
+/* Various character encodings supported by the PalmOS. Actually these
+are a mixture of character sets (repetoires or coded character sets
+in Internet lingo) and character encodings (CES - character encoding
+standard). Many, however, are some of both (e.g. CP932 is the Shift-JIS
+encoding of the JIS character set + Microsoft's extensions).
+
+The following character set values are used by:
+ a) Palm devices
+ b) Palm wireless servers
+
+WARNING! Be aware that a device supporting a new character set
+ will require some character set definition and maybe
+ some development on the wireless server side.
+*/
+
+
+///////////////////////////////////////////////////////////////////////////
+// Warning: The following files are interdependent and MUST to be modified together:
+//
+// -> Viewer\Incs\Core\System\PalmLocale.h
+// (defines charset IDs)
+//
+// -> Server\apps\Elaine\Src\Core\CharsetInfo.cpp
+// (defines charset attributes like Asian, cp1252 compatible, etc.)
+//
+// -> Server\CstPalmOSCharsets.lst
+// (list the iso names of
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+#define CHAR_ENCODING_VALUE(value) ((CharEncodingType)value)
+
+// Unknown to this version of PalmOS.
+#define charEncodingUnknown 0
+
+// Maximum character encoding _currently_ defined
+
+#define charEncodingMax 83
+
+// Latin Palm OS character encoding, and subsets.
+// PalmOS variant of CP1252, with 10 extra Greek characters
+#define charEncodingPalmGSM 78
+// PalmOS version of CP1252
+#define charEncodingPalmLatin 3
+// Windows variant of 8859-1
+#define charEncodingCP1252 7
+// ISO 8859 Part 1
+#define charEncodingISO8859_1 2
+// ISO 646-1991
+#define charEncodingAscii 1
+
+// Japanese Palm OS character encoding, and subsets.
+// PalmOS version of CP932
+#define charEncodingPalmSJIS 5
+// Windows variant of ShiftJIS
+#define charEncodingCP932 8
+// Encoding for JIS 0208-1990 + 1-byte katakana
+#define charEncodingShiftJIS 4
+
+// Unicode character encodings
+#define charEncodingUCS2 9
+#define charEncodingUTF8 6
+#define charEncodingUTF7 24
+#define charEncodingUTF16 75
+#define charEncodingUTF16BE 76
+#define charEncodingUTF16LE 77
+
+// Latin character encodings
+#define charEncodingCP850 12
+#define charEncodingCP437 13
+#define charEncodingCP865 14
+#define charEncodingCP860 15
+#define charEncodingCP861 16
+#define charEncodingCP863 17
+#define charEncodingCP775 18
+#define charEncodingMacIslande 19
+#define charEncodingMacintosh 20
+#define charEncodingCP1257 21
+#define charEncodingISO8859_3 22
+#define charEncodingISO8859_4 23
+
+// Extended Latin character encodings
+#define charEncodingISO8859_2 26
+#define charEncodingCP1250 27
+#define charEncodingCP852 28
+#define charEncodingXKamenicky 29
+#define charEncodingMacXCroate 30
+#define charEncodingMacXLat2 31
+#define charEncodingMacXRomania 32
+
+// Japanese character encodings
+#define charEncodingEucJp 25
+#define charEncodingISO2022Jp 10
+#define charEncodingXAutoJp 11
+
+// Greek character encodings
+#define charEncodingISO8859_7 33
+#define charEncodingCP1253 34
+#define charEncodingCP869 35
+#define charEncodingCP737 36
+#define charEncodingMacXGr 37
+
+// Cyrillic character encodings
+#define charEncodingCP1251 38
+#define charEncodingISO8859_5 39
+#define charEncodingKoi8R 40
+#define charEncodingKoi8 41
+#define charEncodingCP855 42
+#define charEncodingCP866 43
+#define charEncodingMacCyr 44
+#define charEncodingMacUkraine 45
+
+// Turkish character encodings
+#define charEncodingCP1254 46
+#define charEncodingISO8859_9 47
+#define charEncodingCP857 48
+#define charEncodingMacTurc 49
+#define charEncodingCP853 50
+
+// Arabic character encodings
+#define charEncodingISO8859_6 51
+#define charEncodingAsmo708 52
+#define charEncodingCP1256 53
+#define charEncodingCP864 54
+#define charEncodingAsmo708Plus 55
+#define charEncodingAsmo708Fr 56
+#define charEncodingMacAra 57
+
+// Simplified Chinese character encodings
+#define charEncodingGB2312 58
+#define charEncodingHZ 59
+#define charEncodingGBK 82
+#define charEncodingPalmGB 83
+
+// Traditional Chinese character encodings
+#define charEncodingBig5 60
+#define charEncodingBig5_HKSCS 79
+#define charEncodingBig5Plus 80
+#define charEncodingPalmBig5 81
+
+// Vietnamese character encodings
+#define charEncodingViscii 61
+#define charEncodingViqr 62
+#define charEncodingVncii 63
+#define charEncodingVietnet 65
+#define charEncodingCP1258 66
+
+// Korean character encodings
+#define charEncodingKsc5601 67
+#define charEncodingCP949 68
+#define charEncodingISO2022Kr 69
+
+// Hebrew character encodings
+#define charEncodingISO8859_8I 70
+#define charEncodingISO8859_8 71
+#define charEncodingCP1255 72
+#define charEncodingCP1255V 73
+
+// Thai character encodings
+#define charEncodingTis620 74
+#define charEncodingCP874 64
+
+
+// Leave the following line unchanged at end of section
+// TAG DESTINATION END
+
+#endif // !PALM_LOCALE_HAS_TYPES
+
+#endif // __PALMLOCALE_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h
new file mode 100644
index 0000000..538c9ac
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/PenMgr.h
@@ -0,0 +1,98 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PenMgr.h
+ *
+ * Description:
+ * Include file for Pen manager
+ *
+ * History:
+ * 6/5/96 Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __PEN_MGR_H
+#define __PEN_MGR_H
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <ErrorBase.h>
+#include <Rect.h>
+
+
+/********************************************************************
+ * Pen Manager Errors
+ * the constant serErrorClass is defined in ErrorBase.h
+ ********************************************************************/
+#define penErrBadParam (penErrorClass | 1)
+#define penErrIgnorePoint (penErrorClass | 2)
+
+
+
+/********************************************************************
+ * Pen manager Routines
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Initializes the Pen Manager
+Err PenOpen(void)
+ SYS_TRAP(sysTrapPenOpen);
+
+// Closes the Pen Manager and frees whatever memory it allocated
+Err PenClose(void)
+ SYS_TRAP(sysTrapPenClose);
+
+
+// Put pen to sleep
+Err PenSleep(void)
+ SYS_TRAP(sysTrapPenSleep);
+
+// Wake pen
+Err PenWake(void)
+ SYS_TRAP(sysTrapPenWake);
+
+
+// Get the raw pen coordinates from the hardware.
+Err PenGetRawPen(PointType *penP)
+ SYS_TRAP(sysTrapPenGetRawPen);
+
+// Reset calibration in preparation for setting it again
+Err PenResetCalibration (void)
+ SYS_TRAP(sysTrapPenResetCalibration);
+
+// Set calibration settings for the pen
+Err PenCalibrate (PointType *digTopLeftP, PointType *digBotRightP,
+ PointType *scrTopLeftP, PointType *scrBotRightP)
+ SYS_TRAP(sysTrapPenCalibrate);
+
+// Scale a raw pen coordinate into screen coordinates
+Err PenRawToScreen(PointType *penP)
+ SYS_TRAP(sysTrapPenRawToScreen);
+
+// Scale a screen pen coordinate back into a raw coordinate
+Err PenScreenToRaw(PointType *penP)
+ SYS_TRAP(sysTrapPenScreenToRaw);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _PenGetRawPen \
+ ASM_SYS_TRAP(sysTrapPenGetRawPen)
+
+
+
+#endif //__PEN_MGR_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h b/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h
new file mode 100644
index 0000000..726055b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Preferences.h
@@ -0,0 +1,428 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Preferences.h
+ *
+ * Release:
+ *
+ * Description:
+ * Header for the system preferences
+ *
+ * History:
+ * 02/31/95 rsf Created by Roger Flores
+ * 06/26/99 kwk Added LanguageType.
+ * 06/30/99 CS Added MeasurementSystemType, then added it to both
+ * CountryPreferencesType and SystemPreferencesType,
+ * and bumped the version to 7.
+ * CS Added prefMeasurementSystem to select this
+ * preference.
+ * CS Added filler fields to CountryPreferencesType
+ * structure, since this guy gets saved as a
+ * resource.
+ * 09/20/99 gap added additional cXXXX country values.
+ * 09/20/99 gap cPRC -> cRepChina.
+ * 10/4/99 jmp Add support for auto-off duration times in seconds
+ * instead of minutes (the new seconds-based auto-off
+ * duration time is preferred; the minutes-based auto-ff
+ * duration times are maintained for compatibility).
+ * 10/5/99 jmp Make the seconds auto-off duration field a UInt16
+ * instead of a UInt8; also define constants for the
+ * "pegged" auto-off duration values (when the value
+ * is pegged, we no longer automatically shut off).
+ * 12/23/99 jmp Fix <> vs. "" problem.
+ * 04/30/00 CS Use LmCountryType instead of CountryType. Also removed
+ * deprecated countryNameLength, currencyNameLength, and
+ * currencySymbolLength, replacing usage with new
+ * kMaxCountryNameLen, kMaxCurrencyNameLen, and
+ * kMaxCurrencySymbolLen.
+ * 05/16/00 CS LmCountryType/LmLanguageType are now back to
+ * CountryType/LanguageType.
+ * 08/01/00 CS Added prefLanguage & prefLocale to selector set, and
+ * locale to SystemPreferencesType.
+ * 08/01/00 kwk Added timeZoneCountry to SystemPreferencesType, and
+ * prefTimeZoneCountry to SystemPreferencesChoice.
+ * 08/08/00 CS Moved obsolete CountryPreferencesType to RezConvert.cp,
+ * since that's the only code that still needs access to
+ * this private, obsolete resource.
+ * 08/08/00 peter Added attentionFlags to SystemPreferencesType, and
+ * prefAttentionFlags to SystemPreferencesChoice.
+ * 11/07/00 grant Added button default assignment resource type.
+ *
+ *****************************************************************************/
+
+#ifndef __PREFERENCES_H__
+#define __PREFERENCES_H__
+
+#include <DateTime.h>
+#include <Localize.h>
+#include <SystemMgr.h>
+#include <LocaleMgr.h> // CountryType, kMaxCountryNameLen, etc.
+#include <AttentionMgr.h> // AttnFlagsType
+
+/***********************************************************************
+ * Constants
+ ***********************************************************************/
+
+#define noPreferenceFound -1
+
+// Preference version constants
+#define preferenceDataVer2 2 // Palm OS 2.0
+#define preferenceDataVer3 3 // Palm OS 3.0
+#define preferenceDataVer4 4 // Palm OS 3.1
+#define preferenceDataVer5 5 // Palm OS 3.2a
+#define preferenceDataVer6 6 // Palm OS 3.2b/3.3
+#define preferenceDataVer8 8 // Palm OS 3.5
+#define preferenceDataVer9 9 // Palm OS 4.0
+
+// Be SURE to update "preferenceDataVerLatest" when adding a new prefs version...
+#define preferenceDataVerLatest preferenceDataVer9
+
+
+#define defaultAutoOffDuration 2 // minutes
+#define defaultAutoOffDurationSecs (2 * minutesInSeconds) // seconds
+
+#define peggedAutoOffDuration 0xFF // minutes (UInt8)
+#define peggedAutoOffDurationSecs 0xFFFF // seconds (UInt16)
+
+#define defaultAutoLockType never //Never auto lock device
+#define defaultAutoLockTime 0
+#define defaultAutoLockTimeFlag 0
+
+// Obsolete after V20
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define defaultSysSoundLevel slOn
+ #define defaultGameSoundLevel slOn
+ #define defaultAlarmSoundLevel slOn
+#else // EMULATION_LEVEL != EMULATION_NONE
+ #define defaultSysSoundLevel slOff
+ #define defaultGameSoundLevel slOff
+ #define defaultAlarmSoundLevel slOn
+#endif
+
+
+#if EMULATION_LEVEL == EMULATION_NONE
+ #define defaultSysSoundVolume sndMaxAmp
+ #define defaultGameSoundVolume sndMaxAmp
+ #define defaultAlarmSoundVolume sndMaxAmp
+#else // EMULATION_LEVEL != EMULATION_NONE
+ #define defaultSysSoundVolume 0
+ #define defaultGameSoundVolume 0
+ #define defaultAlarmSoundVolume sndMaxAmp
+#endif
+
+typedef enum
+ {
+ unitsEnglish = 0, // Feet, yards, miles, gallons, pounds, slugs, etc.
+ unitsMetric // Meters, liters, grams, newtons, etc.
+ } MeasurementSystemType;
+
+
+// These sound levels must corrospond to positions in the popup lists
+// used by the preferences app. These are made obsolete after V20. The
+// loudness of the sound is now represented as a number from 0 to sndMaxAmp.
+typedef enum {
+ slOn = 0,
+ slOff = 1
+ } SoundLevelTypeV20;
+
+// Device Automatic Locking options.
+typedef enum {
+ never = 0, //Auto-Lock disabled.
+ uponPowerOff, // Auto lock when the device powers off.
+ atPresetTime, //Auto lock at HH:MM every day.
+ afterPresetDelay //Auto lock after x minutes or hours.
+ } SecurityAutoLockType;
+
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+typedef enum {
+ alOff, // Never show an animation
+ alEventsOnly, // Show an animation for an event
+ alEventsAndRandom, // Also show random animation
+ alEventsAndMoreRandom // Show random animations more frequently
+ } AnimationLevelType;
+
+
+typedef enum
+ {
+ prefVersion,
+ prefCountry,
+ prefDateFormat,
+ prefLongDateFormat,
+ prefWeekStartDay,
+ prefTimeFormat,
+ prefNumberFormat,
+ prefAutoOffDuration, // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes)
+ prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds
+ prefGameSoundLevelV20, // slOn or slOff - game sound effects
+ prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects
+ prefHidePrivateRecordsV33,
+ prefDeviceLocked,
+ prefLocalSyncRequiresPassword,
+ prefRemoteSyncRequiresPassword,
+ prefSysBatteryKind,
+ prefAllowEasterEggs,
+ prefMinutesWestOfGMT, // deprecated old unsigned minutes EAST of GMT
+ prefDaylightSavings, // deprecated old daylight saving time rule
+ prefRonamaticChar,
+ prefHard1CharAppCreator, // App creator for hard key #1
+ prefHard2CharAppCreator, // App creator for hard key #2
+ prefHard3CharAppCreator, // App creator for hard key #3
+ prefHard4CharAppCreator, // App creator for hard key #4
+ prefCalcCharAppCreator, // App creator for calculator soft key
+ prefHardCradleCharAppCreator, // App creator for hard cradle key
+ prefLauncherAppCreator, // App creator for launcher soft key
+ prefSysPrefFlags,
+ prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key
+ prefAnimationLevel,
+
+ // Additions for PalmOS 3.0:
+ prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds
+ prefGameSoundVolume, // actual amplitude - game sound effects
+ prefAlarmSoundVolume, // actual amplitude - alarm sound effects
+ prefBeamReceive, // not used - use ExgLibControl with ir(Get/Set)ScanningMode instead
+ prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time
+ prefSystemKeyboardID, // ID of the preferred keyboard resource
+ prefDefSerialPlugIn, // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current
+ prefStayLitWhenPluggedIn, // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ prefAntennaCharAppCreator, // App creator for antenna key
+
+ // Additions for PalmOS 3.3:
+ prefMeasurementSystem, // English, Metric, etc.
+
+ // Additions for PalmOS 3.5:
+ prefShowPrivateRecords, // returns privateRecordViewEnum
+ prefAutoOffDurationSecs, // auto-off duration in seconds
+
+ // Additions for PalmOS 4.0:
+ prefTimeZone, // GMT offset in minutes, + for east of GMT, - for west
+ prefDaylightSavingAdjustment, // current DST adjustment in minutes (typically 0 or 60)
+
+ prefAutoLockType, // Never, on poweroff, after preset delay or at preset time.
+ prefAutoLockTime, // Auto lock preset time or delay.
+ prefAutoLockTimeFlag, // For Minutes or Hours.
+
+ prefLanguage, // Language spoken in country selected via Setup app/Formats panel
+ prefLocale, // Locale for country selected via Setup app/Formats panel
+
+ prefTimeZoneCountry, // Country used to specify time zone.
+
+ prefAttentionFlags, // User prefs for getting user's attention
+
+ prefDefaultAppCreator // Default application launched on reset.
+
+ } SystemPreferencesChoice;
+
+
+typedef struct {
+ UInt16 version; // Version of preference info
+
+ // International preferences
+ CountryType country; // Country the device is in
+ DateFormatType dateFormat; // Format to display date in
+ DateFormatType longDateFormat; // Format to display date in
+ UInt8 weekStartDay; // Sunday or Monday
+ TimeFormatType timeFormat; // Format to display time in
+ NumberFormatType numberFormat; // Format to display numbers in
+
+ // system preferences
+ UInt8 autoOffDuration; // Time period before shutting off (in minutes)
+ SoundLevelTypeV20 sysSoundLevel; // slOn or slOff - error beeps and other non-alarm sounds
+ SoundLevelTypeV20 alarmSoundLevel; // slOn or slOff - alarm only
+ Boolean hideSecretRecords; // True to not display records with
+ // their secret bit attribute set
+ Boolean deviceLocked; // Device locked until the system
+ // password is entered
+ UInt8 reserved1;
+ UInt16 sysPrefFlags; // Miscellaneous system pref flags
+ // copied into the global GSysPrefFlags
+ // at boot time.
+ SysBatteryKind sysBatteryKind; // The type of batteries installed. This
+ // is copied into the globals GSysbatteryKind
+ // at boot time.
+ UInt8 reserved2;
+
+ } SystemPreferencesTypeV10;
+
+
+// Any entries added to this structure must be initialized in
+// Prefereces.c:GetPreferenceResource
+//
+// DOLATER CS - We should move SystemPreferencesType, SystemPreferencesTypeV10,
+// PrefGetPreferences, and PrefSetPreferences to a private header
+// file, since any code compiled against an old version of this
+// struct will trash memory when run on a version of the Palm OS
+// that makes the struct longer.
+
+typedef struct
+ {
+ UInt16 version; // Version of preference info
+
+ // International preferences
+ CountryType country; // Country the device is in (see PalmLocale.h)
+ DateFormatType dateFormat; // Format to display date in
+ DateFormatType longDateFormat; // Format to display date in
+ Int8 weekStartDay; // Sunday or Monday
+ TimeFormatType timeFormat; // Format to display time in
+ NumberFormatType numberFormat; // Format to display numbers in
+
+ // system preferences
+ UInt8 autoOffDuration; // Time period in minutes before shutting off (use autoOffDurationSecs instead).
+ SoundLevelTypeV20 sysSoundLevelV20; // slOn or slOff - error beeps and other non-alarm/game sounds
+ SoundLevelTypeV20 gameSoundLevelV20; // slOn or slOff - game sound effects
+ SoundLevelTypeV20 alarmSoundLevelV20; // slOn or slOff - alarm sound effects
+ Boolean hideSecretRecords; // True to not display records with
+ // their secret bit attribute set
+ Boolean deviceLocked; // Device locked until the system
+ // password is entered
+ Boolean localSyncRequiresPassword; // User must enter password on Pilot
+ Boolean remoteSyncRequiresPassword; // User must enter password on Pilot
+ UInt16 sysPrefFlags; // Miscellaneous system pref flags
+ // copied into the global GSysPrefFlags
+ // at boot time. Constants are
+ // sysPrefFlagXXX defined in SystemPrv.h
+ SysBatteryKind sysBatteryKind; // The type of batteries installed. This
+ // is copied into the globals GSysbatteryKind
+ // at boot time.
+ UInt8 reserved1;
+ UInt32 minutesWestOfGMT; // minutes west of Greenwich
+ DaylightSavingsTypes daylightSavings; // Type of daylight savings correction
+ UInt8 reserved2;
+ UInt16 ronamaticChar; // character to generate from ronamatic stroke.
+ // Typically it popups the onscreen keyboard.
+ UInt32 hard1CharAppCreator; // creator of application to launch in response
+ // to the hard button #1. Used by SysHandleEvent.
+ UInt32 hard2CharAppCreator; // creator of application to launch in response
+ // to the hard button #2. Used by SysHandleEvent.
+ UInt32 hard3CharAppCreator; // creator of application to launch in response
+ // to the hard button #3. Used by SysHandleEvent.
+ UInt32 hard4CharAppCreator; // creator of application to launch in response
+ // to the hard button #4. Used by SysHandleEvent.
+ UInt32 calcCharAppCreator; // creator of application to launch in response
+ // to the Calculator icon. Used by SysHandleEvent.
+ UInt32 hardCradleCharAppCreator; // creator of application to launch in response
+ // to the Cradle button. Used by SysHandleEvent.
+ UInt32 launcherCharAppCreator; // creator of application to launch in response
+ // to the launcher button. Used by SysHandleEvent.
+ UInt32 hardCradle2CharAppCreator; // creator of application to launch in response
+ // to the 2nd Cradle button. Used by SysHandleEvent.
+ AnimationLevelType animationLevel; // amount of animation to display
+
+ Boolean maskPrivateRecords; // Only meaningful if hideSecretRecords is true.
+ //true to show a grey placeholder box for secret records.
+ //was reserved3 - added for 3.5
+
+
+ // Additions for PalmOS 3.0:
+ UInt16 sysSoundVolume; // system amplitude (0 - sndMaxAmp) - taps, beeps
+ UInt16 gameSoundVolume; // game amplitude (0 - sndMaxAmp) - explosions
+ UInt16 alarmSoundVolume; // alarm amplitude (0 - sndMaxAmp)
+ Boolean beamReceive; // False turns off IR sniffing, sends still work.
+ Boolean calibrateDigitizerAtReset; // True makes the user calibrate at soft reset time
+ UInt16 systemKeyboardID; // ID of the preferred keyboard resource
+ UInt32 defSerialPlugIn; // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ Boolean stayOnWhenPluggedIn; // don't sleep after timeout when using line current
+ Boolean stayLitWhenPluggedIn; // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ UInt32 antennaCharAppCreator; // creator of application to launch in response
+ // to the antenna key. Used by SysHandleEvent.
+
+ // Additions for PalmOS 3.5:
+ MeasurementSystemType measurementSystem; // metric, english, etc.
+ UInt8 reserved3;
+ UInt16 autoOffDurationSecs; // Time period in seconds before shutting off.
+
+ // Additions for PalmOS 4.0:
+ Int16 timeZone; // minutes east of Greenwich
+ Int16 daylightSavingAdjustment; // current daylight saving correction in minutes
+ CountryType timeZoneCountry; // country used to specify time zone.
+ SecurityAutoLockType autoLockType; // Never, on power off, after preset delay or at preset time
+ UInt32 autoLockTime; // Auto lock preset time or delay.
+ Boolean autoLockTimeFlag; // For Minutes or Hours.
+ LanguageType language; // Language spoken in country selected via Setup app/Formats panel
+
+ AttnFlagsType attentionFlags; // User prefs for getting user's attention
+
+ UInt32 defaultAppCreator; // Creator of the default "safe" app that is launched
+ // on a reset.
+ } SystemPreferencesType;
+
+
+
+typedef SystemPreferencesType *SystemPreferencesPtr;
+
+
+// structure of the resource that holds hard/soft button defaults
+typedef struct {
+ UInt16 keyCode; // virtual key code of the hard/soft button
+ UInt32 creator; // app creator code
+} ButtonDefaultAppType;
+
+typedef struct {
+ UInt16 numButtons; // number of default button assignments
+ ButtonDefaultAppType button[1]; // array of button assignments
+} ButtonDefaultListType;
+
+
+//-------------------------------------------------------------------
+// Preferences routines
+//-------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern DmOpenRef PrefOpenPreferenceDBV10 (void)
+ SYS_TRAP(sysTrapPrefOpenPreferenceDBV10);
+
+extern DmOpenRef PrefOpenPreferenceDB (Boolean saved)
+ SYS_TRAP(sysTrapPrefOpenPreferenceDB);
+
+extern void PrefGetPreferences(SystemPreferencesPtr p)
+ SYS_TRAP(sysTrapPrefGetPreferences);
+
+extern void PrefSetPreferences(SystemPreferencesPtr p)
+ SYS_TRAP(sysTrapPrefSetPreferences);
+
+extern UInt32 PrefGetPreference(SystemPreferencesChoice choice)
+ SYS_TRAP(sysTrapPrefGetPreference);
+
+extern void PrefSetPreference(SystemPreferencesChoice choice, UInt32 value)
+ SYS_TRAP(sysTrapPrefSetPreference);
+
+extern Int16 PrefGetAppPreferences (UInt32 creator, UInt16 id, void *prefs,
+ UInt16 *prefsSize, Boolean saved)
+ SYS_TRAP(sysTrapPrefGetAppPreferences);
+
+extern Boolean PrefGetAppPreferencesV10 (UInt32 type, Int16 version, void *prefs,
+ UInt16 prefsSize)
+ SYS_TRAP(sysTrapPrefGetAppPreferencesV10);
+
+extern void PrefSetAppPreferences (UInt32 creator, UInt16 id, Int16 version,
+ const void *prefs, UInt16 prefsSize, Boolean saved)
+ SYS_TRAP(sysTrapPrefSetAppPreferences);
+
+extern void PrefSetAppPreferencesV10 (UInt32 creator, Int16 version, void *prefs,
+ UInt16 prefsSize)
+ SYS_TRAP(sysTrapPrefSetAppPreferencesV10);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __PREFERENCES_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Rect.h b/SrcShared/Palm/Platform/Incs/Core/System/Rect.h
new file mode 100644
index 0000000..40cd3b7
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Rect.h
@@ -0,0 +1,83 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Rect.h
+ *
+ * Description:
+ * This file defines rectangle structures and routines.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 Use Coord abstraction, fix up consts
+ *
+ *****************************************************************************/
+
+#ifndef __RECT_H__
+#define __RECT_H__
+
+// Include elementary types
+#include <PalmTypes.h> // Basic types
+#include <CoreTraps.h> // Trap Numbers.
+
+
+typedef struct AbsRectType {
+ Coord left;
+ Coord top;
+ Coord right;
+ Coord bottom;
+} AbsRectType;
+
+
+typedef struct PointType {
+ Coord x;
+ Coord y;
+} PointType;
+
+
+typedef struct RectangleType {
+ PointType topLeft;
+ PointType extent;
+} RectangleType;
+
+typedef RectangleType *RectanglePtr;
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void RctSetRectangle (RectangleType *rP,
+ Coord left, Coord top, Coord width, Coord height)
+ SYS_TRAP(sysTrapRctSetRectangle);
+
+extern void RctCopyRectangle (const RectangleType *srcRectP,
+ RectangleType *dstRectP)
+ SYS_TRAP(sysTrapRctCopyRectangle);
+
+extern void RctInsetRectangle (RectangleType *rP, Coord insetAmt)
+ SYS_TRAP(sysTrapRctInsetRectangle);
+
+extern void RctOffsetRectangle (RectangleType *rP, Coord deltaX, Coord deltaY)
+ SYS_TRAP(sysTrapRctOffsetRectangle);
+
+extern Boolean RctPtInRectangle (Coord x, Coord y, const RectangleType *rP)
+ SYS_TRAP(sysTrapRctPtInRectangle);
+
+extern void RctGetIntersection (const RectangleType *r1P, const RectangleType *r2P,
+ RectangleType *r3P)
+ SYS_TRAP(sysTrapRctGetIntersection);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__RECT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h
new file mode 100644
index 0000000..7142309
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SerialLinkMgr.h
@@ -0,0 +1,437 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialLinkMgr.h
+ *
+ * Description:
+ * Source for Serial Link Routines on Pilot
+ *
+ * History:
+ * 2/6/95 replaces DSerial.h from Debugger
+ *
+ *****************************************************************************/
+
+#ifndef __SERIAL_LINK_H
+#define __SERIAL_LINK_H
+
+
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <ErrorBase.h>
+
+
+//*************************************************************************
+// Pre-defined, fixxed Socket ID's
+//*************************************************************************
+#define slkSocketDebugger 0 // Debugger Socket
+#define slkSocketConsole 1 // Console Socket
+#define slkSocketRemoteUI 2 // Remote UI Socket
+#define slkSocketDLP 3 // Desktop Link Socket
+#define slkSocketFirstDynamic 4 // first dynamic socket ID
+
+
+//*************************************************************************
+// Packet Types
+//*************************************************************************
+#define slkPktTypeSystem 0 // System packets
+#define slkPktTypeUnused1 1 // used to be: Connection Manager packets
+#define slkPktTypePAD 2 // PAD Protocol packets
+#define slkPktTypeLoopBackTest 3 // Loop-back test packets
+
+
+
+//*************************************************************************
+//
+// Packet structure:
+// header
+// body (0-dbgMaxPacketBodyLength bytes of data)
+// footer
+//
+//*************************************************************************
+
+//----------------------------------------------------------------------
+// packet header
+// Fields marked with -> must be filled in by caller
+// Fields marked with X will be filled in by SlkSendPacket.
+//----------------------------------------------------------------------
+
+typedef UInt8 SlkPktHeaderChecksum;
+
+typedef struct SlkPktHeaderType {
+ UInt16 signature1; // X first 2 bytes of signature
+ UInt8 signature2; // X 3 and final byte of signature
+ UInt8 dest; // -> destination socket Id
+ UInt8 src; // -> src socket Id
+ UInt8 type; // -> packet type
+ UInt16 bodySize; // X size of body
+ UInt8 transId; // -> transaction Id
+ // if 0 specified, it will be replaced
+ SlkPktHeaderChecksum checksum; // X check sum of header
+ } SlkPktHeaderType;
+
+typedef SlkPktHeaderType* SlkPktHeaderPtr;
+
+#define slkPktHeaderSignature1 0xBEEF
+#define slkPktHeaderSignature2 0xED
+
+#define slkPktHeaderSigFirst 0xBE // First byte
+#define slkPktHeaderSigSecond 0xEF // second byte
+#define slkPktHeaderSigThird 0xED // third byte
+
+//----------------------------------------------------------------------
+// packet footer
+//----------------------------------------------------------------------
+typedef struct SlkPktFooterType {
+ UInt16 crc16; // header and body crc
+ } SlkPktFooterType;
+
+typedef SlkPktFooterType* SlkPktFooterPtr;
+
+
+//*************************************************************************
+//
+// Write Data Structure passed to SlkSendPacket. This structure
+// Tells SlkSendPacket where each of the chunks that comprise the body are
+// and the size of each. SlkSendPacket accepts a pointer to an array
+// of SlkWriteDataTypes, the last one has a size field of 0.
+//
+//*************************************************************************
+typedef struct SlkWriteDataType {
+ UInt16 size; // last one has size of 0
+ void* dataP; // pointer to data
+ } SlkWriteDataType;
+typedef SlkWriteDataType* SlkWriteDataPtr;
+
+
+
+
+//*************************************************************************
+//
+// CPU-dependent macros for getting/setting values from/to packets
+//
+//*************************************************************************
+
+//--------------------------------------------------------------------
+// macros to get packet values
+//--------------------------------------------------------------------
+
+#define slkGetPacketByteVal(srcP) (*(UInt8 *)(srcP))
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkGetPacketWordVal(srcP) \
+ ( (UInt16) \
+ ( \
+ ((UInt16)((UInt8 *)(srcP))[0] << 8) | \
+ ((UInt16)((UInt8 *)(srcP))[1]) \
+ ) \
+ )
+#else
+#define slkGetPacketWordVal(srcP) \
+ ( *((UInt16 *)(srcP)) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkGetPacketDWordVal(srcP) \
+ ( (UInt32) \
+ ( \
+ ((UInt32)((UInt8 *)(srcP))[0] << 24) | \
+ ((UInt32)((UInt8 *)(srcP))[1] << 16) | \
+ ((UInt32)((UInt8 *)(srcP))[2] << 8) | \
+ ((UInt32)((UInt8 *)(srcP))[3]) \
+ ) \
+ )
+#else
+#define slkGetPacketDWordVal(srcP) \
+ ( *((UInt32 *)(srcP)) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#define slkGetPacketSignature1(sigP) \
+ slkGetPacketWordVal(sigP)
+
+#define slkGetPacketSignature2(sigP) \
+ slkGetPacketByteVal(sigP)
+
+
+#define slkGetPacketDest(addressP) \
+ slkGetPacketByteVal(addressP)
+
+#define slkGetPacketSrc(addressP) \
+ slkGetPacketByteVal(addressP)
+
+#define slkGetPacketType(commandP) \
+ slkGetPacketByteVal(commandP)
+
+
+#define slkGetPacketBodySize(lengthP) \
+ slkGetPacketWordVal(lengthP)
+
+#define slkGetPacketTransId(transIDP) \
+ slkGetPacketByteVal(transIDP)
+
+#define slkGetPacketHdrChecksum(checksumP) \
+ slkGetPacketByteVal(checksumP)
+
+
+#define slkGetPacketTotalChecksum(checksumP) \
+ slkGetPacketWordVal(checksumP)
+
+
+
+
+
+
+//--------------------------------------------------------------------
+// macros to set packet values
+//--------------------------------------------------------------------
+
+
+#define slkSetPacketByteVal(srcByteVal, destP) \
+ ( *(UInt8 *)(destP) = (UInt8)(srcByteVal) )
+
+#if (CPU_TYPE == CPU_x86)
+#define slkSetPacketWordVal(srcWordVal, destP) \
+ \
+ do { \
+ UInt16 ___srcVal; \
+ UInt8 * ___srcValP; \
+ \
+ ___srcVal = (UInt16)(srcWordVal); \
+ ___srcValP = (UInt8 *)(&___srcVal); \
+ \
+ ((UInt8 *)(destP))[0] = ___srcValP[1]; \
+ ((UInt8 *)(destP))[1] = ___srcValP[0]; \
+ } while( false )
+#else
+#define slkSetPacketWordVal(srcWordVal, destP) \
+ ( *((UInt16 *)(destP)) = (UInt16)(srcWordVal) )
+#endif //CPU_TYPE == CPU_x86
+
+
+#if (CPU_TYPE == CPU_x86)
+#define slkSetPacketDWordVal(srcDWordVal, destP) \
+ do { \
+ UInt32 ___srcVal; \
+ UInt8 * ___srcValP; \
+ \
+ ___srcVal = (UInt32)(srcDWordVal); \
+ ___srcValP = (UInt8 *)(&___srcVal); \
+ \
+ ((UInt8 *)(destP))[0] = ___srcValP[3]; \
+ ((UInt8 *)(destP))[1] = ___srcValP[2]; \
+ ((UInt8 *)(destP))[2] = ___srcValP[1]; \
+ ((UInt8 *)(destP))[3] = ___srcValP[0]; \
+ } while( false )
+#else
+#define slkSetPacketDWordVal(srcDWordVal, destP) \
+ ( *((UInt32 *)(destP)) = (UInt32)(srcDWordVal) )
+#endif //CPU_TYPE == CPU_x86
+
+
+
+#define slkSetPacketSignature1(magic, destP) \
+ slkSetPacketWordVal(magic, destP)
+
+#define slkSetPacketSignature2(magic, destP) \
+ slkSetPacketByteVal(magic, destP)
+
+
+#define slkSetPacketDest(dest, destP) \
+ slkSetPacketByteVal(dest, destP)
+
+#define slkSetPacketSrc(src, destP) \
+ slkSetPacketByteVal(src, destP)
+
+
+#define slkSetPacketType(type, destP) \
+ slkSetPacketByteVal(type, destP)
+
+
+#define slkSetPacketBodySize(numBytes, destP) \
+ slkSetPacketWordVal(numBytes, destP)
+
+
+#define slkSetPacketTransId(transID, destP) \
+ slkSetPacketByteVal(transID, destP)
+
+#define slkSetPacketHdrChecksum(checksum, destP) \
+ slkSetPacketByteVal(checksum, destP)
+
+#define slkSetPacketTotalChecksum(checksum, destP) \
+ slkSetPacketWordVal(checksum, destP)
+
+
+
+
+
+
+/*******************************************************************
+ * Serial Link Manager Errors
+ * the constant slkErrorClass is defined in SystemMgr.h
+ *******************************************************************/
+#define slkErrChecksum (slkErrorClass | 1)
+#define slkErrFormat (slkErrorClass | 2)
+#define slkErrBuffer (slkErrorClass | 3)
+#define slkErrTimeOut (slkErrorClass | 4)
+#define slkErrHandle (slkErrorClass | 5)
+#define slkErrBodyLimit (slkErrorClass | 6)
+#define slkErrTransId (slkErrorClass | 7)
+#define slkErrResponse (slkErrorClass | 8)
+#define slkErrNoDefaultProc (slkErrorClass | 9)
+#define slkErrWrongPacketType (slkErrorClass | 10)
+#define slkErrBadParam (slkErrorClass | 11)
+#define slkErrAlreadyOpen (slkErrorClass | 12)
+#define slkErrOutOfSockets (slkErrorClass | 13)
+#define slkErrSocketNotOpen (slkErrorClass | 14)
+#define slkErrWrongDestSocket (slkErrorClass | 15)
+#define slkErrWrongPktType (slkErrorClass | 16)
+#define slkErrBusy (slkErrorClass | 17) // called while sending a packet
+ // only returned on single-threaded
+ // emulation implementations
+#define slkErrNotOpen (slkErrorClass | 18)
+
+
+
+/*******************************************************************
+ * Type definition for a Serial Link Socket Listener
+ *
+ *******************************************************************/
+typedef void (*SlkSocketListenerProcPtr)
+ (SlkPktHeaderPtr headerP, void *bodyP);
+
+typedef struct SlkSocketListenType {
+ SlkSocketListenerProcPtr listenerP;
+ SlkPktHeaderPtr headerBufferP; // App allocated buffer for header
+ void* bodyBufferP; // App allocated buffer for body
+ UInt32 bodyBufferSize;
+ } SlkSocketListenType;
+typedef SlkSocketListenType* SlkSocketListenPtr;
+
+
+
+/*******************************************************************
+ * Prototypes
+ *******************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-------------------------------------------------------------------
+// Initializes the Serial Link Manager
+//-------------------------------------------------------------------
+Err SlkOpen(void)
+ SYS_TRAP(sysTrapSlkOpen);
+
+//-------------------------------------------------------------------
+// Close down the Serial Link Manager
+//-------------------------------------------------------------------
+Err SlkClose(void)
+ SYS_TRAP(sysTrapSlkClose);
+
+
+
+
+//-------------------------------------------------------------------
+// Open up another Serial Link socket. The caller must have already
+// opened the comm library and set it to the right settings.
+//-------------------------------------------------------------------
+
+Err SlkOpenSocket(UInt16 portID, UInt16 *socketP, Boolean staticSocket)
+ SYS_TRAP(sysTrapSlkOpenSocket);
+
+
+//-------------------------------------------------------------------
+// Close up a Serial Link socket.
+// Warning: This routine is assymetrical with SlkOpenSocket because it
+// WILL CLOSE the library for the caller (unless the refNum is the
+// refNum of the debugger comm library).
+//-------------------------------------------------------------------
+Err SlkCloseSocket(UInt16 socket)
+ SYS_TRAP(sysTrapSlkCloseSocket);
+
+
+//-------------------------------------------------------------------
+// Get the library refNum for a particular Socket
+//-------------------------------------------------------------------
+
+
+ Err SlkSocketPortID(UInt16 socket, UInt16 *portIDP)
+ SYS_TRAP(sysTrapSlkSocketRefNum);
+
+ #define SlkSocketRefNum SlkSocketPortID
+
+
+//-------------------------------------------------------------------
+// Set the in-packet timeout for a socket
+//-------------------------------------------------------------------
+Err SlkSocketSetTimeout(UInt16 socket, Int32 timeout)
+ SYS_TRAP(sysTrapSlkSocketSetTimeout);
+
+
+
+
+
+//-------------------------------------------------------------------
+// Flush a Socket
+//-------------------------------------------------------------------
+Err SlkFlushSocket(UInt16 socket, Int32 timeout)
+ SYS_TRAP(sysTrapSlkFlushSocket);
+
+
+//-------------------------------------------------------------------
+// Set up a Socket Listener
+//-------------------------------------------------------------------
+Err SlkSetSocketListener(UInt16 socket, SlkSocketListenPtr socketP)
+ SYS_TRAP(sysTrapSlkSetSocketListener);
+
+
+//-------------------------------------------------------------------
+// Sends a packet's header, body, footer. Stuffs the header's
+// magic number and checksum fields. Expects all other
+// header fields to be filled in by caller.
+// errors returned: dseHandle, dseLine, dseIO, dseParam, dseBodyLimit,
+// dseOther
+//-------------------------------------------------------------------
+Err SlkSendPacket(SlkPktHeaderPtr headerP, SlkWriteDataPtr writeList)
+ SYS_TRAP(sysTrapSlkSendPacket);
+
+
+//-------------------------------------------------------------------
+// Receives and validates an entire packet.
+// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat,
+// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut,
+// dseOther
+//-------------------------------------------------------------------
+Err SlkReceivePacket( UInt16 socket, Boolean andOtherSockets,
+ SlkPktHeaderPtr headerP, void *bodyP, UInt16 bodySize,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSlkReceivePacket);
+
+
+//-------------------------------------------------------------------
+// Do Default processing of a System packet
+//-------------------------------------------------------------------
+Err SlkSysPktDefaultResponse(SlkPktHeaderPtr headerP, void *bodyP)
+ SYS_TRAP(sysTrapSlkSysPktDefaultResponse);
+
+//-------------------------------------------------------------------
+// Do RPC call
+//-------------------------------------------------------------------
+Err SlkProcessRPC(SlkPktHeaderPtr headerP, void *bodyP)
+ SYS_TRAP(sysTrapSlkProcessRPC);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__SERIAL_LINK_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h
new file mode 100644
index 0000000..d59687f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SerialMgr.h
@@ -0,0 +1,371 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialMgr.h
+ *
+ * Description:
+ * Include file for Serial manager
+ *
+ * History:
+ * 1/14/98 SerialMgr.h created by Ben Manuto
+ *
+ *****************************************************************************/
+
+#ifndef __SERIALMGR_H
+#define __SERIALMGR_H
+
+
+// Pilot common definitions
+#include <PalmTypes.h>
+#include <ErrorBase.h>
+
+// New Serial manager feature number
+#define sysFtrNewSerialPresent 1
+
+/********************************************************************
+ * Serial Manager Errors
+ * the constant serErrorClass is defined in SystemMgr.h
+ ********************************************************************/
+
+#define serErrBadParam (serErrorClass | 1)
+#define serErrBadPort (serErrorClass | 2)
+#define serErrNoMem (serErrorClass | 3)
+#define serErrBadConnID (serErrorClass | 4)
+#define serErrTimeOut (serErrorClass | 5)
+#define serErrLineErr (serErrorClass | 6)
+#define serErrAlreadyOpen (serErrorClass | 7)
+#define serErrStillOpen (serErrorClass | 8)
+#define serErrNotOpen (serErrorClass | 9)
+#define serErrNotSupported (serErrorClass | 10) // functionality not supported
+#define serErrNoDevicesAvail (serErrorClass | 11) // No serial devices were loaded or are available.
+
+
+//
+// mask values for the lineErrors from SerGetStatus
+//
+
+#define serLineErrorParity 0x0001 // parity error
+#define serLineErrorHWOverrun 0x0002 // HW overrun
+#define serLineErrorFraming 0x0004 // framing error
+#define serLineErrorBreak 0x0008 // break signal asserted
+#define serLineErrorHShake 0x0010 // line hand-shake error
+#define serLineErrorSWOverrun 0x0020 // HW overrun
+#define serLineErrorCarrierLost 0x0040 // CD dropped
+
+
+/********************************************************************
+ * Serial Port Definitions
+ ********************************************************************/
+
+#define serPortLocalHotSync 0x8000 // Use physical HotSync port
+
+#define serPortCradlePort 0x8000 // Use the RS-232 cradle port.
+#define serPortIrPort 0x8001 // Use available IR port.
+
+
+// This constant is used by the Serial Link Mgr only
+#define serPortIDMask 0xC000
+
+
+/********************************************************************
+ * Serial Settings Descriptor
+ ********************************************************************/
+
+#define srmSettingsFlagStopBitsM 0x00000001 // mask for stop bits field
+#define srmSettingsFlagStopBits1 0x00000000 // 1 stop bits
+#define srmSettingsFlagStopBits2 0x00000001 // 2 stop bits
+#define srmSettingsFlagParityOnM 0x00000002 // mask for parity on
+#define srmSettingsFlagParityEvenM 0x00000004 // mask for parity even
+#define srmSettingsFlagXonXoffM 0x00000008 // (NOT IMPLEMENTED) mask for Xon/Xoff flow control
+#define srmSettingsFlagRTSAutoM 0x00000010 // mask for RTS rcv flow control
+#define srmSettingsFlagCTSAutoM 0x00000020 // mask for CTS xmit flow control
+#define srmSettingsFlagBitsPerCharM 0x000000C0 // mask for bits/char
+#define srmSettingsFlagBitsPerChar5 0x00000000 // 5 bits/char
+#define srmSettingsFlagBitsPerChar6 0x00000040 // 6 bits/char
+#define srmSettingsFlagBitsPerChar7 0x00000080 // 7 bits/char
+#define srmSettingsFlagBitsPerChar8 0x000000C0 // 8 bits/char
+#define srmSettingsFlagFlowControl 0x00000100 // mask for enabling/disabling special flow control feature
+ // for the software receive buffer.
+
+
+// Default settings
+#define srmDefaultSettings (srmSettingsFlagBitsPerChar8 | \
+ srmSettingsFlagStopBits1 | \
+ srmSettingsFlagRTSAutoM)
+
+#define srmDefaultCTSTimeout (5*sysTicksPerSecond)
+
+
+// Status bitfield constants
+
+#define srmStatusCtsOn 0x00000001
+#define srmStatusRtsOn 0x00000002
+#define srmStatusDsrOn 0x00000004
+#define srmStatusBreakSigOn 0x00000008
+
+
+//
+// Info fields describing serial HW capabilities.
+//
+
+#define serDevCradlePort 0x00000001 // Serial HW controls RS-232 serial from cradle connector of Pilot.
+#define serDevRS232Serial 0x00000002 // Serial HW has RS-232 line drivers
+#define serDevIRDACapable 0x00000004 // Serial Device has IR line drivers and generates IRDA mode serial.
+#define serDevModemPort 0x00000008 // Serial deivce drives modem connection.
+#define serDevCncMgrVisible 0x00000010 // Serial device port name string to be displayed in Connection Mgr panel.
+
+
+typedef struct DeviceInfoType {
+ UInt32 serDevCreator; // Four Character creator type for serial driver ('sdrv')
+ UInt32 serDevFtrInfo; // Flags defining features of this serial hardware.
+ UInt32 serDevMaxBaudRate; // Maximum baud rate for this device.
+ UInt32 serDevHandshakeBaud; // HW Handshaking is reccomended for baud rates over this
+ Char *serDevPortInfoStr; // Description of serial HW device or virtual device.
+ UInt8 reserved[8]; // Reserved.
+} DeviceInfoType;
+
+typedef DeviceInfoType *DeviceInfoPtr;
+
+
+/********************************************************************
+ * Type of a wakeup handler procedure which can be installed through the
+ * SerSetWakeupHandler() call.
+ ********************************************************************/
+typedef void (*WakeupHandlerProcPtr)(UInt32 refCon);
+
+/********************************************************************
+ * Type of an emulator-mode only blocking hook routine installed via
+ * SerControl function serCtlEmuSetBlockingHook. This is supported only
+ * under emulation mode. The argument to the function is the value
+ * specified in the SerCallbackEntryType structure. The intention of the
+ * return value is to return false if serial manager should abort the
+ * current blocking action, such as when an app quit event has been received;
+ * otherwise, it should return true. However, in the current implementation,
+ * this return value is ignored. The callback can additionally process
+ * events to enable user interaction with the UI, such as interacting with the
+ * debugger.
+ ********************************************************************/
+typedef Boolean (*BlockingHookProcPtr) (UInt32 userRef);
+
+
+/********************************************************************
+ * Serial Library Control Enumerations (Pilot 2.0)
+ ********************************************************************/
+
+/********************************************************************
+ * Structure for specifying callback routines.
+ ********************************************************************/
+typedef struct SrmCallbackEntryType {
+ BlockingHookProcPtr funcP; // function pointer
+ UInt32 userRef; // ref value to pass to callback
+} SrmCallbackEntryType;
+typedef SrmCallbackEntryType* SrmCallbackEntryPtr;
+
+
+typedef enum SrmCtlEnum {
+ srmCtlFirstReserved = 0, // RESERVE 0
+
+ srmCtlSetBaudRate, // Sets the current baud rate for the HW.
+ // valueP = MemPtr to Int32, valueLenP = MemPtr to sizeof(Int32)
+
+ srmCtlGetBaudRate, // Gets the current baud rate for the HW.
+
+ srmCtlSetFlags, // Sets the current flag settings for the serial HW.
+
+ srmCtlGetFlags, // Gets the current flag settings the serial HW.
+
+ srmCtlSetCtsTimeout, // Sets the current Cts timeout value.
+
+ srmCtlGetCtsTimeout, // Gets the current Cts timeout value.
+
+ srmCtlStartBreak, // turn RS232 break signal on:
+ // users are responsible for ensuring that the break is set
+ // long enough to genearate a valid BREAK!
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStopBreak, // turn RS232 break signal off:
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStartLocalLoopback, // Start local loopback test
+ // valueP = 0, valueLenP = 0
+
+ srmCtlStopLocalLoopback, // Stop local loopback test
+ // valueP = 0, valueLenP = 0
+
+
+ srmCtlIrDAEnable, // Enable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ srmCtlIrDADisable, // Disable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ srmCtlRxEnable, // enable receiver ( for IrDA )
+
+ srmCtlRxDisable, // disable receiver ( for IrDA )
+
+ srmCtlEmuSetBlockingHook, // Set a blocking hook routine FOR EMULATION
+ // MODE ONLY - NOT SUPPORTED ON THE PILOT
+ //PASS:
+ // valueP = MemPtr to SerCallbackEntryType
+ // *valueLenP = sizeof(SerCallbackEntryType)
+ //RETURNS:
+ // the old settings in the first argument
+
+ srmCtlUserDef, // Specifying this opCode passes through a user-defined
+ // function to the DrvControl function. This is for use
+ // specifically by serial driver developers who need info
+ // from the serial driver that may not be available through the
+ // standard SrmMgr interface.
+
+ srmCtlGetOptimalTransmitSize, // This function will ask the port for the most efficient buffer size
+ // for transmitting data packets. This opCode returns serErrNotSupported
+ // if the physical or virtual device does not support this feature.
+ // The device can return a transmit size of 0, if send buffering is
+ // requested, but the actual size is up to the caller to choose.
+ // valueP = MemPtr to UInt32 --> return optimal buf size
+ // ValueLenP = sizeof(UInt32)
+
+ srmCtlSetDTRAsserted, // Enable or disable DTR.
+
+ srmCtlGetDTRAsserted, // Determine if DTR is enabled or disabled.
+
+ srmCtlLAST // ***** ADD NEW ENTRIES BEFORE THIS ONE
+
+} SrmCtlEnum;
+
+
+
+/********************************************************************
+ * Serial Hardware Library Routines
+ ********************************************************************/
+
+#ifdef BUILDING_NEW_SERIAL_MGR
+ #define SERIAL_TRAP(serialSelectorNum)
+#else
+ #define SERIAL_TRAP(serialSelectorNum) \
+ _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapSerialDispatch, \
+ serialSelectorNum)
+#endif
+
+
+// *****************************************************************
+// * New Serial Manager trap selectors
+// *****************************************************************
+
+typedef enum { // The order of this enum *MUST* match the sysSerialSelector in SerialMgr.c
+ sysSerialInstall = 0,
+ sysSerialOpen,
+ sysSerialOpenBkgnd,
+ sysSerialClose,
+ sysSerialSleep,
+ sysSerialWake,
+ sysSerialGetDeviceCount,
+ sysSerialGetDeviceInfo,
+ sysSerialGetStatus,
+ sysSerialClearErr,
+ sysSerialControl,
+ sysSerialSend,
+ sysSerialSendWait,
+ sysSerialSendCheck,
+ sysSerialSendFlush,
+ sysSerialReceive,
+ sysSerialReceiveWait,
+ sysSerialReceiveCheck,
+ sysSerialReceiveFlush,
+ sysSerialSetRcvBuffer,
+ sysSerialRcvWindowOpen,
+ sysSerialRcvWindowClose,
+ sysSerialSetWakeupHandler,
+ sysSerialPrimeWakeupHandler,
+
+ maxSerialSelector = sysSerialPrimeWakeupHandler // Used by SerialMgrDispatch.c
+} sysSerialSelector;
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Err SerialMgrInstall(void)
+ SERIAL_TRAP(sysSerialInstall);
+
+Err SrmOpen(UInt32 port, UInt32 baud, UInt16 *newPortIdP)
+ SERIAL_TRAP(sysSerialOpen);
+
+Err SrmOpenBackground(UInt32 port, UInt32 baud, UInt16 *newPortIdP)
+ SERIAL_TRAP(sysSerialOpenBkgnd);
+
+Err SrmClose(UInt16 portId)
+ SERIAL_TRAP(sysSerialClose);
+
+Err SrmSleep()
+ SERIAL_TRAP(sysSerialSleep);
+
+Err SrmWake()
+ SERIAL_TRAP(sysSerialWake);
+
+Err SrmGetDeviceCount(UInt16 *numOfDevicesP)
+ SERIAL_TRAP(sysSerialGetDeviceCount);
+
+Err SrmGetDeviceInfo(UInt32 deviceID, DeviceInfoType *deviceInfoP)
+ SERIAL_TRAP(sysSerialGetDeviceInfo);
+
+Err SrmGetStatus(UInt16 portId, UInt32 *statusFieldP, UInt16 *lineErrsP)
+ SERIAL_TRAP(sysSerialGetStatus);
+
+Err SrmClearErr (UInt16 portId)
+ SERIAL_TRAP(sysSerialClearErr);
+
+Err SrmControl(UInt16 portId, UInt16 op, void *valueP, UInt16 *valueLenP)
+ SERIAL_TRAP(sysSerialControl);
+
+UInt32 SrmSend (UInt16 portId, void *bufP, UInt32 count, Err *errP)
+ SERIAL_TRAP(sysSerialSend);
+
+Err SrmSendWait(UInt16 portId)
+ SERIAL_TRAP(sysSerialSendWait);
+
+Err SrmSendCheck(UInt16 portId, UInt32 *numBytesP)
+ SERIAL_TRAP(sysSerialSendCheck);
+
+Err SrmSendFlush(UInt16 portId)
+ SERIAL_TRAP(sysSerialSendFlush);
+
+UInt32 SrmReceive(UInt16 portId, void *rcvBufP, UInt32 count, Int32 timeout, Err *errP)
+ SERIAL_TRAP(sysSerialReceive);
+
+Err SrmReceiveWait(UInt16 portId, UInt32 bytes, Int32 timeout)
+ SERIAL_TRAP(sysSerialReceiveWait);
+
+Err SrmReceiveCheck(UInt16 portId, UInt32 *numBytesP)
+ SERIAL_TRAP(sysSerialReceiveCheck);
+
+Err SrmReceiveFlush(UInt16 portId, Int32 timeout)
+ SERIAL_TRAP(sysSerialReceiveFlush);
+
+Err SrmSetReceiveBuffer(UInt16 portId, void *bufP, UInt16 bufSize)
+ SERIAL_TRAP(sysSerialSetRcvBuffer);
+
+Err SrmReceiveWindowOpen(UInt16 portId, UInt8 **bufPP, UInt32 *sizeP)
+ SERIAL_TRAP(sysSerialRcvWindowOpen);
+
+Err SrmReceiveWindowClose(UInt16 portId, UInt32 bytesPulled)
+ SERIAL_TRAP(sysSerialRcvWindowClose);
+
+Err SrmSetWakeupHandler(UInt16 portId, WakeupHandlerProcPtr procP, UInt32 refCon)
+ SERIAL_TRAP(sysSerialSetWakeupHandler);
+
+Err SrmPrimeWakeupHandler(UInt16 portId, UInt16 minBytes)
+ SERIAL_TRAP(sysSerialPrimeWakeupHandler);
+
+void SrmSelectorErrPrv (UInt16 serialSelector); // used only by SerialMgrDispatch.c
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif // __SERIALMGR_H
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h
new file mode 100644
index 0000000..25a7d15
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SoundMgr.h
@@ -0,0 +1,317 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SoundMgr.h
+ *
+ * Description:
+ * Include file for Sound Manager
+ *
+ * History:
+ * 4/11/95 VMK - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************/
+
+#ifndef __SOUNDMGR_H__
+#define __SOUNDMGR_H__
+
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h> // Trap Numbers.
+
+#include <Preferences.h>
+
+
+/************************************************************
+ * Sound Manager constants
+ *
+ *************************************************************/
+
+// Sound Manager max and default volume levels
+#define sndMaxAmp 64
+//#define sndVolumeMask 0x0ff
+#define sndDefaultAmp sndMaxAmp
+
+#define sndMidiNameLength 32 // MIDI track name length *including* NULL terminator
+
+
+/************************************************************
+ * Sound Manager data structures
+ *
+ *************************************************************/
+
+//
+// Command numbers for SndCommandType's cmd field
+//
+typedef enum SndCmdIDType {
+
+ sndCmdFreqDurationAmp = 1, // play a sound, blocking for the entire duration (except for zero amplitude)
+ // param1 = frequency in Hz
+ // param2 = duration in milliseconds
+ // param3 = amplitude (0 - sndMaxAmp); if 0, will return immediately
+
+ // Commands added in PilotOS v3.0
+ // ***IMPORTANT***
+ // Please note that SndDoCmd() in PilotOS before v3.0 will Fatal Error on unknown
+ // commands (anything other than sndCmdFreqDurationAmp). For this reason,
+ // applications wishing to take advantage of these new commands while staying
+ // compatible with the earlier version of the OS, _must_ avoid using these commands
+ // when running on OS versions less thatn v3.0 (see sysFtrNumROMVersion in SystemMgr.h).
+ // Beginning with v3.0, SndDoCmd has been fixed to return sndErrBadParam when an
+ // unknown command is passed.
+ //
+ sndCmdNoteOn, // start a sound given its MIDI key index, max duration and velocity;
+ // the call will not wait for the sound to complete, returning imeediately;
+ // any other sound play request made before this one completes will interrupt it.
+ // param1 = MIDI key index (0-127)
+ // param2 = maximum duration in milliseconds
+ // param3 = velocity (0 - 127) (will be interpolated as amplitude)
+
+ sndCmdFrqOn, // start a sound given its frequency in Hz, max duration and amplitude;
+ // the call will not wait for the sound to complete, returning imeediately;
+ // any other sound play request made before this one completes will interrupt it.
+ // param1 = frequency in Hz
+ // param2 = maximum duration in milliseconds
+ // param3 = amplitude (0 - sndMaxAmp)
+
+ sndCmdQuiet // stop current sound
+ // param1 = 0
+ // param2 = 0
+ // param3 = 0
+
+ } SndCmdIDType;
+
+
+
+
+//
+// SndCommandType: used by SndDoCmd()
+//
+
+typedef struct SndCommandType {
+//SndCmdIDType cmd; // command id
+UInt8 cmd; // command id
+UInt8 reserved;
+Int32 param1; // first parameter
+UInt16 param2; // second parameter
+UInt16 param3; // third parameter
+} SndCommandType;
+
+typedef SndCommandType* SndCommandPtr;
+
+
+//
+// Beep numbers used by SndSysBeep()
+//
+
+typedef enum SndSysBeepType {
+ sndInfo = 1,
+ sndWarning,
+ sndError,
+ sndStartUp,
+ sndAlarm,
+ sndConfirmation,
+ sndClick
+ } SndSysBeepType;
+
+
+/************************************************************
+ * Standard MIDI File (SMF) support structures
+ *************************************************************/
+
+
+// Structure of records in the MIDI sound database:
+//
+// Each MIDI record consists of a record header followed immediately by the
+// Standard MIDI File (SMF) data stream. Only SMF format #0 is presently supported.
+// The first byte of the record header is the byte offset from the beginning of the record
+// to the SMF data stream. The name of the record follows the byte offset
+// field. sndMidiNameLength is the limit on name size (including NULL).
+#define sndMidiRecSignature 'PMrc'
+typedef struct SndMidiRecHdrType {
+ UInt32 signature; // set to sndMidiRecSignature
+ UInt8 bDataOffset; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ UInt8 reserved; // set to zero
+ } SndMidiRecHdrType;
+
+typedef struct SndMidiRecType {
+ SndMidiRecHdrType hdr; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ Char name[2]; // Track name: 1 or more chars including NULL terminator.
+ // If a track has no name, the NULL character must still
+ // be provided.
+ // Set to 2 to pad the structure out to a word boundary.
+ } SndMidiRecType;
+
+
+// Midi records found by SndCreateMidiList.
+typedef struct SndMidiListItemType
+ {
+ Char name[sndMidiNameLength]; // including NULL terminator
+ UInt32 uniqueRecID;
+ LocalID dbID;
+ UInt16 cardNo;
+ } SndMidiListItemType;
+
+
+// Commands for SndPlaySmf
+typedef enum SndSmfCmdEnum {
+ sndSmfCmdPlay = 1, // play the selection
+ sndSmfCmdDuration // get the duration in milliseconds of the entire track
+ } SndSmfCmdEnum;
+
+typedef void SndComplFuncType(void *chanP, UInt32 dwUserData);
+typedef SndComplFuncType *SndComplFuncPtr;
+
+
+// Return true to continue, false to abort
+typedef Boolean SndBlockingFuncType(void *chanP, UInt32 dwUserData, Int32 sysTicksAvailable);
+typedef SndBlockingFuncType *SndBlockingFuncPtr;
+
+typedef struct SndCallbackInfoType {
+ MemPtr funcP; // pointer to the callback function (NULL = no function)
+ UInt32 dwUserData; // value to be passed in the dwUserData parameter of the callback function
+ } SndCallbackInfoType;
+
+
+typedef struct SndSmfCallbacksType {
+ SndCallbackInfoType completion; // completion callback function (see SndComplFuncType)
+ SndCallbackInfoType blocking; // blocking hook callback function (see SndBlockingFuncType)
+ SndCallbackInfoType reserved; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING
+ } SndSmfCallbacksType;
+
+
+#define sndSmfPlayAllMilliSec 0xFFFFFFFFUL
+
+typedef struct SndSmfOptionsType {
+ // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as
+ // outputs for sndSmfCmdDuration
+ UInt32 dwStartMilliSec; // 0 = "start from the beginning"
+ UInt32 dwEndMilliSec; // sndSmfPlayAllMilliSec = "play the entire track";
+ // the default is "play entire track" if this structure
+ // is not passed in
+
+ // The amplitude and interruptible fields are used only for sndSmfCmdPlay
+ UInt16 amplitude; // relative volume: 0 - sndMaxAmp, inclusively; the default is
+ // sndMaxAmp if this structure is not passed in; if 0, the play will
+ // be skipped and the call will return immediately
+
+ Boolean interruptible; // if true, sound play will be interrupted if
+ // user interacts with the controls (digitizer, buttons, etc.);
+ // if false, the paly will not be interrupted; the default behavior
+ // is "interruptible" if this structure is not passed in
+
+ UInt8 reserved1;
+ UInt32 reserved; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING
+ } SndSmfOptionsType;
+
+
+typedef struct SndSmfChanRangeType {
+ UInt8 bFirstChan; // first MIDI channel (0-15 decimal)
+ UInt8 bLastChan; // last MIDI channel (0-15 decimal)
+ } SndSmfChanRangeType;
+
+
+
+
+/************************************************************
+ * Sound Manager result codes
+ * (sndErrorClass is defined in SystemMgr.h)
+ *************************************************************/
+#define sndErrBadParam (sndErrorClass | 1)
+#define sndErrBadChannel (sndErrorClass | 2)
+#define sndErrMemory (sndErrorClass | 3)
+#define sndErrOpen (sndErrorClass | 4)
+#define sndErrQFull (sndErrorClass | 5)
+#define sndErrQEmpty (sndErrorClass | 6) // internal
+#define sndErrFormat (sndErrorClass | 7) // unsupported data format
+#define sndErrBadStream (sndErrorClass | 8) // invalid data stream
+#define sndErrInterrupted (sndErrorClass | 9) // play was interrupted
+
+
+
+/********************************************************************
+ * Sound Manager Routines
+ * These are define as external calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+// Initializes the Sound Manager. Should only be called by
+// Pilot initialization code.
+Err SndInit(void) SYS_TRAP(sysTrapSndInit);
+
+// Frees the Sound Manager.
+//void SndFree(void) SYS_TRAP(sysTrapSndFree);
+
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// Sets default sound volume levels
+//
+// Any parameter may be passed as NULL
+extern void SndSetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *defAmpP)
+ SYS_TRAP(sysTrapSndSetDefaultVolume);
+
+// Gets default sound volume levels
+//
+// Any parameter may be passed as NULL
+extern void SndGetDefaultVolume(UInt16 *alarmAmpP, UInt16 *sysAmpP, UInt16 *masterAmpP)
+ SYS_TRAP(sysTrapSndGetDefaultVolume);
+
+// Executes a sound command on the given sound channel (pass
+// channelP = 0 to use the shared channel).
+extern Err SndDoCmd(void * /*SndChanPtr*/ channelP, SndCommandPtr cmdP, Boolean noWait)
+ SYS_TRAP(sysTrapSndDoCmd);
+
+// Plays one of several defined system beeps/sounds (see sndSysBeep...
+// constants).
+extern void SndPlaySystemSound(SndSysBeepType beepID)
+ SYS_TRAP(sysTrapSndPlaySystemSound);
+
+
+// NEW FOR v3.0
+// Performs an operation on a Standard MIDI File (SMF) Format #0
+extern Err SndPlaySmf(void *chanP, SndSmfCmdEnum cmd, UInt8 *smfP, SndSmfOptionsType *selP,
+ SndSmfChanRangeType *chanRangeP, SndSmfCallbacksType *callbacksP,
+ Boolean bNoWait)
+ SYS_TRAP(sysTrapSndPlaySmf);
+
+// NEW FOR v3.0
+// Creates a list of all midi records. Useful for displaying in lists.
+// For creator wildcard, pass creator=0;
+extern Boolean SndCreateMidiList(UInt32 creator, Boolean multipleDBs, UInt16 *wCountP, MemHandle *entHP)
+ SYS_TRAP(sysTrapSndCreateMidiList);
+
+// NEW FOR v3.2
+// Plays a MIDI sound which is read out of an open resource database
+extern Err SndPlaySmfResource(UInt32 resType, Int16 resID, SystemPreferencesChoice volumeSelector)
+ SYS_TRAP(sysTrapSndPlaySmfResource);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+/************************************************************
+ * Sound Manager Macros
+ *
+ *************************************************************/
+
+#endif // __SOUND_MGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h b/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h
new file mode 100644
index 0000000..7f67624
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h
@@ -0,0 +1,204 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvent.h
+ *
+ * Description:
+ * This file defines event structures and routines.
+ *
+ * History:
+ * September 26, 1994 Created by Art Lamb
+ * 05/05/98 art Add Text Services event.
+ * 07/23/98 kwk Changed UInt16 field in keyDown event to WChar.
+ * 08/20/98 kwk Split tsmEvent into tsmConfirmEvent & tsmFepButtonEvent.
+ * 09/07/98 kwk Added EvtPeekEvent routine declaration.
+ * 10/13/98 kwk Removed EvtPeekEvent until API can be finalized.
+ * 03/11/99 grant Fixed types of pointers in SysEventType data fields.
+ * 05/31/99 kwk Added tsmFepModeEvent event.
+ * 07/14/99 jesse Moved UI structures & constants to Event.h
+ * defined ranges for future UI & system events.
+ * 07/30/99 kwk Moved TSM events here from Event.h
+ * 09/12/99 gap Add new multi-tap implementation
+ * 09/14/99 gap Removed EvtGetTrapState.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSEVENT_H__
+#define __SYSEVENT_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Font.h>
+#include <Rect.h>
+#include <Window.h>
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥ Don't use an enum for this, as convenient as it is, there's namespace
+// pollution, size issues, no way to manage componentization, blah blah blah.
+#endif // PUBLIC_STUFF_STRIPPED
+
+typedef enum {
+ sysEventNilEvent = 0,
+ sysEventPenDownEvent,
+ sysEventPenUpEvent,
+ sysEventPenMoveEvent,
+ sysEventKeyDownEvent,
+ sysEventWinEnterEvent,
+ sysEventWinExitEvent,
+ sysEventAppStopEvent = 22,
+ sysEventTsmConfirmEvent = 35,
+ sysEventTsmFepButtonEvent,
+ sysEventTsmFepModeEvent,
+
+ // add future UI level events in this numeric space
+ // to save room for new system level events
+ sysEventNextUIEvent = 0x0800,
+
+ // <chg 2-25-98 RM> Equates added for library events
+ sysEventFirstINetLibEvent = 0x1000,
+ sysEventFirstWebLibEvent = 0x1100,
+
+ // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
+ // Enums are signed ints, so 32767 technically only allowed for ONE event.
+ sysEventFirstUserEvent = 0x6000
+} SysEventsEnum;
+
+
+
+// keyDownEvent modifers
+#define shiftKeyMask 0x0001
+#define capsLockMask 0x0002
+#define numLockMask 0x0004
+#define commandKeyMask 0x0008
+#define optionKeyMask 0x0010
+#define controlKeyMask 0x0020
+#define autoRepeatKeyMask 0x0040 // True if generated due to auto-repeat
+#define doubleTapKeyMask 0x0080 // True if this is a double-tap event
+#define poweredOnKeyMask 0x0100 // True if this is a double-tap event
+#define appEvtHookKeyMask 0x0200 // True if this is an app hook key
+#define libEvtHookKeyMask 0x0400 // True if this is a library hook key
+
+// define mask for all "virtual" keys
+#define virtualKeyMask (appEvtHookKeyMask | libEvtHookKeyMask | commandKeyMask)
+
+
+// Event timeouts
+#define evtWaitForever -1
+#define evtNoWait 0
+
+struct _GenericEventType {
+ UInt16 datum[8];
+ };
+
+struct _PenUpEventType {
+ PointType start; // display coord. of stroke start
+ PointType end; // display coord. of stroke start
+ };
+
+struct _KeyDownEventType {
+ WChar chr; // ascii code
+ UInt16 keyCode; // virtual key code
+ UInt16 modifiers;
+ };
+
+struct _WinEnterEventType {
+ WinHandle enterWindow;
+ WinHandle exitWindow;
+ };
+
+struct _WinExitEventType {
+ WinHandle enterWindow;
+ WinHandle exitWindow;
+ };
+
+struct _TSMConfirmType {
+ Char * yomiText;
+ UInt16 formID;
+ };
+
+struct _TSMFepButtonType {
+ UInt16 buttonID;
+ };
+
+struct _TSMFepModeEventType {
+ UInt16 mode; // DOLATER kwk - use real type for mode?
+ };
+
+
+// The event record.
+typedef struct SysEventType {
+ SysEventsEnum eType;
+ Boolean penDown;
+ UInt8 tapCount;
+ Coord screenX;
+ Coord screenY;
+ union {
+ struct _GenericEventType generic;
+
+ struct _PenUpEventType penUp;
+ struct _KeyDownEventType keyDown;
+ struct _WinEnterEventType winEnter;
+ struct _WinExitEventType winExit;
+ struct _TSMConfirmType tsmConfirm;
+ struct _TSMFepButtonType tsmFepButton;
+ struct _TSMFepModeEventType tsmFepMode;
+
+ } data;
+
+} SysEventType;
+
+
+// Events are stored in the event queue with some extra fields:
+typedef struct {
+ SysEventType event;
+ UInt32 id; // used to support EvtAddUniqueEvent
+ } SysEventStoreType;
+
+#ifndef PUBLIC_STUFF_STRIPPED // removed header that should be moved into private area
+
+//---------------------------------------------------------------------
+// Event Functions
+//---------------------------------------------------------------------
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* DOLATER: jwm: This lot should be in a private header file, no? */
+
+void SysEventInitialize (void)
+ SYS_TRAP(sysTrapEvtInitialize);
+
+void SysEventAddToQueue (const SysEventType *event)
+ SYS_TRAP(sysTrapEvtAddEventToQueue);
+
+void SysEventAddUniqueToQueue(const SysEventType *eventP, UInt32 id,
+ Boolean inPlace)
+ SYS_TRAP(sysTrapEvtAddUniqueEventToQueue);
+
+void SysEventCopy (const SysEventType *source, SysEventType *dest)
+ SYS_TRAP(sysTrapEvtCopyEvent);
+
+void SysEventGet (SysEventType *event, Int32 timeout)
+ SYS_TRAP(sysTrapEvtGetEvent);
+
+Boolean SysEventAvail (void)
+ SYS_TRAP(sysTrapEvtEventAvail);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+// For Compatibility.. DOLATER... source modules should use EvtGetPen instead.
+#endif // PUBLIC_STUFF_STRIPPED
+#define PenGetPoint(a,b,c) EvtGetPen(a,b,c)
+
+
+
+#endif // __SYSEVENT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h
new file mode 100644
index 0000000..f9d257f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SysEvtMgr.h
@@ -0,0 +1,252 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvtMgr.h
+ *
+ * Description:
+ * Header for the System Event Manager
+ *
+ * History:
+ * 03/22/95 RM Created by Ron Marianetti
+ * 07/23/98 kwk Changed UInt16 param in EvtEnqueueKey to WChar.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSEVTMGR_H__
+#define __SYSEVTMGR_H__
+
+#include <PalmTypes.h>
+#include <SysEvent.h>
+
+/************************************************************
+ * System Event Manager Errors
+ *************************************************************/
+#define evtErrParamErr (evtErrorClass | 1)
+#define evtErrQueueFull (evtErrorClass | 2)
+#define evtErrQueueEmpty (evtErrorClass | 3)
+
+
+/************************************************************
+ * Commands for EvtSetAutoOffTimer()
+ *************************************************************/
+typedef enum
+{
+ SetAtLeast, // turn off in at least xxx seconds
+ SetExactly, // turn off in xxx seconds
+ SetAtMost, // turn off in at most xxx seconds
+ SetDefault, // change default auto-off timeout to xxx seconds
+ ResetTimer // reset the timer to the default auto-off timeout
+
+} EvtSetAutoOffCmd;
+
+
+/************************************************************
+ * Pen button info structure. This structure is used
+ * to hold the bounds of each button on the silk screen and
+ * the ascii code and modifiers byte that each will generate
+ * when tapped by the user.
+ *************************************************************/
+typedef struct PenBtnInfoType {
+ RectangleType boundsR; // bounding rectangle of button
+ WChar asciiCode; // ascii code for key event
+ UInt16 keyCode; // virtual key code for key event
+ UInt16 modifiers; // modifiers for key event
+ } PenBtnInfoType;
+typedef PenBtnInfoType* PenBtnInfoPtr;
+
+typedef struct PenBtnListType {
+ UInt16 numButtons; // Count of number of buttons
+ PenBtnInfoType buttons[1]; // Placeholder for one or more buttons
+ } PenBtnListType;
+
+
+/************************************************************
+ * Silkscreen area info structure. An array of these structures
+ * is returned by the EvtGetSilkscreenAreaList function.
+ *************************************************************/
+
+// Different types of rectangles on the display. For new vendor areas,
+// the type should be set to the vendor's creator code, as assigned
+// by 3Com's Partner Engineering group.
+#define silkscreenRectScreen 'scrn'
+#define silkscreenRectGraffiti 'graf'
+
+// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti
+#define alphaGraffitiSilkscreenArea 0
+#define numericGraffitiSilkscreenArea 1
+
+// One silkscreen area. The areaType field tells us which type of
+// area it is, while the index field has different meanings depending
+// on the area type.
+typedef struct SilkscreenAreaType {
+ RectangleType bounds;
+ UInt32 areaType; // four byte creator code.
+ UInt16 index;
+ } SilkscreenAreaType;
+
+
+/************************************************************
+ * System Event Manager procedures
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//-----------------------------------------------------------------
+// High Level Calls
+//------------------------------------------------------------------
+Err EvtSysInit(void)
+ SYS_TRAP(sysTrapEvtSysInit);
+
+// Return next "System" event. This routine will send strokes to Graffiti as necessary
+// and return a key event. Otherwise, it will return a simple pen down or pen
+// up event, or put the processor to sleep for a max time of 'timeout' if
+// no events are available.
+void EvtGetSysEvent(SysEventType *eventP, Int32 timeout)
+ SYS_TRAP(sysTrapEvtGetSysEvent);
+
+
+// Return true if there is a low level system event (pen or key) available
+Boolean EvtSysEventAvail(Boolean ignorePenUps)
+ SYS_TRAP(sysTrapEvtSysEventAvail);
+
+
+
+// Translate a stroke in the silk screen area to a key event
+Err EvtProcessSoftKeyStroke(PointType *startPtP, PointType *endPtP)
+ SYS_TRAP(sysTrapEvtProcessSoftKeyStroke);
+
+
+//-----------------------------------------------------------------
+// Pen Queue Utilties
+//------------------------------------------------------------------
+
+// Replace current pen queue with another of the given size
+Err EvtSetPenQueuePtr(MemPtr penQueueP, UInt32 size)
+ SYS_TRAP(sysTrapEvtSetPenQueuePtr);
+
+// Return size of current pen queue in bytes
+UInt32 EvtPenQueueSize(void)
+ SYS_TRAP(sysTrapEvtPenQueueSize);
+
+// Flush the pen queue
+Err EvtFlushPenQueue(void)
+ SYS_TRAP(sysTrapEvtFlushPenQueue);
+
+
+// Append a point to the pen queue. Passing -1 for x and y means
+// pen-up (terminate the current stroke). Called by digitizer interrupt routine
+Err EvtEnqueuePenPoint(PointType *ptP)
+ SYS_TRAP(sysTrapEvtEnqueuePenPoint);
+
+
+// Return the stroke info for the next stroke in the pen queue. This MUST
+// be the first call when removing a stroke from the queue
+Err EvtDequeuePenStrokeInfo(PointType *startPtP, PointType *endPtP)
+ SYS_TRAP(sysTrapEvtDequeuePenStrokeInfo);
+
+// Dequeue the next point from the pen queue. Returns non-0 if no
+// more points. The point returned will be (-1,-1) at the end
+// of the stroke.
+Err EvtDequeuePenPoint(PointType *retP)
+ SYS_TRAP(sysTrapEvtDequeuePenPoint);
+
+
+// Flush the entire stroke from the pen queue and dispose it
+Err EvtFlushNextPenStroke()
+ SYS_TRAP(sysTrapEvtFlushNextPenStroke);
+
+
+
+
+//-----------------------------------------------------------------
+// Key Queue Utilties
+//------------------------------------------------------------------
+
+// Replace current key queue with another of the given size. This routine will
+// intialize the given key queue before installing it
+Err EvtSetKeyQueuePtr(MemPtr keyQueueP, UInt32 size)
+ SYS_TRAP(sysTrapEvtSetKeyQueuePtr);
+
+// Return size of current key queue in bytes
+UInt32 EvtKeyQueueSize(void)
+ SYS_TRAP(sysTrapEvtKeyQueueSize);
+
+// Flush the key queue
+Err EvtFlushKeyQueue(void)
+ SYS_TRAP(sysTrapEvtFlushKeyQueue);
+
+
+// Append a key to the key queue.
+Err EvtEnqueueKey(WChar ascii, UInt16 keycode, UInt16 modifiers)
+ SYS_TRAP(sysTrapEvtEnqueueKey);
+
+// Return true of key queue empty.
+Boolean EvtKeyQueueEmpty(void)
+ SYS_TRAP(sysTrapEvtKeyQueueEmpty);
+
+
+// Pop off the next key event from the key queue and fill in the given
+// event record structure. Returns non-zero if there aren't any keys in the
+// key queue. If peek is non-zero, key will be left in key queue.
+Err EvtDequeueKeyEvent(SysEventType *eventP, UInt16 peek)
+ SYS_TRAP(sysTrapEvtDequeueKeyEvent);
+
+
+//-----------------------------------------------------------------
+// Silkscreen information calls
+//------------------------------------------------------------------
+
+// Return pointer to the pen based button list
+const PenBtnInfoType* EvtGetPenBtnList(UInt16* numButtons)
+ SYS_TRAP(sysTrapEvtGetPenBtnList);
+
+// Return pointer to the silkscreen area list
+const SilkscreenAreaType* EvtGetSilkscreenAreaList(UInt16* numAreas)
+ SYS_TRAP(sysTrapEvtGetSilkscreenAreaList);
+
+
+//-----------------------------------------------------------------
+// General Utilities
+//------------------------------------------------------------------
+// Force the system to wake-up. This will result in a null event being
+// sent to the current app.
+Err EvtWakeup(void)
+ SYS_TRAP(sysTrapEvtWakeup);
+
+// Reset the auto-off timer. This is called by the SerialLink Manager in order
+// so we don't auto-off while receiving data over the serial port.
+Err EvtResetAutoOffTimer(void)
+ SYS_TRAP(sysTrapEvtResetAutoOffTimer);
+
+Err EvtSetAutoOffTimer(EvtSetAutoOffCmd cmd, UInt16 timeout)
+ SYS_TRAP(sysTrapEvtSetAutoOffTimer);
+
+// Set Graffiti enabled or disabled.
+void EvtEnableGraffiti(Boolean enable)
+ SYS_TRAP(sysTrapEvtEnableGraffiti);
+
+// Force a NullEvent at or before tick
+Boolean EvtSetNullEventTick(UInt32 tick)
+ SYS_TRAP(sysTrapEvtSetNullEventTick);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _EvtEnqueuePenPoint \
+ ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint)
+
+
+
+#endif //__SYSEVTMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h
new file mode 100644
index 0000000..a057405
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemMgr.h
@@ -0,0 +1,1191 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemMgr.h
+ *
+ * Description:
+ * Pilot system equates
+ *
+ * History:
+ * 10/27/94 RM Created by Ron Marianetti
+ * 10/07/96 SCL Added sysAppLaunchFlagDataRelocated flag
+ * 11/13/96 vmk Added sysErrDelayWakened error code
+ * 08/12/98 dia Added sysFtrNumGremlinsSupportGlobals.
+ * 08/18/98 SCL Added sysFtrNumHwrMiscFlags and ...FlagsExt.
+ * Redefined sysFtrNumProcessorID.
+ * 08/23/98 SCL Merged in tsmErrorClass.
+ * 09/07/98 kwk Added SysWantEvent routine declaration.
+ * 10/05/98 jfs Added SysLCDContrast trap descriptor
+ * 04/08/99 kwk Added sysFtrNumVendor (OS 3.3 and later)
+ * 06/28/99 kwk Added omErrorClass.
+ * 08/11/99 kwk Added sysFtrNumCharEncodingFlags.
+ * 11/01/99 kwk Moved SysWantEvent to SystemPrv.h
+ * 12/03/99 SCL Moved SysAppInfoType, SysAppStartup, and SysAppExit
+ * here from SystemPrv.h (for StartupCode/Runtime)
+ *
+ *****************************************************************************/
+
+#ifndef __SYSTEMMGR_H__
+#define __SYSTEMMGR_H__
+
+// Include elementary types
+#include <PalmTypes.h>
+#include <CoreTraps.h> // Trap Numbers.
+
+// Other types
+#include <SystemResources.h> // Resource definitions.
+
+
+// System Headers
+#include <Rect.h>
+#include <Font.h>
+#include <Window.h>
+#include <InsPoint.h>
+#include <Event.h>
+#include <DataMgr.h> // for DmOpenRef
+#include <LibTraps.h>
+
+
+/************************************************************
+ * System Constants
+ *************************************************************/
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER - These #defines should be removed from the public SDK!!!
+// Note that since the SysTicksPerSecond() API still uses these,
+// so they'll need to remain in private headers. There are also
+// several other headers and Palm OS sources that rely on these
+// defines but should be changed to use SysTicksPerSecond().
+#endif // PUBLIC_STUFF_STRIPPED
+// Define the number of ticks/second
+// NOTE: It is strongly recommended that developers avoid using these
+// defines, and use the SysTicksPerSecond() API (below) instead....
+#if EMULATION_LEVEL == EMULATION_MAC
+ #define sysTicksPerSecond 60 // 60/sec on Macintosh
+#elif EMULATION_LEVEL == EMULATION_NONE
+ #define sysTicksPerSecond 100 // 100/sec on Pilot
+#elif EMULATION_LEVEL == EMULATION_WINDOWS
+ #define sysTicksPerSecond 1000 // 1000/sec on Windows PC
+#elif EMULATION_LEVEL == EMULATION_UNIX
+ #define sysTicksPerSecond 1000
+ // 1000/sec on Linux
+#else
+ #error Invalid EMULATION_LEVEL
+#endif
+
+
+
+/************************************************************
+ * Rules for creating and using the Command Parameter Block
+ * passed to SysUIAppSwitch
+ *************************************************************/
+
+// A parameter block containing application-specific information may be passed
+// to an application when launching it via SysUIAppSwitch. To create the
+// parameter block, you allocate a memory block using MemPtrNew and then you must
+// call MemPtrSetOwner to set the block's owner ID to 0. This assigns the block's
+// ownership to the system so that it will not be automatically freed by the system
+// when the calling app exits. The command block must be self contained. It must not
+// have pointers to anything on the stack or in memory blocks owned by an application.
+// The launching and launched applications do not need to worry about freeing the
+// command block since the system will do this after the launched application exits.
+// If no parameter block is being passed, this parameter must be NULL.
+
+
+/************************************************************
+ * Action Codes
+ *
+ * IMPORTANT ACTION CODE CONSIDERATIONS:
+ *
+ * Many action codes are "sent" to apps via a direct function call into the app's
+ * PilotMain() function without launching the app. For these action codes, the
+ * application's global and static variables are *not* available, unless the
+ * application is already running. Some action codes are synchronized with the
+ * currently running UI applcation via the event manager (alarm action codes,
+ * for example), while others, such as HotSync action codes, are sent from a
+ * background thread. To find out if your app is running (is the current UI
+ * app) when an action code is received, test the sysAppLaunchFlagSubCall flag
+ * (defined in SystemMgr.h) which is passed to your PilotMain in the
+ * launchFlags parameter (the third PilotMain parameter). If it is non-zero,
+ * you may assume that your app is currently running and the global variables
+ * are accessible. This information is useful if your app maintains an open
+ * data database (or another similar resource) when it is running. If the app
+ * receives an action code and the sysAppLaunchFlagSubCall is set in
+ * launchFlags, the handler may access global variables and use the open
+ * database handle while handling the call. On the other hand, if the
+ * sysAppLaunchFlagSubCall flag is not set (ie., zero), the handler will need
+ * to open and close the database itself and is not allowed to access global
+ * or static variables.
+ *
+ *************************************************************/
+
+// NOTE: for defining custom action codes, see sysAppLaunchCmdCustomBase below.
+
+// System SysAppLaunch Commands
+#define sysAppLaunchCmdNormalLaunch 0 // Normal Launch
+
+#define sysAppLaunchCmdFind 1 // Find string
+
+#define sysAppLaunchCmdGoTo 2 // Launch and go to a particular record
+
+#define sysAppLaunchCmdSyncNotify 3 // Sent to apps whose databases changed during
+ // HotSync after the sync has been completed,
+ // including when the app itself has been installed
+ // by HotSync. The data database(s) must have the
+ // same creator ID as the application for this
+ // mechanism to function correctly. This is a
+ // good opportunity to update/initialize/validate
+ // the app's data, such as resorting records,
+ // setting alarms, etc.
+ //
+ // Parameter block: None.
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a
+ // direct function call into the app's
+ // PilotMain function from the background
+ // thread of the HotSync application.
+
+
+#define sysAppLaunchCmdTimeChange 4 // Sent to all applications and preference
+ // panels when the system time is changed.
+ // This notification is the right place to
+ // update alarms and other time-related
+ // activities and resources.
+ //
+ // Parameter block: None.
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdSystemReset 5 // Sent to all applications and preference
+ // panels when the system is either soft-reset
+ // or hard-reset. This notification is the
+ // right place to initialize and/or validate
+ // your application's preferences/features/
+ // database(s) as well as to update alarms and
+ // other time-related activities and resources.
+ //
+ // Parameter block: SysAppLaunchCmdSystemResetType
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdAlarmTriggered 6 // Sent to an application at the time its
+ // alarm time expires (even when another app
+ // is already displaying its alarm dialog box).
+ // This call is intended to allow the app to
+ // perform some very quick activity, such as
+ // scheduling the next alarm or performing a
+ // quick maintenance task. The handler for
+ // sysAppLaunchCmdAlarmTriggered must take as
+ // little time as possible and is *not* allowed
+ // to block (this would delay notification for
+ // alarms set by other applications).
+ //
+ // Parameter block: SysAlarmTriggeredParamType
+ // (defined in AlarmMgr.h)
+ // Restrictions: No accessing of global or
+ // static variables unless sysAppLaunchFlagSubCall
+ // flag is set, as discussed above.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdDisplayAlarm 7 // Sent to an application when it is time
+ // to display the alarm UI. The application
+ // is responsible for making any alarm sounds
+ // and for displaying the alarm UI.
+ // sysAppLaunchCmdDisplayAlarm calls are ordered
+ // chronoligically and are not overlapped.
+ // This means that your app will receive
+ // sysAppLaunchCmdDisplayAlarm only after
+ // all earlier alarms have been displayed.
+ //
+ // Parameter block: SysDisplayAlarmParamType
+ // (defined in AlarmMgr.h)
+ // Restrictions: No accessing of global or
+ // static variables unless sysAppLaunchFlagSubCall
+ // flag is set, as discussed above. UI calls are
+ // allowed to display the app's alarm dialog.
+ // Notes: This action code is sent via a direct
+ // function call into the app's PilotMain
+ // function without "launching" the app.
+
+#define sysAppLaunchCmdCountryChange 8 // The country has changed
+
+#define sysAppLaunchCmdSyncRequestLocal 9 // Sent to the HotSync application to request a
+ // local HotSync. ("HotSync" button was pressed.)
+
+#define sysAppLaunchCmdSyncRequest sysAppLaunchCmdSyncRequestLocal // for backward compatibility
+
+#define sysAppLaunchCmdSaveData 10 // Sent to running app before sysAppLaunchCmdFind
+ // or other action codes that will cause data
+ // searches or manipulation.
+
+#define sysAppLaunchCmdInitDatabase 11 // Sent to an application when a database with
+ // a matching Creator ID is created during
+ // HotSync (in response to a "create db"
+ // request). This allows the application to
+ // initialize a newly-created database during
+ // HotSync. This might include creating some
+ // default records, setting up the database's
+ // application and sort info blocks, etc.
+ //
+ // Parameter block: SysAppLaunchCmdInitDatabaseType
+ // Restrictions: No accessing of global or
+ // static variables; no User Interface calls.
+ // Notes: This action code is sent via a
+ // direct function call into the app's
+ // PilotMain function from the background
+ // thread of the HotSync application.
+
+#define sysAppLaunchCmdSyncCallApplicationV10 12 // Used by DesktopLink Server command "call application";
+ // Pilot v1.0 only!!!
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 2.0
+//------------------------------------------------------------------------
+
+#define sysAppLaunchCmdPanelCalledFromApp 13 // The panel should display a done
+ // button instead of the pick list.
+ // The Done button will return the user
+ // to the last app.
+
+#define sysAppLaunchCmdReturnFromPanel 14 // A panel returned to this app
+
+#define sysAppLaunchCmdLookup 15 // Lookup info managed by an app
+
+#define sysAppLaunchCmdSystemLock 16 // Lock the system until a password is entered.
+
+#define sysAppLaunchCmdSyncRequestRemote 17 // Sent to the HotSync application to request
+ // a remote HotSync. ("Remote HotSync" button
+ // was pressed.)
+
+#define sysAppLaunchCmdHandleSyncCallApp 18 // Pilot v2.0 and greater. Sent by DesktopLink Server to an application to handle
+ // the "call application" command; use DlkControl with
+ // control code dlkCtlSendCallAppReply to send the reply(see DLServer.h).
+ // This action code replaces the v1.0 code sysAppLaunchCmdSyncCallApplication.
+ // vmk 11/26/96
+
+#define sysAppLaunchCmdAddRecord 19 // Add a record to an applications's database.
+
+
+//------------------------------------------------------------------------
+// Standard Service Panel launch codes (used by network panel, dialer panel, etc.)
+#ifndef PUBLIC_STUFF_STRIPPED
+// (DOLATER... document parameter block structures)
+#endif // PUBLIC_STUFF_STRIPPED
+//------------------------------------------------------------------------
+#define sysSvcLaunchCmdSetServiceID 20
+#define sysSvcLaunchCmdGetServiceID 21
+#define sysSvcLaunchCmdGetServiceList 22
+#define sysSvcLaunchCmdGetServiceInfo 23
+
+
+#define sysAppLaunchCmdFailedAppNotify 24 // An app just switched to failed.
+#define sysAppLaunchCmdEventHook 25 // Application event hook callback
+#define sysAppLaunchCmdExgReceiveData 26 // Exg command for app to receive data.
+#define sysAppLaunchCmdExgAskUser 27 // Exg command sent before asking user.
+
+
+//------------------------------------------------------------------------
+// Standard Dialer Service launch codes (30 - 39 reserved)
+#ifndef PUBLIC_STUFF_STRIPPED
+// (DOLATER... document parameter block structures)
+#endif // PUBLIC_STUFF_STRIPPED
+//------------------------------------------------------------------------
+
+// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id
+// and serial library reference number
+#define sysDialLaunchCmdDial 30
+// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id
+// and serial library reference number
+#define sysDialLaunchCmdHangUp 31
+#define sysDialLaunchCmdLast 39
+
+
+//------------------------------------------------------------------------
+// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc)
+// (40-49 reserved)
+//------------------------------------------------------------------------
+
+#define sysSvcLaunchCmdGetQuickEditLabel 40 // SvcQuickEditLabelInfoType
+#define sysSvcLaunchCmdLast 49
+
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 3.x where x >= 1
+//------------------------------------------------------------------------
+
+#define sysAppLaunchCmdURLParams 50 // Sent from the Web Clipper application.
+ // This launch code gets used to satisfy
+ // URLs like the following:
+ // palm:memo.appl?param1=value1&param2=value2
+ // Everything in the URL past the '?' is passed
+ // to the app as the cmdPBP parameter of PilotMain().
+
+#define sysAppLaunchCmdNotify 51 // This is a NotifyMgr notification sent
+ // via SysNotifyBroadcast. The cmdPBP parameter
+ // points to a SysNotifyParamType structure
+ // containing more specific information
+ // about the notification (e.g., what it's for).
+
+#define sysAppLaunchCmdOpenDB 52 // Sent to switch to an application and have it
+ // "open" up the given data file. The cmdPBP
+ // pointer is a pointer to a SysAppLaunchCmdOpenDBType
+ // structure that has the cardNo and localID of the database
+ // to open. This action code is used by the Launcher
+ // to launch data files, like Eleven PQA files that
+ // have the dmHdrAttrLaunchableData bit set in their
+ // database attributes.
+
+#define sysAppLaunchCmdAntennaUp 53 // Sent to switch only to the launcher when
+ // the antenna is raised and the launcher
+ // is the application in the buttons preferences
+ // that is to be run when the antenna is raised is
+ // the launcher.
+
+#define sysAppLaunchCmdGoToURL 54 // Sent to Clipper to have it launch and display
+ // a given URL. cmdPBP points to the URL string.
+
+
+// ***ADD NEW SYSTEM ACTION CODES BEFORE THIS COMMENT***
+
+//------------------------------------------------------------------------
+// Custom action code base (custom action codes begin at this value)
+//------------------------------------------------------------------------
+#define sysAppLaunchCmdCustomBase 0x8000
+
+// Your custom launch codes can be defined like this:
+//
+// typedef enum {
+// myAppCmdDoSomething = sysAppLaunchCmdCustomBase,
+// myAppCmdDoSomethingElse,
+// myAppCmdEtcetera
+//
+// } MyAppCustomActionCodes;
+
+
+
+//------------------------------------------------------------------------
+// SysAppLaunch flags (passed to PilotMain)
+//------------------------------------------------------------------------
+
+#define sysAppLaunchFlagNewThread 0x01 // create a new thread for application
+ // - implies sysAppLaunchFlagNewStack
+#define sysAppLaunchFlagNewStack 0x02 // create separate stack for application
+#define sysAppLaunchFlagNewGlobals 0x04 // create new globals world for application
+ // - implies new owner ID for Memory chunks
+#define sysAppLaunchFlagUIApp 0x08 // notifies launch routine that this is a UI app being
+ // launched.
+#define sysAppLaunchFlagSubCall 0x10 // notifies launch routine that the app is calling it's
+ // entry point as a subroutine call. This tells the launch
+ // code that it's OK to keep the A5 (globals) pointer valid
+ // through the call.
+ // IMPORTANT: This flag is for internal use by
+ // SysAppLaunch only!!! It should NEVER be set
+ // by the caller.
+#define sysAppLaunchFlagDataRelocated 0x80 // global data (static ptrs) have been "relocated"
+ // by either SysAppStartup or StartupCode.c
+ // IMPORTANT: This flag is for internal use by
+ // SysAppLaunch only!!! It should NEVER be set
+ // by the caller.
+
+// The set of private, internal flags that should never be set by the caller
+#define sysAppLaunchFlagPrivateSet (sysAppLaunchFlagSubCall | sysAppLaunchFlagDataRelocated)
+
+
+
+//-------------------------------------------------------------------
+// Parameter blocks for action codes
+// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo
+// action codes are defined in "Find.h";
+//---------------------------------------------------------------------------
+
+// For sysAppLaunchCmdSaveData
+typedef struct {
+ Boolean uiComing; // true if system dialog will be put up
+ // before coming action code arrives.
+ UInt8 reserved1;
+ } SysAppLaunchCmdSaveDataType;
+
+// For sysAppLaunchCmdSystemReset
+typedef struct {
+ Boolean hardReset; // true if system was hardReset, false if soft-reset.
+ Boolean createDefaultDB; // true if app should create default database.
+ } SysAppLaunchCmdSystemResetType;
+
+
+// For sysAppLaunchCmdInitDatabase
+typedef struct SysAppLaunchCmdInitDatabaseType {
+ DmOpenRef dbP; // Handle of the newly-created database,
+ // already open for read/write access.
+ // IMPORTANT: The handler *MUST* leave
+ // this database handle open on return.
+ UInt32 creator; // Creator ID of the newly-created database
+ UInt32 type; // Type ID of the newly-created database
+ UInt16 version; // Version number of the newly-created database
+ } SysAppLaunchCmdInitDatabaseType;
+
+
+// For sysAppLaunchCmdSyncCallApplicationV10
+// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp
+// for later platforms.
+typedef struct SysAppLaunchCmdSyncCallApplicationTypeV10 {
+ UInt16 action; // call action id (app-specific)
+ UInt16 paramSize; // parameter size
+ void * paramP; // ptr to parameter
+ UInt8 remoteSocket; // remote socket id
+ UInt8 tid; // command transaction id
+ Boolean handled; // if handled, MUST be set true by the app
+ UInt8 reserved1;
+ } SysAppLaunchCmdSyncCallApplicationTypeV10;
+
+
+// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater).
+// This structure replaces SysAppLaunchCmdSyncCallApplicationType
+// which was used in Pilot v1.0
+typedef struct SysAppLaunchCmdHandleSyncCallAppType {
+ UInt16 pbSize; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType)
+ UInt16 action; // call action id (app-specific)
+ void * paramP; // ptr to parameter
+ UInt32 dwParamSize; // parameter size
+ void * dlRefP; // DesktopLink reference pointer for passing
+ // to DlkControl()'s dlkCtlSendCallAppReply code
+
+ Boolean handled; // initialized to FALSE by DLServer; if
+ // handled, MUST be set TRUE by the app(the
+ // handler MUST call DlkControl with
+ // control code dlkCtlSendCallAppReply);
+ // if the handler is not going to send a reply,
+ // it should leave this field set to FALSE, in which
+ // case DesktopLink Server will send the default
+ // "unknown request" reply.
+
+ UInt8 reserved1;
+
+ Err replyErr; // error from dlkCtlSendCallAppReply
+
+ // RESERVED FOR FUTURE EXTENSIONS
+ UInt32 dwReserved1; // RESERVED -- set to null!!!
+ UInt32 dwReserved2; // RESERVED -- set to null!!!
+
+ // Target executable creator and type for testing the mechanism
+ // in EMULATION MODE ONLY!!!
+ #if EMULATION_LEVEL != EMULATION_NONE
+ UInt32 creator;
+ UInt32 type;
+ #endif
+
+ } SysAppLaunchCmdHandleSyncCallAppType;
+
+// For sysAppLaunchCmdFailedAppNotify
+typedef struct
+ {
+ UInt32 creator;
+ UInt32 type;
+ Err result;
+ } SysAppLaunchCmdFailedAppNotifyType;
+
+
+// For sysAppLaunchCmdOpenDB
+typedef struct
+ {
+ UInt16 cardNo;
+ LocalID dbID;
+ } SysAppLaunchCmdOpenDBType;
+
+
+/************************************************************
+ * Structure of Application info for an application. Applications
+ * do not necessarily have to be on their own thread - there
+ * can be more than 1 app on the same AMX task. Each application
+ * has an assocated SysAppInfoType structure which holds the
+ * application specific information like the database MemHandle of the
+ * app, the code MemHandle, the stack chunk pointer, the owner ID, etc.
+ *
+ * As of PalmOS 3.X, one of these structures is created for each
+ * app running as an action code.
+ *
+ ****
+ ****IMPORTANT: ADD NEW FIELDS AT THE END OF THE STRUCTURE FOR
+ **** BACKWARD COMPATIBILITY
+ ****
+ *************************************************************/
+typedef struct SysAppInfoType {
+ Int16 cmd; // command code for app
+ MemPtr cmdPBP; // cmd ParamBlock
+ UInt16 launchFlags; // launch flags
+
+ UInt32 taskID; // AMX task ID of task that app runs in
+ MemHandle codeH; // code MemHandle of the main code segment
+ DmOpenRef dbP; // Application database access MemPtr of App
+ UInt8 *stackP; // stack chunk for the App
+ UInt8 *globalsChunkP; // globals chunk for the App
+
+ UInt16 memOwnerID; // owner ID for Memory Manager chunks
+ MemPtr dmAccessP; // pointer to linked list of opened DB's
+ Err dmLastErr; // Last error from Data Manager
+ MemPtr errExceptionP; // ErrTry,Catch exception list
+
+ // PalmOS v3.0 fields begin here
+ UInt8 *a5Ptr; // A5 MemPtr for this app
+ UInt8 *stackEndP; // stack chunk end for the App (last byte)
+ UInt8 *globalEndP; // global chunk end for the App (last byte)
+ struct SysAppInfoType *rootP; // Points to the SysAppInfoType first
+ // allocated for this thread.
+ MemPtr extraP; // unused MemPtr for the App.
+ } SysAppInfoType;
+typedef SysAppInfoType *SysAppInfoPtr;
+
+
+/************************************************************
+ * Function prototype for libraries
+ *************************************************************/
+
+// ***IMPORTANT***
+// ***IMPORTANT***
+// ***IMPORTANT***
+//
+// The assembly level TrapDispatcher() function uses a hard-coded value for
+// the size of the structure SysLibTblEntryType to obtain a pointer to a
+// library entry in the library table. Therefore, any changes to this structure,
+// require corresponding changes in TrapDispatcher() in ROMBoot.c. Furthermore,
+// it is advantageous to keep the size of the structure a power of 2 as this
+// improves performance by allowing the entry offset to be calculated by shifting
+// left instead of using the multiply instruction. vmk 8/27/96 (yes, I fell into
+// this trap myself)
+typedef struct SysLibTblEntryType {
+ MemPtr *dispatchTblP; // pointer to library dispatch table
+ void *globalsP; // Library globals
+
+ // New INTERNAL fields for v2.0 (vmk 8/27/96):
+ LocalID dbID; // database id of the library
+ void *codeRscH; // library code resource handle for RAM-based libraries
+ } SysLibTblEntryType;
+typedef SysLibTblEntryType* SysLibTblEntryPtr;
+
+// Emulated versions of libraries have a slightly different dispatch table
+// Enough for the offset to the library name and the name itself.
+#if EMULATION_LEVEL != EMULATION_NONE
+typedef struct SimDispatchTableType {
+ UInt32 numEntries; // number of library entries
+ void *entries[1]; // dispatch routine entries
+ // followed by pointer to name
+ } SimDispatchTableType;
+typedef SimDispatchTableType* SimDispatchTablePtr;
+#endif
+
+
+// Library entry point procedure
+typedef Err (*SysLibEntryProcPtr)(UInt16 refNum, SysLibTblEntryPtr entryP);
+
+// This library refNum is reserved for the Debugger comm library
+#define sysDbgCommLibraryRefNum 0
+
+// This portID is reserved for identifying the debugger's port
+#define sysDbgCommPortID 0xC0FF
+
+// This refNum signals an invalid refNum
+#define sysInvalidRefNum 0xFFFF
+
+
+/************************************************************
+ * Function prototype for Kernel
+ *************************************************************/
+// Task termination procedure prototype for use with SysTaskSetTermProc
+typedef void (*SysTermProcPtr)(UInt32 taskID, Int32 reason);
+
+// Timer procedure for use with SysTimerCreate
+typedef void (*SysTimerProcPtr)(Int32 timerID, Int32 param);
+
+
+
+
+/************************************************************
+ * System Errors
+ *************************************************************/
+#define sysErrTimeout (sysErrorClass | 1)
+#define sysErrParamErr (sysErrorClass | 2)
+#define sysErrNoFreeResource (sysErrorClass | 3)
+#define sysErrNoFreeRAM (sysErrorClass | 4)
+#define sysErrNotAllowed (sysErrorClass | 5)
+#define sysErrSemInUse (sysErrorClass | 6)
+#define sysErrInvalidID (sysErrorClass | 7)
+#define sysErrOutOfOwnerIDs (sysErrorClass | 8)
+#define sysErrNoFreeLibSlots (sysErrorClass | 9)
+#define sysErrLibNotFound (sysErrorClass | 10)
+#define sysErrDelayWakened (sysErrorClass | 11) // SysTaskDelay wakened by SysTaskWake before delay completed.
+#define sysErrRomIncompatible (sysErrorClass | 12)
+#define sysErrBufTooSmall (sysErrorClass | 13)
+#define sysErrPrefNotFound (sysErrorClass | 14)
+
+// NotifyMgr error codes:
+#define sysNotifyErrEntryNotFound (sysErrorClass | 16) // could not find registration entry in the list
+#define sysNotifyErrDuplicateEntry (sysErrorClass | 17) // identical entry already exists
+#define sysNotifyErrBroadcastBusy (sysErrorClass | 19) // a broadcast is already in progress - try again later.
+#define sysNotifyErrBroadcastCancelled (sysErrorClass | 20) // a handler cancelled the broadcast
+
+// AMX error codes continued - jb 10/20/98
+#define sysErrMbId (sysErrorClass | 21)
+#define sysErrMbNone (sysErrorClass | 22)
+#define sysErrMbBusy (sysErrorClass | 23)
+#define sysErrMbFull (sysErrorClass | 24)
+#define sysErrMbDepth (sysErrorClass | 25)
+#define sysErrMbEnv (sysErrorClass | 26)
+
+// NotifyMgr Phase #2 Error Codes:
+#define sysNotifyErrQueueFull (sysErrorClass | 27) // deferred queue is full.
+#define sysNotifyErrQueueEmpty (sysErrorClass | 28) // deferred queue is empty.
+#define sysNotifyErrNoStackSpace (sysErrorClass | 29) // not enough stack space for a broadcast
+#define sysErrNotInitialized (sysErrorClass | 30) // manager is not initialized
+
+// AMX error/warning codes continued - jed 9/10/99
+#define sysErrNotAsleep (sysErrorClass | 31) // Task woken by SysTaskWake was not asleep, 1 wake pending
+#define sysErrNotAsleepN (sysErrorClass | 32) // Task woken by SysTaskWake was not asleep, >1 wake pending
+
+
+// Power Manager error codes - should these be located elsewhere? -soe-
+#define pwrErrNone (pwrErrorClass | 0)
+#define pwrErrBacklight (pwrErrorClass | 1)
+#define pwrErrRadio (pwrErrorClass | 2)
+#define pwrErrBeam (pwrErrorClass | 3)
+
+
+
+/************************************************************
+ * System Features
+ *************************************************************/
+#define sysFtrCreator sysFileCSystem // Feature Creator
+
+#define sysFtrNumROMVersion 1 // ROM Version
+ // 0xMMmfsbbb, where MM is major version, m is minor version
+ // f is bug fix, s is stage: 3-release,2-beta,1-alpha,0-development,
+ // bbb is build number for non-releases
+ // V1.12b3 would be: 0x01122003
+ // V2.00a2 would be: 0x02001002
+ // V1.01 would be: 0x01013000
+
+#define sysFtrNumProcessorID 2 // Product id
+ // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision.
+#define sysFtrNumProcessorMask 0xFFFF0000 // Mask to obtain processor model
+#define sysFtrNumProcessor328 0x00010000 // Motorola 68328 (Dragonball)
+#define sysFtrNumProcessorEZ 0x00020000 // Motorola 68EZ328 (Dragonball EZ)
+#define sysFtrNumProductID sysFtrNumProcessorID // old (obsolete) define
+
+#define sysFtrNumBacklight 3 // Backlight
+ // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present
+
+#define sysFtrNumEncryption 4 // Which encryption schemes are present
+#define sysFtrNumEncryptionMaskDES 0x00000001 // bit 0: 1 if DES is present
+
+#define sysFtrNumCountry 5 // International ROM identifier
+ // Result is of type CountryType as defined in Preferences.h.
+ // Result is essentially the "default" country for this ROM.
+ // Assume cUnitedStates if sysFtrNumROMVersion >= 02000000
+ // and feature does not exist. Result is in low sixteen bits.
+
+#define sysFtrNumLanguage 6 // Language identifier
+ // Result is of untyped; values are defined in Incs:BuildRules.h
+ // Result is essentially the "default" language for this ROM.
+ // This is new for the WorkPad (v2.0.2) and did NOT exist for any of the
+ // following: GermanPersonal, GermanPro, FrenchPersonal, FrenchPro
+ // Thus we can't really assume anything if the feature doesn't exist,
+ // though the actual language MAY be determined from sysFtrNumCountry,
+ // above. Result is in low sixteen bits.
+
+#define sysFtrNumDisplayDepth 7 // Display depth
+ // Result is the "default" display depth for the screen. (PalmOS 3.0)
+ // This value is used by ScrDisplayMode when setting the default display depth.
+
+#define sysFtrNumHwrMiscFlags 8 // GHwrMiscFlags value (PalmOS 3.1)
+#define sysFtrNumHwrMiscFlagsExt 9 // GHwrMiscFlagsExt value (PalmOS 3.1)
+
+#define sysFtrNumIntlMgr 10
+ // Result is a set of flags that define functionality supported
+ // by the Int'l Manager. (PalmOS 3.1)
+
+#define sysFtrNumEncoding 11
+ // Result is the character encoding (defined in TextMgr.h) supported
+ // by this ROM. If this feature doesn't exist then the assumed encoding
+ // is latin (Windows code page 1252). (PalmOS 3.1)
+
+#define sysFtrDefaultFont 12
+ // Default font ID used for displaying text. (PalmOS 3.1)
+
+#define sysFtrDefaultBoldFont 13
+ // Default font ID used for displaying bold text. (PalmOS 3.1)
+
+#define sysFtrNumGremlinsSupportGlobals 14 // Globals for supporting gremlins.
+ // This value is a pointer to a memory location that stores global variables needed
+ // for intelligently supporting gremlins. Currently, it is only used in Progress.c.
+ // It is only initialized on first use (gremlins and progress bar in combination)
+ // when ERROR_CHECK_LEVEL == ERROR_CHECK_FULL. (PalmOS 3.2)
+
+#define sysFtrNumVendor 15
+ // Result is the vendor id, in the low sixteen bits. (PalmOS 3.3)
+#ifndef PUBLIC_STUFF_STRIPPED
+ // DOLATER: Need more information about what to expect in this feature.
+#endif // PUBLIC_STUFF_STRIPPED
+
+#define sysFtrNumCharEncodingFlags 16
+ // Flags for a given character encoding, specified in TextMgr.h (PalmOS 3.5)
+
+#define sysFtrNumNotifyMgrVersion 17 // version of the NotifyMgr, if any (PalmOS 3.5)
+
+#define sysFtrNumOEMROMVersion 18 // Supplemental ROM version, provided by OEM
+ // This value may be present in OEM devices, and is in the same format
+ // as sysFtrNumROMVersion. (PalmOS 3.5)
+
+#define sysFtrNumErrorCheckLevel 19 // ROM build setting of ERROR_CHECK_LEVEL
+ // May be set to ERROR_CHECK_NONE, ERROR_CHECK_PARTIAL, or ERROR_CHECK_FULL
+ // as defined in <BuildDefines.h>. (PalmOS 3.5)
+
+#define sysFtrNumOEMCompanyID 20 // GHwrOEMCompanyID value (PalmOS 3.5)
+#define sysFtrNumOEMDeviceID 21 // GHwrOEMDeviceID value (PalmOS 3.5)
+#define sysFtrNumOEMHALID 22 // GHwrOEMHALID value (PalmOS 3.5)
+
+
+/************************************************************
+ * ROM token information (for SysGetROMToken, below)
+ *************************************************************/
+// Additional tokens and token information is located in <Hardware.h>
+#define sysROMTokenSnum 'snum' // Memory Card Flash ID (serial number)
+
+
+/************************************************************
+ * Macros for extracting and combining ROM/OS version components
+ *************************************************************/
+
+// ROM/OS stage numbers
+#define sysROMStageDevelopment (0)
+#define sysROMStageAlpha (1)
+#define sysROMStageBeta (2)
+#define sysROMStageRelease (3)
+
+
+// MACRO: sysMakeROMVersion
+//
+// Builds a ROM version value from the major, minor, fix, stage, and build numbers
+//
+#define sysMakeROMVersion(major, minor, fix, stage, buildNum) \
+ ( \
+ (((UInt32)((UInt8)(major) & 0x0FF)) << 24) | \
+ (((UInt32)((UInt8)(minor) & 0x00F)) << 20) | \
+ (((UInt32)((UInt8)(fix) & 0x00F)) << 16) | \
+ (((UInt32)((UInt8)(stage) & 0x00F)) << 12) | \
+ (((UInt32)((UInt16)(buildNum) & 0x0FFF))) \
+ )
+
+
+// Macros for parsing the ROM version number
+// (the system OS version is obtained by calling
+// FtrGet(sysFtrCreator, sysFtrNumROMVersion, dwOSVerP), where dwOSVerP is
+// a pointer to to a UInt32 variable that is to receive the OS version number)
+#define sysGetROMVerMajor(dwROMVer) (((UInt16)((dwROMVer) >> 24)) & 0x00FF)
+#define sysGetROMVerMinor(dwROMVer) (((UInt16)((dwROMVer) >> 20)) & 0x000F)
+#define sysGetROMVerFix(dwROMVer) (((UInt16)((dwROMVer) >> 16)) & 0x000F)
+#define sysGetROMVerStage(dwROMVer) (((UInt16)((dwROMVer) >> 12)) & 0x000F)
+#define sysGetROMVerBuild(dwROMVer) (((UInt16)(dwROMVer)) & 0x0FFF)
+
+
+
+
+/************************************************************
+ * System Types
+ *************************************************************/
+
+// Types of batteries installed.
+typedef enum {
+ sysBatteryKindAlkaline=0,
+ sysBatteryKindNiCad,
+ sysBatteryKindLiIon,
+ sysBatteryKindRechAlk,
+ sysBatteryKindNiMH,
+ sysBatteryKindLiIon1400,
+ sysBatteryKindLast=0xFF // insert new battery types BEFORE this one
+ } SysBatteryKind;
+
+// Different battery states (output of hwrBattery)
+typedef enum {
+ sysBatteryStateNormal=0,
+ sysBatteryStateLowBattery,
+ sysBatteryStateCritBattery,
+ sysBatteryStateShutdown
+ } SysBatteryState;
+
+
+// SysCreateDataBaseList can generate a list of database.
+typedef struct
+ {
+ Char name[dmDBNameLength];
+ UInt32 creator;
+ UInt32 type;
+ UInt16 version;
+ LocalID dbID;
+ UInt16 cardNo;
+ BitmapPtr iconP;
+ } SysDBListItemType;
+
+
+// Structure of a generic message that can be send to a mailbox
+// through the SysMailboxSend call. Note, this structure MUST
+// be CJ_MAXMSZ bytes large, where CJ_MAXMSZ is defined in
+// the AMX includes.
+typedef struct {
+ UInt32 data[3];
+ } SysMailboxMsgType;
+
+
+// Constants used by the SysEvGroupSignal call
+#define sysEvGroupSignalConstant 0
+#define sysEvGroupSignalPulse 1
+
+// Constants used by the SysEvGroupWait call
+#define sysEvGroupWaitOR 0
+#define sysEvGroupWaitAND 1
+
+
+
+/************************************************************
+ * System Pre-defined "file descriptors"
+ * These are used by applications that use the Net Library's
+ * NetLibSelect() call
+ *************************************************************/
+#define sysFileDescStdIn 0
+
+
+/************************************************************
+ * Function Prototypes
+ *************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Prototype for Pilot applications entry point
+UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags);
+
+
+// SystemMgr routines
+void SysUnimplemented(void)
+ SYS_TRAP(sysTrapSysUnimplemented);
+
+void SysColdBoot(void *card0P, UInt32 card0Size,
+ void *card1P, UInt32 card1Size,
+ UInt32 sysCardHeaderOffset)
+ SYS_TRAP(sysTrapSysColdBoot);
+
+void SysInit(void)
+ SYS_TRAP(sysTrapSysInit);
+
+void SysReset(void)
+ SYS_TRAP(sysTrapSysReset);
+
+void SysPowerOn(void *card0P, UInt32 card0Size,
+ void *card1P, UInt32 card1Size,
+ UInt32 sysCardHeaderOffset, Boolean reFormat);
+
+
+void SysDoze(Boolean onlyNMI)
+ SYS_TRAP(sysTrapSysDoze);
+
+Err SysSetPerformance(UInt32 *sysClockP, UInt16 *cpuDutyP)
+ SYS_TRAP(sysTrapSysSetPerformance);
+
+void SysSleep(Boolean untilReset, Boolean emergency)
+ SYS_TRAP(sysTrapSysSleep);
+
+UInt16 SysSetAutoOffTime(UInt16 seconds)
+ SYS_TRAP(sysTrapSysSetAutoOffTime);
+
+UInt16 SysTicksPerSecond(void)
+ SYS_TRAP(sysTrapSysTicksPerSecond);
+
+Err SysLaunchConsole(void)
+ SYS_TRAP(sysTrapSysLaunchConsole);
+
+Boolean SysHandleEvent(EventPtr eventP)
+ SYS_TRAP(sysTrapSysHandleEvent);
+
+void SysUILaunch(void)
+ SYS_TRAP(sysTrapSysUILaunch);
+
+Err SysUIAppSwitch(UInt16 cardNo, LocalID dbID, UInt16 cmd, MemPtr cmdPBP)
+ SYS_TRAP(sysTrapSysUIAppSwitch);
+
+Err SysCurAppDatabase(UInt16 *cardNoP, LocalID *dbIDP)
+ SYS_TRAP(sysTrapSysCurAppDatabase);
+
+Err SysBroadcastActionCode(UInt16 cmd, MemPtr cmdPBP)
+ SYS_TRAP(sysTrapSysBroadcastActionCode);
+
+Err SysAppLaunch(UInt16 cardNo, LocalID dbID, UInt16 launchFlags,
+ UInt16 cmd, MemPtr cmdPBP, UInt32 *resultP)
+ SYS_TRAP(sysTrapSysAppLaunch);
+
+UInt16 SysNewOwnerID(void)
+ SYS_TRAP(sysTrapSysNewOwnerID);
+
+UInt32 SysSetA5(UInt32 newValue)
+ SYS_TRAP(sysTrapSysSetA5);
+
+// Routines used by startup code
+Err SysAppStartup(SysAppInfoPtr *appInfoPP, MemPtr *prevGlobalsP,
+ MemPtr *globalsPtrP)
+ SYS_TRAP(sysTrapSysAppStartup);
+
+Err SysAppExit(SysAppInfoPtr appInfoP, MemPtr prevGlobalsP, MemPtr globalsP)
+ SYS_TRAP(sysTrapSysAppExit);
+
+
+#if EMULATION_LEVEL != EMULATION_NONE
+// Simulator-specific routines
+MemPtr SysCardImageInfo(UInt16 cardNo, UInt32 *sizeP);
+
+void SysCardImageDeleted(UInt16 cardNo);
+#endif // EMULATION_LEVEL != EMULATION_NONE
+
+UInt16 SysUIBusy(Boolean set, Boolean value)
+ SYS_TRAP(sysTrapSysUIBusy);
+
+UInt8 SysLCDContrast(Boolean set, UInt8 newContrastLevel)
+ SYS_TRAP(sysTrapSysLCDContrast);
+
+UInt8 SysLCDBrightness(Boolean set, UInt8 newBrightnessLevel)
+ SYS_TRAP(sysTrapSysLCDBrightness);
+
+
+// System Dialogs
+void SysBatteryDialog(void)
+ SYS_TRAP(sysTrapSysBatteryDialog);
+
+// Utilities
+Err SysSetTrapAddress(UInt16 trapNum, void *procP)
+ SYS_TRAP(sysTrapSysSetTrapAddress);
+
+void * SysGetTrapAddress(UInt16 trapNum)
+ SYS_TRAP(sysTrapSysGetTrapAddress);
+
+UInt16 SysDisableInts(void)
+ SYS_TRAP(sysTrapSysDisableInts);
+
+void SysRestoreStatus(UInt16 status)
+ SYS_TRAP(sysTrapSysRestoreStatus);
+
+extern Char * SysGetOSVersionString()
+ SYS_TRAP(sysTrapSysGetOSVersionString);
+
+// The following trap is a public definition of HwrGetROMToken from <Hardware.h>
+// See token definitions (like sysROMTokenSerial) above...
+Err SysGetROMToken(UInt16 cardNo, UInt32 token, UInt8 **dataP, UInt16 *sizeP )
+ SYS_TRAP(sysTrapHwrGetROMToken);
+
+
+// Library Management
+Err SysLibInstall(SysLibEntryProcPtr libraryP, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibInstall);
+
+Err SysLibLoad(UInt32 libType, UInt32 libCreator, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibLoad);
+
+
+Err SysLibRemove(UInt16 refNum)
+ SYS_TRAP(sysTrapSysLibRemove);
+
+Err SysLibFind(const Char *nameP, UInt16 *refNumP)
+ SYS_TRAP(sysTrapSysLibFind);
+
+SysLibTblEntryPtr SysLibTblEntry(UInt16 refNum)
+ SYS_TRAP(sysTrapSysLibTblEntry);
+
+// Generic Library calls
+Err SysLibOpen(UInt16 refNum)
+ SYS_TRAP(sysLibTrapOpen);
+Err SysLibClose(UInt16 refNum)
+ SYS_TRAP(sysLibTrapClose);
+Err SysLibSleep(UInt16 refNum)
+ SYS_TRAP(sysLibTrapSleep);
+Err SysLibWake(UInt16 refNum)
+ SYS_TRAP(sysLibTrapWake);
+
+
+//-----------------------------------------------------
+// Kernel Prototypes
+//-----------------------------------------------------
+// Task Creation and deleation
+Err SysTranslateKernelErr(Err err)
+ SYS_TRAP(sysTrapSysTranslateKernelErr);
+
+Err SysTaskCreate(UInt32 *taskIDP, UInt32 *creator, ProcPtr codeP,
+ MemPtr stackP, UInt32 stackSize, UInt32 attr, UInt32 priority,
+ UInt32 tSlice)
+ SYS_TRAP(sysTrapSysTaskCreate);
+
+Err SysTaskDelete(UInt32 taskID, UInt32 priority)
+ SYS_TRAP(sysTrapSysTaskDelete);
+
+Err SysTaskTrigger(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskTrigger);
+
+UInt32 SysTaskID()
+ SYS_TRAP(sysTrapSysTaskID);
+
+Err SysTaskDelay(Int32 delay)
+ SYS_TRAP(sysTrapSysTaskDelay);
+
+Err SysTaskSetTermProc(UInt32 taskID, SysTermProcPtr termProcP)
+ SYS_TRAP(sysTrapSysTaskSetTermProc);
+
+Err SysTaskSwitching(Boolean enable)
+ SYS_TRAP(sysTrapSysTaskSwitching);
+
+Err SysTaskWait(Int32 timeout)
+ SYS_TRAP(sysTrapSysTaskWait);
+
+Err SysTaskWake(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskWake);
+
+void SysTaskWaitClr(void)
+ SYS_TRAP(sysTrapSysTaskWaitClr);
+
+Err SysTaskSuspend(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskSuspend);
+
+Err SysTaskResume(UInt32 taskID)
+ SYS_TRAP(sysTrapSysTaskResume);
+
+
+// Counting Semaphores
+Err SysSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP, Int32 initValue)
+ SYS_TRAP(sysTrapSysSemaphoreCreate);
+
+Err SysSemaphoreDelete(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreDelete);
+
+Err SysSemaphoreWait(UInt32 smID, UInt32 priority, Int32 timeout)
+ SYS_TRAP(sysTrapSysSemaphoreWait);
+
+Err SysSemaphoreSignal(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreSignal);
+
+Err SysSemaphoreSet(UInt32 smID)
+ SYS_TRAP(sysTrapSysSemaphoreSet);
+
+
+// Resource Semaphores
+Err SysResSemaphoreCreate(UInt32 *smIDP, UInt32 *tagP)
+ SYS_TRAP(sysTrapSysResSemaphoreCreate);
+
+Err SysResSemaphoreDelete(UInt32 smID)
+ SYS_TRAP(sysTrapSysResSemaphoreDelete);
+
+Err SysResSemaphoreReserve(UInt32 smID, UInt32 priority, Int32 timeout)
+ SYS_TRAP(sysTrapSysResSemaphoreReserve);
+
+Err SysResSemaphoreRelease(UInt32 smID)
+ SYS_TRAP(sysTrapSysResSemaphoreRelease);
+
+
+
+// Timers
+Err SysTimerCreate(UInt32 *timerIDP, UInt32 *tagP,
+ SysTimerProcPtr timerProc, UInt32 periodicDelay,
+ UInt32 param)
+ SYS_TRAP(sysTrapSysTimerCreate);
+
+Err SysTimerDelete(UInt32 timerID)
+ SYS_TRAP(sysTrapSysTimerDelete);
+
+Err SysTimerWrite(UInt32 timerID, UInt32 value)
+ SYS_TRAP(sysTrapSysTimerWrite);
+
+Err SysTimerRead(UInt32 timerID, UInt32 *valueP)
+ SYS_TRAP(sysTrapSysTimerRead);
+
+
+// Information
+Err SysKernelInfo(void *paramP)
+ SYS_TRAP(sysTrapSysKernelInfo);
+
+Boolean SysCreateDataBaseList(UInt32 type, UInt32 creator, UInt16 *dbCount,
+ MemHandle *dbIDs, Boolean lookupName)
+ SYS_TRAP(sysTrapSysCreateDataBaseList);
+
+Boolean SysCreatePanelList(UInt16 *panelCount, MemHandle *panelIDs)
+ SYS_TRAP(sysTrapSysCreatePanelList);
+
+UInt16 SysBatteryInfo(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP,
+ Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn, UInt8 *percentP)
+ SYS_TRAP(sysTrapSysBatteryInfo);
+
+UInt16 SysBatteryInfoV20(Boolean set, UInt16 *warnThresholdP, UInt16 *criticalThresholdP,
+ Int16 *maxTicksP, SysBatteryKind* kindP, Boolean *pluggedIn)
+ SYS_TRAP(sysTrapSysBatteryInfoV20);
+
+Boolean SysGetStackInfo(MemPtr *startPP, MemPtr *endPP)
+ SYS_TRAP(sysTrapSysGetStackInfo);
+
+
+
+// Mailboxes
+Err SysMailboxCreate(UInt32 *mbIDP, UInt32 *tagP, UInt32 depth)
+ SYS_TRAP(sysTrapSysMailboxCreate);
+
+Err SysMailboxDelete(UInt32 mbID)
+ SYS_TRAP(sysTrapSysMailboxDelete);
+
+Err SysMailboxFlush(UInt32 mbID)
+ SYS_TRAP(sysTrapSysMailboxFlush);
+
+Err SysMailboxSend(UInt32 mbID, void *msgP, UInt32 wAck)
+ SYS_TRAP(sysTrapSysMailboxSend);
+
+Err SysMailboxWait(UInt32 mbID, void *msgP, UInt32 priority,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSysMailboxWait);
+
+// Event Groups
+Err SysEvGroupCreate(UInt32 *evIDP, UInt32 *tagP, UInt32 init)
+ SYS_TRAP(sysTrapSysEvGroupCreate);
+
+//Err SysEvGroupDelete(UInt32 evID) // save trap table space - don't need
+ //SYS_TRAP(sysTrapSysEvGroupDelete);
+
+Err SysEvGroupSignal(UInt32 evID, UInt32 mask, UInt32 value, Int32 type)
+ SYS_TRAP(sysTrapSysEvGroupSignal);
+
+Err SysEvGroupRead(UInt32 evID, UInt32 *valueP)
+ SYS_TRAP(sysTrapSysEvGroupRead);
+
+Err SysEvGroupWait(UInt32 evID, UInt32 mask, UInt32 value, Int32 matchType,
+ Int32 timeout)
+ SYS_TRAP(sysTrapSysEvGroupWait);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+/************************************************************
+ * Assembly Function Prototypes
+ *************************************************************/
+#define _SysSemaphoreSignal \
+ ASM_SYS_TRAP(sysTrapSysSemaphoreSignal)
+
+#define _SysSemaphoreSet \
+ ASM_SYS_TRAP(sysTrapSysSemaphoreSet)
+
+#define _SysDoze \
+ ASM_SYS_TRAP(sysTrapSysDoze)
+
+
+#endif //__SYSTEMMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h
new file mode 100644
index 0000000..80c562b
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemPkt.h
@@ -0,0 +1,430 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemPkt.h
+ *
+ * Description:
+ * Structure of System Packets for the Serial Link Manager. These
+ * packets are used by the Debugger, Console, and Remote UI modules
+ * for communication with the host computer.
+ *
+ * History:
+ * 6/26/95 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************/
+
+#ifndef __SYSTEM_PKT_H__
+#define __SYSTEM_PKT_H__
+
+#include <SerialLinkMgr.h>
+
+
+//*************************************************************************
+// Constants for System Packets
+//
+//*************************************************************************
+
+// Max # of bytes we can read/write at a time with the ReadMem and WriteMem
+// commands;
+#define sysPktMaxMemChunk 256
+
+// Maximum body size for System Packets. This is big enough to have
+// 256 bytes of data for the Read and Write Mem command plus whatever other
+// parameters are in the body for these commands.
+#define sysPktMaxBodySize (sysPktMaxMemChunk+16)
+
+
+// Default nitial timeout value for packet receive routines in ticks
+#define sysPktInitialTimeout (sysTicksPerSecond*10)
+
+
+
+//*************************************************************************
+// Packet Body Structure
+//*************************************************************************
+
+// Common fields at the start of every body
+#define _sysPktBodyCommon \
+ UInt8 command; \
+ UInt8 _filler
+
+
+// Generic System Packet Body
+typedef struct SysPktBodyType {
+ _sysPktBodyCommon;
+ UInt8 data[sysPktMaxBodySize-2];
+ } SysPktBodyType;
+typedef SysPktBodyType* SysPktBodyPtr;
+
+
+
+//*************************************************************************
+// The max size of the array of SlkWriteDataTypes used by System Packet
+// assembly routines in order to minimize stack usage.
+//*************************************************************************
+#define sysPktMaxBodyChunks 3
+
+
+
+//*************************************************************************
+// packet commands
+//*************************************************************************
+
+//--------------------------------------------------------------------
+// get state command
+//--------------------------------------------------------------------
+#define sysPktStateCmd 0x00
+#define sysPktStateRsp 0x80
+
+//--------------------------------------------------------------------
+// read memory command
+//--------------------------------------------------------------------
+#define sysPktReadMemCmd 0x01
+#define sysPktReadMemRsp 0x81
+
+typedef struct SysPktReadMemCmdType {
+ _sysPktBodyCommon; // Common Body header
+ void* address; // Address to read
+ UInt16 numBytes; // # of bytes to read
+ } SysPktReadMemCmdType;
+typedef SysPktReadMemCmdType* SysPktReadMemCmdPtr;
+
+typedef struct SysPktReadMemRspType {
+ _sysPktBodyCommon; // Common Body header
+ // UInt8 data[?]; // variable size
+ } SysPktReadMemRspType;
+typedef SysPktReadMemRspType* SysPktReadMemRspPtr;
+
+
+//--------------------------------------------------------------------
+// write memory command
+//--------------------------------------------------------------------
+#define sysPktWriteMemCmd 0x02
+#define sysPktWriteMemRsp 0x82
+
+typedef struct SysPktWriteMemCmdType {
+ _sysPktBodyCommon; // Common Body header
+ void* address; // Address to write
+ UInt16 numBytes; // # of bytes to write
+ // UInt8 data[?]; // variable size data
+ } SysPktWriteMemCmdType;
+typedef SysPktWriteMemCmdType* SysPktWriteMemCmdPtr;
+
+typedef struct SysPktWriteMemRspType {
+ _sysPktBodyCommon; // Common Body header
+ } SysPktWriteMemRspType;
+typedef SysPktWriteMemRspType* SysPktWriteMemRspPtr;
+
+
+//--------------------------------------------------------------------
+// single-step command
+//--------------------------------------------------------------------
+#define sysPktSingleStepCmd 0x03
+// no response
+
+//--------------------------------------------------------------------
+// get routine name command
+//--------------------------------------------------------------------
+#define sysPktGetRtnNameCmd 0x04
+#define sysPktGetRtnNameRsp 0x84
+
+//--------------------------------------------------------------------
+// read registers command
+//--------------------------------------------------------------------
+#define sysPktReadRegsCmd 0x05
+#define sysPktReadRegsRsp 0x85
+
+
+//--------------------------------------------------------------------
+// write registers command
+//--------------------------------------------------------------------
+#define sysPktWriteRegsCmd 0x06
+#define sysPktWriteRegsRsp 0x86
+
+//--------------------------------------------------------------------
+// continue command
+//--------------------------------------------------------------------
+#define sysPktContinueCmd 0x07
+// no response
+
+
+//--------------------------------------------------------------------
+// Remote Procedure call
+//--------------------------------------------------------------------
+#define sysPktRPCCmd 0x0A
+#define sysPktRPCRsp 0x8A
+
+typedef struct SysPktRPCParamInfo {
+ UInt8 byRef; // true if param is by reference
+ UInt8 size; // # of Bytes of paramData (must be even)
+ UInt16 data[1]; // variable length array of paramData
+ } SysPktRPCParamType;
+
+typedef struct SysPktRPCType {
+ _sysPktBodyCommon; // Common Body header
+ UInt16 trapWord; // which trap to execute
+ UInt32 resultD0; // result from D0 placed here
+ UInt32 resultA0; // result from A0 placed here
+ UInt16 numParams; // how many parameters follow
+ // Following is a variable length array ofSlkRPCParamInfo's
+ SysPktRPCParamType param[1];
+ } SysPktRPCType;
+
+
+//--------------------------------------------------------------------
+// Set/Get breakpoints
+//--------------------------------------------------------------------
+#define sysPktGetBreakpointsCmd 0x0B
+#define sysPktGetBreakpointsRsp 0x8B
+#define sysPktSetBreakpointsCmd 0x0C
+#define sysPktSetBreakpointsRsp 0x8C
+
+
+//--------------------------------------------------------------------
+// Remote UI Support - These packets are used by the screen driver
+// and event manager to support remote viewing and control of a Pilot
+// over the serial port.
+//--------------------------------------------------------------------
+#define sysPktRemoteUIUpdCmd 0x0C
+
+typedef struct SysPktRemoteUIUpdCmdType {
+ _sysPktBodyCommon; // Common Body header
+
+ // These parameters are sent from traget to host after drawing operations
+ UInt16 rowBytes; // rowbytes of update area
+ UInt16 fromY; // top of update rect
+ UInt16 fromX; // left of update rect
+ UInt16 toY; // top of screen rect
+ UInt16 toX; // left of screen rect
+ UInt16 height; // bottom of update rect
+ UInt16 width; // right of update rect
+
+ // The actual pixels of the update area follow
+ UInt16 pixels; // variable length...
+
+ } SysPktRemoteUIUpdCmdType;
+
+
+#define sysPktRemoteEvtCmd 0x0D
+
+typedef struct SysPktRemoteEvtCmdType {
+ _sysPktBodyCommon; // Common Body header
+
+ // These parameters are sent from host to target to feed pen and keyboard
+ // events. They do not require a response.
+ Boolean penDown; // true if pen down
+ UInt8 padding1;
+ Int16 penX; // X location of pen
+ Int16 penY; // Y location of pen
+
+ Boolean keyPress; // true if key event follows
+ UInt8 padding2;
+ UInt16 keyModifiers; // keyboard modifiers
+ WChar keyAscii; // key ascii code
+ UInt16 keyCode; // key virtual code
+
+ } SysPktRemoteEvtCmdType;
+
+
+//--------------------------------------------------------------------
+// Enable/Disable DbgBreak's command
+//--------------------------------------------------------------------
+#define sysPktDbgBreakToggleCmd 0x0D
+#define sysPktDbgBreakToggleRsp 0x8D
+
+
+//--------------------------------------------------------------------
+// Program Flash command - programs one sector of the FLASH ram
+// If numBytes is 0, this routine returns info on the flash in:
+// manuf - manufacturer code
+// device - device code
+//--------------------------------------------------------------------
+#define sysPktFlashCmd 0x0E // OBSOLETE AS OF 3.0! SEE BELOW!
+#define sysPktFlashRsp 0x8E // OSBOLETE AS OF 3.0! SEE BELOW!
+
+
+//--------------------------------------------------------------------
+// Get/Set communication parameters
+//--------------------------------------------------------------------
+#define sysPktCommCmd 0x0F
+#define sysPktCommRsp 0x8F
+
+typedef struct SysPktCommCmdType {
+ _sysPktBodyCommon; // Common Body header
+ Boolean set; // true to change parameters
+ UInt8 padding;
+ UInt32 baudRate; // new baud rate
+ UInt32 flags; // new flags
+ } SysPktCommCmdType;
+typedef SysPktCommCmdType *SysPktCommCmdPtr;
+
+typedef struct SysPktCommRspType {
+ _sysPktBodyCommon; // Common Body header
+ UInt32 baudRate; // current baud rate
+ UInt32 flags; // current flags
+ } SysPktCommRspType;
+typedef SysPktCommRspType *SysPktCommRspPtr;
+
+
+//--------------------------------------------------------------------
+// Get/Set Trap Breaks
+//--------------------------------------------------------------------
+#define sysPktGetTrapBreaksCmd 0x10
+#define sysPktGetTrapBreaksRsp 0x90
+#define sysPktSetTrapBreaksCmd 0x11
+#define sysPktSetTrapBreaksRsp 0x91
+
+
+//--------------------------------------------------------------------
+// Gremlins Support - These packets are used by the screen driver
+// and event manager to support remote viewing and control of a Pilot
+// over the serial port.
+//--------------------------------------------------------------------
+#define sysPktGremlinsCmd 0x12
+
+typedef struct SysPktGremlinsCmdType {
+ _sysPktBodyCommon; // Common Body header
+
+ // These parameters are sent from target to host to send Gremlins stuff
+ UInt16 action;
+ UInt8 data[32];
+
+ } SysPktGremlinsCmdType;
+
+// Gremlins action codes
+#define sysPktGremlinsIdle 1
+#define sysPktGremlinsEvent 2
+
+
+//--------------------------------------------------------------------
+// Find data - searches a range of addresses for data
+//--------------------------------------------------------------------
+#define sysPktFindCmd 0x13
+#define sysPktFindRsp (sysPktFindCmd | 0x80)
+
+typedef struct SysPktFindCmdType {
+ _sysPktBodyCommon; // Common Body header
+
+ UInt32 firstAddr; // first address to search
+ UInt32 lastAddr; // last address to begin searching
+ UInt16 numBytes; // number of data bytes to match
+ Boolean caseInsensitive; // if true, perform a case-insensitive search
+ UInt8 padding;
+ } SysPktFindCmdType;
+typedef SysPktFindCmdType* SysPktFindCmdPtr;
+
+typedef struct SysPktFindRspType {
+ _sysPktBodyCommon; // Common Body header
+
+ UInt32 addr; // address where data was found
+ Boolean found; // true if data was found
+ UInt8 padding;
+
+ } SysPktFindRspType;
+typedef SysPktFindRspType* SysPktFindRspPtr;
+
+
+//--------------------------------------------------------------------
+// Get/Set Trap Conditionals. These are used to tell the debugger
+// to conditionally break on a trap depending on the value of the
+// first word on the stack. They are used when setting a-traps on
+// library calls. This is a 3.0 feature.
+//--------------------------------------------------------------------
+#define sysPktGetTrapConditionsCmd 0x14
+#define sysPktGetTrapConditionsRsp 0x94
+#define sysPktSetTrapConditionsCmd 0x15
+#define sysPktSetTrapConditionsRsp 0x95
+
+
+//--------------------------------------------------------------------
+// Checksum data - checksums a range of memory.
+// This is a (late) 3.0 feature.
+//--------------------------------------------------------------------
+#define sysPktChecksumCmd 0x16
+#define sysPktChecksumRsp (sysPktChecksumCmd | 0x80)
+
+typedef struct SysPktChecksumType {
+ _sysPktBodyCommon; // Common Body header
+
+ UInt32 firstAddr; // -> first address to checksum
+ UInt16 numBytes; // -> number of bytes to checksum
+ UInt16 seed; // -> initial checksum value
+ UInt16 checksum; // <- checksum result
+ } SysPktChecksumType;
+typedef SysPktChecksumType* SysPktChecksumPtr;
+
+
+//--------------------------------------------------------------------
+// NEW Program Flash command - programs one sector of the FLASH ram
+// If numBytes is 0, this routine returns address to store flash code.
+// Supercedes Obsolete 1.0 and 2.0 sysPktFlashCmd call above in the 3.0 ROM
+//--------------------------------------------------------------------
+#define sysPktExecFlashCmd 0x17
+#define sysPktExecFlashRsp (sysPktExecFlashCmd | 0x80)
+
+
+//--------------------------------------------------------------------
+// message from remote unit
+//--------------------------------------------------------------------
+#define sysPktRemoteMsgCmd 0x7f
+
+
+//--------------------------------------------------------------------
+// sysPktRemoteMsg
+// Send a text message
+//--------------------------------------------------------------------
+typedef struct SysPktRemoteMsgCmdType {
+ _sysPktBodyCommon; // Common Body header
+ //UInt8 text; // variable length text goes here
+ } SysPktRemoteMsgCmdType;
+typedef SysPktRemoteMsgCmdType *SysPktRemoteMsgCmdPtr;
+
+
+
+
+
+/*******************************************************************
+ * Prototypes
+ *******************************************************************/
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//================================================================
+//
+// Host Only Routines.
+//
+//================================================================
+#if (EMULATION_LEVEL != EMULATION_NONE)
+
+
+ //-------------------------------------------------------------------
+ // RPC
+ //------------------------------------------------------------------
+ // Init preparate on an RPC packet header and body.
+ Err SlkRPCInitPacket(SlkPktHeaderType *headerP, UInt16 dstSocket,
+ SysPktRPCType *bodyP, UInt16 trapWord);
+
+
+ // Stuff a parameter into an RPC packet body
+ void * SlkRPCStuffParam(SysPktRPCType *bodyP, const void *dataP,
+ Int16 dataSize, Boolean byRef);
+
+ // Send RPC packet and wait for response.
+ Err SlkRPCExecute(SlkPktHeaderPtr headerP, SysPktRPCType *bodyP,
+ Boolean async);
+
+#endif // (EMULATION_LEVEL != EMULATION_NONE)
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+
+#endif //__SYSTEM_PKT_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h b/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h
new file mode 100644
index 0000000..39b4e92
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/SystemResources.h
@@ -0,0 +1,346 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1995-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemResources.h
+ *
+ * Description:
+ * Include file for both PalmRez and the C Compiler. This file contains
+ * equates used by both tools. When compiling using the C compiler
+ * the variable RESOURCE_COMPILER must be defined.
+ *
+ * History:
+ * 02/27/95 ron Created by Ron Marianetti
+ * 08/04/95 vmk Added system resource id for Desktop Link user info
+ * 02/03/98 tlw Changed sysFileCDefaultApp from sysFileCMemory which
+ * no longer exists to sysFileCPreferences.
+ * 6/23/98 jhl Added FlashMgr resource
+ * 06/23/98 jhl Added FlashMgr resource
+ * 05/05/99 kwk Added simulator creator/file types, also the
+ * Japanese user dict panel creator and the TSM
+ * library creator.
+ * 05/06/99 lyl Added OEM System File type
+ * 06/25/99 kwk Added sysResIDAppPrefs & sysResIDOverlayFeatures.
+ * 07/14/99 kwk Added sysResTSilkscreen.
+ * 08/08/99 kwk Added sysFileCJEDict.
+ * 09/20/99 kwk Added keyboard feature for reentrancy check.
+ *
+ *****************************************************************************/
+
+#ifndef __SYSTEMRESOURCES_H__
+#define __SYSTEMRESOURCES_H__
+
+//-----------------------------------------------------------
+// This section is common to both the C and Resource Compiler
+//-----------------------------------------------------------
+
+//................................................................
+// File types and creators
+//
+// Each database shall have a creator ID and a type.
+//
+// The creator ID shall establish which application, patch, or extension
+// a particular database is associated with. The creator ID should identify
+// the application/patch/extension, NOT who created it.
+//
+// The type will determine which part of an application,
+// patch, or extension a particular database is.
+//
+// There can be only one database per application, patch, or extension
+// which has type 'application', 'patch', or 'extension'.
+//
+// Creators:
+//
+// ROM-based applications created by Palm Computing have all-lower case
+// creator ID's. Third-party applications have creator ID's which
+// are either all caps, or mixed case. The same requirements go for
+// system patches and extensions.
+//
+// All applications, system patches and extensions shall have unique creator
+// ID's.
+//
+// Types:
+//
+// 'Application', 'Extension', and 'Patch' file/database types for ROM-based
+// apps shall be all-lower case (they are defined below). Other
+// file/database types must be mixed-case,
+// or all caps. These other types are internal to the applications, and
+// therefore the system is unconcerned with their exact values.
+//................................................................
+#define sysFileCSystem 'psys' // Creator type for System files
+#define sysFileCOEMSystem 'poem' // Creator type for OEM System files
+#define sysFileCGraffiti 'graf' // Creator type for Graffiti databases
+#define sysFileCSystemPatch 'ptch' // Creator for System resource file patches
+
+#define sysFileCCalculator 'calc' // Creator type for Calculator App
+#define sysFileCSecurity 'secr' // Creator type for Security App
+#define sysFileCPreferences 'pref' // Creator type for Preferences App
+#define sysFileCAddress 'addr' // Creator type for Address App
+#define sysFileCToDo 'todo' // Creator type for To Do App
+#define sysFileCDatebook 'date' // Creator type for Datebook App
+#define sysFileCMemo 'memo' // Creator type for MemoPad App
+#define sysFileCSync 'sync' // Creator type for HotSync App
+#define sysFileCMemory 'memr' // Creator type for Memory App
+#define sysFileCMail 'mail' // Creator type for Mail App
+#define sysFileCExpense 'exps' // Creator type for Expense App
+#define sysFileCLauncher 'lnch' // Creator type for Launcher App
+#define sysFileCClipper 'clpr' // Creator type for clipper app.
+#define sysFileCSetup 'setp' // Creator type for setup app.
+#define sysFileCActivate 'actv' // Creator type for activation app.
+#define sysFileCFlashInstaller 'fins' // Creator type for FlashInstaller app.
+#define sysFileCRFDiag 'rfdg' // Creator type for RF diagnostics app.
+#define sysFileCMessaging 'msgs' // Creator type for Messaging App
+#define sysFileCModemFlashTool 'gsmf' // Creator type for Palm V modem flash app.
+#define sysFileCJEDict 'dict' // Creator type for JEDict app.
+#define sysFileHotSyncServer 'srvr' // Creator type for HotSync(R) Server app.
+#define sysFileHotSyncServerUpdate 'hssu' // Creator type for HotSync(R) Server update app.
+
+// The following two apps are manufacturing, calibration and maintenance related
+#define sysFileCMACUtilScreen 'mcut' // Creator type for screen oriented MACUtil app.
+#define sysFileCMACUtilSerial 'mcus' // Creator type for serial line driven MACUtil app.
+#define sysResIDMACUtilAutostart 10000 // Autostart serial MACUtil
+
+// Demo Apps
+#define sysFileCGraffitiDemo 'gdem' // Creator type for Graffiti Demo
+#define sysFileCMailDemo 'mdem' // Creator type for Mail Demo
+
+#define sysFileCFirstApp sysFileCPreferences // Creator type for First App after reset
+#define sysFileCAltFirstApp sysFileCSetup // Creator type for First alternate App after reset (with hard key pressed)
+#define sysFileCDefaultApp sysFileCPreferences // Creator type for Default app
+#define sysFileCDefaultButton1App sysFileCDatebook // Creator type for dflt hard button 1 app
+#define sysFileCDefaultButton2App sysFileCAddress // Creator type for dflt hard button 2 app
+#define sysFileCDefaultButton3App sysFileCToDo // Creator type for dflt hard button 3 app
+#define sysFileCDefaultButton4App sysFileCMemo // Creator type for dflt hard button 4 app
+#define sysFileCDefaultCalcButtonApp sysFileCCalculator // Creator type for dflt calc button app
+#define sysFileCDefaultCradleApp sysFileCSync // Creator type for dflt hot sync button app
+#define sysFileCDefaultModemApp sysFileCSync // Creator type for dflt modem button app
+#define sysFileCDefaultAntennaButtonApp sysFileCLauncher // Creator type for dflt antenna up button app
+#define sysFileCNullApp '0000' // Creator type for non-existing app
+#define sysFileCSimulator '\?\?\?\?' // Creator type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+#define sysFileCDigitizer 'digi' // Creator type for Digitizer Panel
+#define sysFileCGeneral 'gnrl' // Creator type for General Panel
+#define sysFileCFormats 'frmt' // Creator type for Formats Panel
+#define sysFileCShortCuts 'shct' // Creator type for ShortCuts Panel
+#define sysFileCButtons 'bttn' // Creator type for Buttons Panel
+#define sysFileCOwner 'ownr' // Creator type for Owner Panel
+#define sysFileCModemPanel 'modm' // Creator type for Modem Panel
+#define sysFileCDialPanel 'dial' // Creator type for Dial Panel
+#define sysFileCNetworkPanel 'netw' // Creator type for Network Panel
+#define sysFileCWirelessPanel 'wrls' // Creator type for the wireless Panel.
+#define sysFileCUserDict 'udic' // Creator type for the UserDict panel.
+#define sysFileCPADHtal 'hpad' // Creator type for PAD HTAL lirary
+#define sysFileCTCPHtal 'htcp' // Creator type for TCP HTAL lirary
+#define sysFileCMineHunt 'mine' // Creator type for MineHunt App
+#define sysFileCPuzzle15 'puzl' // Creator type for Puzzle "15" App
+#define sysFileCOpenLibInfo 'olbi' // Creator type for Feature Manager features
+ // used for saving open library info under PalmOS v1.x
+#define sysFileCHwrFlashMgr 'flsh' // Creator type for HwrFlashMgr features
+
+// Libraries. If the resource used by these are expected to be treated as part of
+// the system's usage then the Memory app must be changed.
+#define sysFileTLibrary 'libr' // File type of Shared Libraries
+#define sysFileTLibraryExtension 'libx' // File type of library extensions
+
+#define sysFileCNet 'netl' // Creator type for Net (TCP/IP) Library
+#define sysFileCRmpLib 'netp' // Creator type for RMP Library (NetLib plug-in)
+#define sysFileCINetLib 'inet' // Creator type for INet Library
+#define sysFileCSecLib 'secl' // Creator type for Ir Library
+#define sysFileCWebLib 'webl' // Creator type for Web Library
+#define sysFileCIrLib 'irda' // Creator type for Ir Library
+
+#define sysFileCSerialMgr 'smgr' // Creator for SerialMgrNew used for features.
+#define sysFileCSerialWrapper 'swrp' // Creator type for Serial Wrapper Library.
+#define sysFileCIrSerialWrapper 'iwrp' // Creator type for Ir Serial Wrapper Library.
+#define sysFileCTextServices 'tsml' // Creator type for Text Services Library.
+
+#define sysFileTUartPlugIn 'sdrv' // File type for SerialMgrNew physical port plug-in.
+#define sysFileTVirtPlugin 'vdrv' // Flir type for SerialMgrNew virtual port plug-in.
+#define sysFileCUart328 'u328' // Creator type for '328 UART plug-in
+#define sysFileCUart328EZ 'u8EZ' // Creator type for '328EZ UART plug-in
+#define sysFileCUart650 'u650' // Creator type for '650 UART plug-in
+#define sysFileCVirtIrComm 'ircm' // Creator type for IrComm virtual port plug-in.
+
+#define sysFileTSystem 'rsrc' // File type for Main System File
+#define sysFileTSystemPatch 'ptch' // File type for System resource file patches
+#define sysFileTKernel 'krnl' // File type for System Kernel (AMX)
+#define sysFileTBoot 'boot' // File type for SmallROM System File
+#define sysFileTSmallHal 'shal' // File type for SmallROM HAL File
+#define sysFileTBigHal 'bhal' // File type for Main ROM HAL File
+#define sysFileTSplash 'spls' // File type for Main ROM Splash File
+#define sysFileTUIAppShell 'uish' // File type for UI Application Shell
+#define sysFileTOverlay 'ovly' // File type for UI overlay database
+#define sysFileTExtension 'extn' // File type for System Extensions
+#define sysFileTApplication 'appl' // File type for applications
+#define sysFileTPanel 'panl' // File type for preference panels
+#define sysFileTSavedPreferences 'sprf' // File type for saved preferences
+#define sysFileTPreferences 'pref' // File type for preferences
+#define sysFileTMidi 'smfr' // File type for Standard MIDI File record databases
+#define sysFileTpqa 'pqa ' // File type for the PQA files.
+
+#define sysFileTUserDictionary 'dict' // File type for input method user dictionary.
+#define sysFileTLearningData 'lean' // File type for input method learning data.
+
+#define sysFileTGraffitiMacros 'macr' // Graffiti Macros database
+
+#define sysFileTHtalLib 'htal' // HTAL library
+
+#define sysFileTExgLib 'exgl' // Type of Exchange libraries
+
+#define sysFileTFileStream 'strm' // Default File Stream database type
+
+#define sysFileTTemp 'temp' // Temporary database type; in future versions
+ // of PalmOS (although likely not before 3.3), the
+ // system may automatically delete any db's of
+ // this type at reset time (however, apps are still
+ // responsible for deleting the ones they create
+ // before exiting to protect valuable storage space)
+
+#define sysFileTScriptPlugin 'scpt' // File type for plugin to the Network Panel to
+ //extend scripting capabilities.
+
+#define sysFileTSimulator '\?\?\?\?' // File type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+//................................................................
+// Resource types and IDs
+//................................................................
+#define sysResTBootCode 'boot' // Resource type of boot resources
+#define sysResIDBootReset 10000 // Reset code
+#define sysResIDBootInitCode 10001 // Init code
+#define sysResIDBootSysCodeStart 10100 // System code resources start here
+#define sysResIDBootSysCodeMin 10102 // IDs 'Start' to this must exist!!
+#define sysResIDBootUICodeStart 10200 // UI code resources start here
+#define sysResIDBootUICodeMin 10203 // IDs 'Start' to this must exist!!
+
+#define sysResIDBootHAL 19000 // HAL code resource (from HAL.prc)
+
+#define sysResIDBitmapSplash 19000 // ID of (boot) splash screen bitmap
+#define sysResIDBitmapConfirm 19001 // ID of hard reset confirmation bitmap
+
+#define sysResTAppPrefs 'pref' // Resource type of App preferences resources
+#define sysResIDAppPrefs 0 // Application preference
+
+#define sysResTExtPrefs 'xprf' // Resource type of extended preferences
+#define sysResIDExtPrefs 0 // Extended preferences
+
+#define sysResTAppCode 'code' // Resource type of App code resources
+#define sysResTAppGData 'data' // Resource type of App global data resources
+
+#define sysResTExtensionCode 'extn' // Resource type of Extensions code
+#define sysResTExtensionOEMCode 'exte' // Resource type of OEM Extensions code
+
+#define sysResTFeatures 'feat' // Resource type of System features table
+#define sysResIDFeatures 10000 // Resource ID of System features table
+#define sysResIDOverlayFeatures 10001 // Resource ID of system overlay feature table.
+
+#define sysResTCountries 'cnty' // Resource type of System countries table
+#define sysResIDCountries 10000 // Resource ID of System countries table
+
+#define sysResTLibrary 'libr' // Resource type of System Libraries
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER - obsolete, should be removed:
+#endif // PUBLIC_STUFF_STRIPPED
+//#define sysResIDLibrarySerMgr328 10000 // Dragonball (68328) UART
+//#define sysResIDLibrarySerMgr681 10001 // 68681 UART
+//#define sysResIDLibraryRMPPlugIn 10002 // Reliable Message Protocol NetLib Plug-in
+
+#define sysResTSilkscreen 'silk' // Resource type of silkscreen info.
+
+#define sysResTGrfTemplate 'tmpl' // Graffiti templates "file"
+#define sysResIDGrfTemplate 10000 // Graffiti templates "file" ID
+#define sysResTGrfDictionary 'dict' // Graffiti dictionary "file"
+#define sysResIDGrfDictionary 10000 // Graffiti dictionary "file" ID
+#define sysResIDGrfDefaultMacros 10000 // sysResTDefaultDB resource with Graffiti Macros database
+
+#define sysResTDefaultDB 'dflt' // Default database resource type
+#define sysResIDDefaultDB 1 // resource ID of sysResTDefaultDB in each app
+
+#define sysResTErrStrings 'tSTL' // list of error strings
+#define sysResIDErrStrings 10000 // resource ID is (errno>>8)+sysResIDErrStrings
+
+#define sysResIDOEMDBVersion 20001 // resource ID of "tver" and "tint" versions in OEM stamped databases
+
+// System Preferences
+#define sysResTSysPref sysFileCSystem
+#define sysResIDSysPrefMain 0 // Main preferences
+#define sysResIDSysPrefPassword 1 // Password
+#define sysResIDSysPrefFindStr 2 // Find string
+#define sysResIDSysPrefCalibration 3 // Digitizer calibration.
+#define sysResIDDlkUserInfo 4 // Desktop Link user information.
+#define sysResIDDlkLocalPC 5 // Desktop Link local PC host name
+#define sysResIDDlkCondFilterTab 6 // Desktop Link conduit filter table
+#define sysResIDModemMgrPref 7 // Modem Manager preferences
+#define sysResIDDlkLocalPCAddr 8 // Desktop Link local PC host address
+#define sysResIDDlkLocalPCMask 9 // Desktop Link local PC host subnet mask
+
+// These prefs store parameters to pass to an app when launched with a button
+#define sysResIDButton1Param 10 // Parameter for hard button 1 app
+#define sysResIDButton2Param 11 // Parameter for hard button 2 app
+#define sysResIDButton3Param 12 // Parameter for hard button 3 app
+#define sysResIDButton4Param 13 // Parameter for hard button 4 app
+#define sysResIDCalcButtonParam 14 // Parameter for calc button app
+#define sysResIDCradleParam 15 // Parameter for hot sync button app
+#define sysResIDModemParam 16 // Parameter for modem button app
+#define sysResIDAntennaButtonParam 17 // Parameter for antenna up button app
+
+// New for Color, user's color preferences
+#define sysResIDPrefUIColorTableBase 17 // base + depth = ID of actual pref
+#define sysResIDPrefUIColorTable1 18 // User's UI colors for 1bpp displays
+#define sysResIDPrefUIColorTable2 19 // User's UI colors for 2bpp displays
+#define sysResIDPrefUIColorTable4 21 // User's UI colors for 4bpp displays
+#define sysResIDPrefUIColorTable8 25 // User's UI colors for 8bpp displays
+
+// FlashMgr Resources - old
+#define sysResTFlashMgr 'flsh'
+#define sysResIDFlashMgrWorkspace 1 // RAM workspace during flash activity
+
+// FlashMgr Resources - new
+#define sysResTHwrFlashIdent 'flid' // Flash identification code resource
+#define sysResIDHwrFlashIdent 10000 // Flash identification code resource
+
+#define sysResTHwrFlashCode 'flcd' // Flash programming code resource
+ // (resource ID determined by device type)
+
+// OEM Feature type and id.
+#define sysFtrTOEMSys sysFileCOEMSystem
+#define sysFtrIDOEMSysHideBatteryGauge 1
+
+// Onscreen keyboard features
+#define sysFtrTKeyboard 'keyb'
+#define sysFtrIDKeyboardActive 1 // Boolean value, true => keyboard is active.
+ // Currently only used for Japanese.
+
+// Activation status values.
+#define sysActivateStatusFeatureIndex 1
+#define sysActivateNeedGeorgeQuery 0
+#define sysActivateNeedMortyQuery 1
+#define sysActivateFullyActivated 2
+
+#define sysMaxUserDomainNameLength 64
+
+// Current clipper feature indeces
+#define sysClipperPQACardNoIndex 1
+#define sysClipperPQADbIDIndex 2
+
+//-----------------------------------------------------------
+// This section is only valid when running the resource compiler
+//
+// Actually, this section is obsolete. Instear, .r files should
+// inlude SysResTypes.rh to get these definitions.
+//
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥ leaving this here for now just in case.
+#endif // PUBLIC_STUFF_STRIPPED
+//-----------------------------------------------------------
+
+#ifdef RESOURCE_COMPILER
+
+#include <SysResTypes.rh>
+
+#endif
+
+
+#endif // __SYSTEMRESOURCES_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h b/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h
new file mode 100644
index 0000000..baed10f
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/TextMgr.h
@@ -0,0 +1,411 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TextMgr.h
+ *
+ * Release:
+ *
+ * Description:
+ * Header file for Text Manager.
+ *
+ * History:
+ * 03/05/98 kwk Created by Ken Krugler.
+ * 02/02/99 kwk Added charEncodingPalmLatin & charEncodingPalmSJIS,
+ * since we've extended the CP1252 & CP932 encodings.
+ * Added TxtUpperStr, TxtLowerStr, TxtUpperChar, and
+ * TxtLowerChar macros.
+ * 03/11/99 kwk Changed TxtTruncate to TxtGetTruncationOffset.
+ * 04/24/99 kwk Moved string & character upper/lower casing macros
+ * to IntlGlue library.
+ * 04/28/99 kwk Changed kMaxCharSize to maxCharBytes, as per Roger's request.
+ * 05/15/99 kwk Changed TxtIsValidChar to TxtCharIsValid.
+ * 05/29/99 kwk Removed include of CharAttr.h.
+ * 07/13/99 kwk Moved TxtPrepFindString into TextPrv.h
+ * 09/22/99 kwk Added TxtParamString (OS 3.5).
+ * 10/28/99 kwk Added the TxtCharIsVirtual macro.
+ * 03/01/00 kwk Added the TxtConvertEncoding routine (OS 4.0), and the
+ * txtErrUnknownEncoding and txtErrConvertOverflow errors.
+ * 05/12/00 kwk Deprecated the TxtCharWidth routine.
+ * 05/26/00 kwk Added TxtGetWordWrapOffset (OS 4.0). Convert CharEncodingType
+ * to #define format versus enums. Re-ordered into logical
+ * groups, and fixed up names to match existing convention.
+ * 05/30/00 kwk Added txtErrTranslitUnderflow.
+ * 06/02/00 CS Moved character encoding constants to PalmLocale.h so that
+ * Rez has access to them.
+ * 07/13/00 kwk Added TxtNameToEncoding (OS 4.0).
+ * 07/23/00 kwk Updated TxtConvertEncoding to match new API.
+ * 10/05/00 kwk Added charAttr_<whatever> as substitutes for the old
+ * character attribute flags in CharAttr.h (e.g. _XA, _LO).
+ * kwk Moved sizeOf7BitChar here from CharAttr.h
+ * 11/21/00 kwk Undeprecated TxtCharWidth, in anticipation of future,
+ * proper deprecation.
+ * 11/24/00 kwk Reverted maxCharBytes to 3 (was 4). You only need more than
+ * three bytes for surrogate Unicode characters, which we don't
+ * support, as this would require a 32 bit WChar variable to
+ * hold the result (potentially 21 bits of data). Since we
+ * never use more than 3 bytes, it's OK to shrink this back down.
+ *
+ *****************************************************************************/
+
+#ifndef __TEXTMGR_H__
+#define __TEXTMGR_H__
+
+#include <IntlMgr.h>
+#include <Chars.h>
+
+/***********************************************************************
+ * Public types & constants
+ ***********************************************************************/
+
+// See PalmLocale.h for encoding constants of type CharEncodingType, and
+// character encoding names.
+typedef UInt8 CharEncodingType;
+
+// Transliteration operations for the TxtTransliterate call. We don't use
+// an enum, since each character encoding contains its own set of special
+// transliteration operations (which begin at translitOpCustomBase).
+typedef UInt16 TranslitOpType;
+
+// Standard transliteration operations.
+#define translitOpStandardBase 0 // Beginning of standard operations.
+
+#define translitOpUpperCase 0
+#define translitOpLowerCase 1
+#define translitOpReserved2 2
+#define translitOpReserved3 3
+
+// Custom transliteration operations (defined in CharXXXX.h encoding-specific
+// header files.
+#define translitOpCustomBase 1000 // Beginning of char-encoding specific ops.
+
+#define translitOpPreprocess 0x8000 // Mask for pre-process option, where
+ // no transliteration actually is done.
+
+// Structure used to maintain state across calls to TxtConvertEncoding, for
+// proper handling of source or destination encodings with have modes.
+#define kTxtConvertStateSize 32
+
+typedef struct {
+ UInt8 ioSrcState[kTxtConvertStateSize];
+ UInt8 ioDstState[kTxtConvertStateSize];
+} TxtConvertStateType;
+
+// Flags available in the sysFtrNumCharEncodingFlags feature attribute.
+#define charEncodingOnlySingleByte 0x00000001
+#define charEncodingHasDoubleByte 0x00000002
+#define charEncodingHasLigatures 0x00000004
+#define charEncodingLeftToRight 0x00000008
+
+// Various byte attribute flags. Note that multiple flags can be
+// set, thus a byte could be both a single-byte character, or the first
+// byte of a multi-byte character.
+#define byteAttrFirst 0x80 // First byte of multi-byte char.
+#define byteAttrLast 0x40 // Last byte of multi-byte char.
+#define byteAttrMiddle 0x20 // Middle byte of muli-byte char.
+#define byteAttrSingle 0x01 // Single byte.
+
+// Character attribute flags. These replace the old flags defined in
+// CharAttr.h, but are bit-compatible.
+#define charAttr_XA 0x0200 // extra alphabetic
+#define charAttr_XS 0x0100 // extra space
+#define charAttr_BB 0x0080 // BEL, BS, etc.
+#define charAttr_CN 0x0040 // CR, FF, HT, NL, VT
+#define charAttr_DI 0x0020 // '0'-'9'
+#define charAttr_LO 0x0010 // 'a'-'z' and lowercase extended chars.
+#define charAttr_PU 0x0008 // punctuation
+#define charAttr_SP 0x0004 // space
+#define charAttr_UP 0x0002 // 'A'-'Z' and uppercase extended chars.
+#define charAttr_XD 0x0001 // '0'-'9', 'A'-'F', 'a'-'f'
+
+// Various sets of character attribute flags.
+#define charAttrPrint (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_SP|charAttr_UP|charAttr_XA)
+#define charAttrSpace (charAttr_CN|charAttr_SP|charAttr_XS)
+#define charAttrAlNum (charAttr_DI|charAttr_LO|charAttr_UP|charAttr_XA)
+#define charAttrAlpha (charAttr_LO|charAttr_UP|charAttr_XA)
+#define charAttrCntrl (charAttr_BB|charAttr_CN)
+#define charAttrGraph (charAttr_DI|charAttr_LO|charAttr_PU|charAttr_UP|charAttr_XA)
+#define charAttrDelim (charAttr_SP|charAttr_PU)
+
+// Remember that sizeof(0x0D) == 2 because 0x0D is treated like an int. The
+// same is true of sizeof('a'), sizeof('\0'), and sizeof(chrNull). For this
+// reason it's safest to use the sizeOf7BitChar macro to document buffer size
+// and string length calcs. Note that this can only be used with low-ascii
+// characters, as anything else might be the high byte of a double-byte char.
+#define sizeOf7BitChar(c) 1
+
+// Maximum size a single WChar character will occupy in a text string.
+#define maxCharBytes 3
+
+// Text manager error codes.
+#define txtErrUknownTranslitOp (txtErrorClass | 1)
+#define txtErrTranslitOverrun (txtErrorClass | 2)
+#define txtErrTranslitOverflow (txtErrorClass | 3)
+#define txtErrConvertOverflow (txtErrorClass | 4)
+#define txtErrConvertUnderflow (txtErrorClass | 5)
+#define txtErrUnknownEncoding (txtErrorClass | 6)
+#define txtErrNoCharMapping (txtErrorClass | 7)
+#define txtErrTranslitUnderflow (txtErrorClass | 8)
+
+/***********************************************************************
+ * Public macros
+ ***********************************************************************/
+
+#define TxtCharIsSpace(ch) ((TxtCharAttr(ch) & charAttrSpace) != 0)
+#define TxtCharIsPrint(ch) ((TxtCharAttr(ch) & charAttrPrint) != 0)
+#define TxtCharIsDigit(ch) ((TxtCharAttr(ch) & charAttr_DI) != 0)
+#define TxtCharIsAlNum(ch) ((TxtCharAttr(ch) & charAttrAlNum) != 0)
+#define TxtCharIsAlpha(ch) ((TxtCharAttr(ch) & charAttrAlpha) != 0)
+#define TxtCharIsCntrl(ch) ((TxtCharAttr(ch) & charAttrCntrl) != 0)
+#define TxtCharIsGraph(ch) ((TxtCharAttr(ch) & charAttrGraph) != 0)
+#define TxtCharIsLower(ch) ((TxtCharAttr(ch) & charAttr_LO) != 0)
+#define TxtCharIsPunct(ch) ((TxtCharAttr(ch) & charAttr_PU) != 0)
+#define TxtCharIsUpper(ch) ((TxtCharAttr(ch) & charAttr_UP) != 0)
+#define TxtCharIsHex(ch) ((TxtCharAttr(ch) & charAttr_XD) != 0)
+#define TxtCharIsDelim(ch) ((TxtCharAttr(ch) & charAttrDelim) != 0)
+
+// <c> is a hard key if the event modifier <m> has the command bit set
+// and <c> is either in the proper range or is the calculator character.
+#define TxtCharIsHardKey(m, c) ((((m) & commandKeyMask) != 0) && \
+ ((((c) >= hardKeyMin) && ((c) <= hardKeyMax)) || ((c) == calcChr)))
+
+// <c> is a virtual character if the event modifier <m> has the command
+// bit set. WARNING!!! This macro is only safe to use on Palm OS 3.5 or
+// later. With earlier versions of the OS, use TxtGlueCharIsVirtual()
+// in PalmOSGlue.lib
+#define TxtCharIsVirtual(m, c) (((m) & commandKeyMask) != 0)
+
+#define TxtPreviousCharSize(inText, inOffset) TxtGetPreviousChar((inText), (inOffset), NULL)
+#define TxtNextCharSize(inText, inOffset) TxtGetNextChar((inText), (inOffset), NULL)
+
+
+/***********************************************************************
+ * Public routines
+ ***********************************************************************/
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// Return back byte attribute (first, last, single, middle) for <inByte>.
+
+UInt8 TxtByteAttr(UInt8 inByte)
+ INTL_TRAP(intlTxtByteAttr);
+
+// Return back the standard attribute bits for <inChar>.
+
+UInt16 TxtCharAttr(WChar inChar)
+ INTL_TRAP(intlTxtCharAttr);
+
+// Return back the extended attribute bits for <inChar>.
+
+UInt16 TxtCharXAttr(WChar inChar)
+ INTL_TRAP(intlTxtCharXAttr);
+
+// Return the size (in bytes) of the character <inChar>. This represents
+// how many bytes would be required to store the character in a string.
+
+UInt16 TxtCharSize(WChar inChar)
+ INTL_TRAP(intlTxtCharSize);
+
+// Return the width (in pixels) of the character <inChar>. You should
+// use FntWCharWidth or FntGlueWCharWidth instead of this routine.
+
+Int16 TxtCharWidth(WChar inChar)
+ INTL_TRAP(intlTxtCharWidth);
+
+// Load the character before offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+UInt16 TxtGetPreviousChar(const Char *inText, UInt32 inOffset, WChar *outChar)
+ INTL_TRAP(intlTxtGetPreviousChar);
+
+// Load the character at offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+UInt16 TxtGetNextChar(const Char *inText, UInt32 inOffset, WChar *outChar)
+ INTL_TRAP(intlTxtGetNextChar);
+
+// Return the character at offset <inOffset> in the <inText> text.
+
+WChar TxtGetChar(const Char *inText, UInt32 inOffset)
+ INTL_TRAP(intlTxtGetChar);
+
+// Set the character at offset <inOffset> in the <inText> text, and
+// return back the size of the character.
+
+UInt16 TxtSetNextChar(Char *ioText, UInt32 inOffset, WChar inChar)
+ INTL_TRAP(intlTxtSetNextChar);
+
+// Replace the substring "^X" (where X is 0..9, as specified by <inParamNum>)
+// with the string <inParamStr>. If <inParamStr> is NULL then don't modify <ioStr>.
+// Make sure the resulting string doesn't contain more than <inMaxLen> bytes,
+// excluding the terminating null. Return back the number of occurances of
+// the substring found in <ioStr>.
+
+UInt16 TxtReplaceStr(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, UInt16 inParamNum)
+ INTL_TRAP(intlTxtReplaceStr);
+
+// Allocate a handle containing the result of substituting param0...param3
+// for ^0...^3 in <inTemplate>, and return the locked result. If a parameter
+// is NULL, replace the corresponding substring in the template with "".
+
+Char *TxtParamString(const Char *inTemplate, const Char *param0,
+ const Char *param1, const Char *param2, const Char *param3)
+ INTL_TRAP(intlTxtParamString);
+
+// Return the bounds of the character at <inOffset> in the <inText>
+// text, via the <outStart> & <outEnd> offsets, and also return the
+// actual value of character at or following <inOffset>.
+
+WChar TxtCharBounds(const Char *inText, UInt32 inOffset, UInt32 *outStart, UInt32 *outEnd)
+ INTL_TRAP(intlTxtCharBounds);
+
+// Return the appropriate byte position for truncating <inText> such that it is
+// at most <inOffset> bytes long.
+
+UInt32 TxtGetTruncationOffset(const Char *inText, UInt32 inOffset)
+ INTL_TRAP(intlTxtGetTruncationOffset);
+
+// Search for <inTargetStr> in <inSourceStr>. If found return true and pass back
+// the found position (byte offset) in <outPos>, and the length of the matched
+// text in <outLength>.
+
+Boolean TxtFindString(const Char *inSourceStr, const Char *inTargetStr,
+ UInt32 *outPos, UInt16 *outLength)
+ INTL_TRAP(intlTxtFindString);
+
+// Find the bounds of the word that contains the character at <inOffset>.
+// Return the offsets in <*outStart> and <*outEnd>. Return true if the
+// word we found was not empty & not a delimiter (attribute of first char
+// in word not equal to space or punct).
+
+Boolean TxtWordBounds(const Char *inText, UInt32 inLength, UInt32 inOffset,
+ UInt32 *outStart, UInt32 *outEnd)
+ INTL_TRAP(intlTxtWordBounds);
+
+// Return the offset of the first break position (for text wrapping) that
+// occurs at or before <iOffset> in <iTextP>. Note that this routine will
+// also add trailing spaces and a trailing linefeed to the break position,
+// thus the result could be greater than <iOffset>.
+
+UInt32 TxtGetWordWrapOffset(const Char *iTextP, UInt32 iOffset)
+ INTL_TRAP(intlTxtGetWordWrapOffset);
+
+// Return the minimum (lowest) encoding required for <inChar>. If we
+// don't know about the character, return encoding_Unknown.
+
+CharEncodingType TxtCharEncoding(WChar inChar)
+ INTL_TRAP(intlTxtCharEncoding);
+
+// Return the minimum (lowest) encoding required to represent <inStr>.
+// This is the maximum encoding of any character in the string, where
+// highest is unknown, and lowest is ascii.
+
+CharEncodingType TxtStrEncoding(const Char *inStr)
+ INTL_TRAP(intlTxtStrEncoding);
+
+// Return the higher (max) encoding of <a> and <b>.
+
+CharEncodingType TxtMaxEncoding(CharEncodingType a, CharEncodingType b)
+ INTL_TRAP(intlTxtMaxEncoding);
+
+// Return a pointer to the 'standard' name for <inEncoding>. If the
+// encoding is unknown, return a pointer to an empty string.
+
+const Char *TxtEncodingName(CharEncodingType inEncoding)
+ INTL_TRAP(intlTxtEncodingName);
+
+// Map from a character set name <iEncodingName> to a CharEncodingType.
+// If the character set name is unknown, return charEncodingUnknown.
+
+CharEncodingType TxtNameToEncoding(const Char* iEncodingName)
+ INTL_TRAP(intlTxtNameToEncoding);
+
+// Transliterate <inSrcLength> bytes of text found in <inSrcText>, based
+// on the requested <inOp> operation. Place the results in <outDstText>,
+// and set the resulting length in <ioDstLength>. On entry <ioDstLength>
+// must contain the maximum size of the <outDstText> buffer. If the
+// buffer isn't large enough, return an error (note that outDestText
+// might have been modified during the operation). Note that if <inOp>
+// has the preprocess bit set, then <outDstText> is not modified, and
+// <ioDstLength> will contain the total space required in the destination
+// buffer in order to perform the operation.
+
+Err TxtTransliterate(const Char *inSrcText, UInt16 inSrcLength, Char *outDstText,
+ UInt16 *ioDstLength, TranslitOpType inOp)
+ INTL_TRAP(intlTxtTransliterate);
+
+// Convert <*ioSrcBytes> of text from <srcTextP> between the <srcEncoding>
+// and <dstEncoding> character encodings. If <dstTextP> is not NULL, write
+// the resulting bytes to the buffer, and always return the number of
+// resulting bytes in <*ioDstBytes>. Update <*srcBytes> with the number of
+// bytes from the beginning of <*srcTextP> that were successfully converted.
+// When the routine is called with <srcTextP> pointing to the beginning of
+// a string or text buffer, <newConversion> should be true; if the text is
+// processed in multiple chunks, either because errors occurred or due to
+// source/destination buffer size constraints, then subsequent calls to
+// this routine should pass false for <newConversion>. The TxtConvertStateType
+// record maintains state information so that if the source or destination
+// character encodings have state or modes (e.g. JIS), processing a single
+// sequence of text with multiple calls will work correctly.
+
+// When an error occurs due to an unconvertable character, the behavior of
+// the routine will depend on the <substitutionStr> parameter. If it is NULL,
+// then <*ioSrcBytes> will be set to the offset of the unconvertable character,
+// <ioDstBytes> will be set to the number of successfully converted resulting
+// bytes, and <dstTextP>, in not NULL, will contain conversion results up to
+// the point of the error. The routine will return an appropriate error code,
+// and it is up to the caller to either terminate conversion or skip over the
+// unconvertable character and continue the conversion process (passing false
+// for the <newConversion> parameter in subsequent calls to TxtConvertEncoding).
+// If <substitutionStr> is not NULL, then this string is written to the
+// destination buffer when an unconvertable character is encountered in the
+// source text, and the source character is skipped. Processing continues, though
+// the error code will still be returned when the routine terminates. Note that
+// if a more serious error occurs during processing (e.g. buffer overflow) then
+// that error will be returned even if there was an earlier unconvertable character.
+// Note that the substitution string must use the destination character encoding.
+
+Err TxtConvertEncoding(Boolean newConversion, TxtConvertStateType* ioStateP,
+ const Char* srcTextP, UInt16* ioSrcBytes, CharEncodingType srcEncoding,
+ Char* dstTextP, UInt16* ioDstBytes, CharEncodingType dstEncoding,
+ const Char* substitutionStr, UInt16 substitutionLen)
+ INTL_TRAP(intlTxtConvertEncoding);
+
+// Return true if <inChar> is a valid (drawable) character. Note that we'll
+// return false if it is a virtual character code.
+
+Boolean TxtCharIsValid(WChar inChar)
+ INTL_TRAP(intlTxtCharIsValid);
+
+// Compare the first <s1Len> bytes of <s1> with the first <s2Len> bytes
+// of <s2>. Return the results of the comparison: < 0 if <s1> sorts before
+// <s2>, > 0 if <s1> sorts after <s2>, and 0 if they are equal. Also return
+// the number of bytes that matched in <s1MatchLen> and <s2MatchLen>
+// (either one of which can be NULL if the match length is not needed).
+// This comparison is "caseless", in the same manner as a find operation,
+// thus case, character size, etc. don't matter.
+
+Int16 TxtCaselessCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen,
+ const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen)
+ INTL_TRAP(intlTxtCaselessCompare);
+
+// Compare the first <s1Len> bytes of <s1> with the first <s2Len> bytes
+// of <s2>. Return the results of the comparison: < 0 if <s1> sorts before
+// <s2>, > 0 if <s1> sorts after <s2>, and 0 if they are equal. Also return
+// the number of bytes that matched in <s1MatchLen> and <s2MatchLen>
+// (either one of which can be NULL if the match length is not needed).
+
+Int16 TxtCompare(const Char *s1, UInt16 s1Len, UInt16 *s1MatchLen,
+ const Char *s2, UInt16 s2Len, UInt16 *s2MatchLen)
+ INTL_TRAP(intlTxtCompare);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#endif // __TEXTMGR_H__
diff --git a/SrcShared/Palm/Platform/Incs/Core/System/Window.h b/SrcShared/Palm/Platform/Incs/Core/System/Window.h
new file mode 100644
index 0000000..50aec23
--- /dev/null
+++ b/SrcShared/Palm/Platform/Incs/Core/System/Window.h
@@ -0,0 +1,559 @@
+/******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Window.h
+ *
+ * Description:
+ * This file defines window structures and routines that support color.
+ *
+ * History:
+ * January 20, 1999 Created by Bob Ebert
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 1/20/99 Branch off WindowNew.h
+ * BS 4/20/99 Re-design of the screen driver
+ * bob 5/26/99 Cleanup/reorg
+ * jmp 12/23/99 Fix <> vs. "" problem.
+ *
+ *****************************************************************************/
+
+#ifndef __WINDOW_H__
+#define __WINDOW_H__
+
+#include <PalmTypes.h>
+#include <CoreTraps.h>
+#include <Font.h>
+#include <Rect.h>
+#include <Bitmap.h>
+
+#include <PalmOptErrorCheckLevel.h> // #define ERROR_CHECK_LEVEL
+
+#ifdef _WIN32
+ #pragma warning(disable: 4214) // nonstandard extension used : bit field types other than int
+#endif
+
+// enum for WinScrollRectangle
+typedef enum { winUp = 0, winDown, winLeft, winRight } WinDirectionType;
+
+
+// enum for WinCreateOffscreenWindow
+typedef enum { screenFormat = 0, genericFormat } WindowFormatType;
+
+
+// enum for WinLockScreen
+typedef enum {winLockCopy, winLockErase, winLockDontCare} WinLockInitType;
+
+
+// operations for the WinScreenMode function
+typedef enum {
+ winScreenModeGetDefaults,
+ winScreenModeGet,
+ winScreenModeSetToDefaults,
+ winScreenModeSet,
+ winScreenModeGetSupportedDepths,
+ winScreenModeGetSupportsColor
+} WinScreenModeOperation;
+
+// Operations for the WinPalette function
+#define winPaletteGet 0
+#define winPaletteSet 1
+#define winPaletteSetToDefault 2
+
+// transfer modes for color drawing
+typedef enum {winPaint, winErase, winMask, winInvert, winOverlay, winPaintInverse, winSwap} WinDrawOperation;
+
+
+typedef enum { blackPattern, whitePattern, grayPattern, customPattern } PatternType;
+#define noPattern blackPattern
+#define grayHLinePattern 0xAA
+#define grayHLinePatternOdd 0x55
+
+
+// grayUnderline means dotted current foreground color
+// solidUnderline means solid current foreground color
+// colorUnderline redundant, use solidUnderline instead
+typedef enum { noUnderline, grayUnderline, solidUnderline, colorUnderline } UnderlineModeType;
+
+#define WinMaxSupportedDepth 8
+#define WinNumSupportedColors 4
+
+typedef UInt8 IndexedColorType; // 1-, 2-, 4-, or 8-bit index
+
+typedef UInt8 CustomPatternType [8]; // 8x8 1-bit deep pattern
+
+// for WinPalette startIndex value, respect indexes in passed table
+#define WinUseTableIndexes -1
+
+//-----------------------------------------------
+// Draw state structures.
+//-----------------------------------------------
+
+
+typedef struct DrawStateType {
+ WinDrawOperation transferMode;
+ PatternType pattern;
+ UnderlineModeType underlineMode;
+ FontID fontId;
+ FontPtr font;
+ CustomPatternType patternData;
+ IndexedColorType foreColor;
+ IndexedColorType backColor;
+ IndexedColorType textColor;
+ UInt8 reserved;
+} DrawStateType;
+
+
+#define DrawStateStackSize 5 // enough for a control in a field in a window
+
+
+
+
+//-----------------------------------------------
+// The Window Structures.
+//-----------------------------------------------
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef union FrameBitsType {
+ struct {
+ UInt16 cornerDiam : 8; // corner diameter, max 38
+ UInt16 reserved_3 : 3;
+ UInt16 threeD : 1; // Draw 3D button
+ UInt16 shadowWidth : 2; // Width of shadow
+ UInt16 width : 2; // Width frame
+ } bits;
+ UInt16 word; // IMPORTANT: INITIALIZE word to zero before setting bits!
+} FrameBitsType;
+
+typedef UInt16 FrameType;
+
+// Standard Frame Types
+#define noFrame 0
+#define simpleFrame 1
+#define rectangleFrame 1
+#define simple3DFrame 0x0012 // 3d, frame = 2
+#define roundFrame 0x0401 // corner = 7, frame = 1
+#define boldRoundFrame 0x0702 // corner = 7, frame = 2
+#define popupFrame 0x0205 // corner = 2, frame = 1, shadow = 1
+#define dialogFrame 0x0302 // corner = 3, frame = 2
+#define menuFrame popupFrame
+
+
+#define winDefaultDepthFlag 0xFF
+
+#ifndef PUBLIC_STUFF_STRIPPED
+// DOLATER ¥¥¥Ê-- need to add #defines for each bit for endian portableness
+#endif // PUBLIC_STUFF_STRIPPED
+typedef struct WindowFlagsType {
+ UInt16 format:1; // window format: 0=screen mode; 1=generic mode
+ UInt16 offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen
+ UInt16 modal:1; // modal flag: 0=modeless window; 1=modal window
+ UInt16 focusable:1; // focusable flag: 0=non-focusable; 1=focusable
+ UInt16 enabled:1; // enabled flag: 0=disabled; 1=enabled
+ UInt16 visible:1; // visible flag: 0-invisible; 1=visible
+ UInt16 dialog:1; // dialog flag: 0=non-dialog; 1=dialog
+ UInt16 freeBitmap:1; // free bitmap w/window: 0=don't free, 1=free
+ UInt16 reserved :8;
+} WindowFlagsType;
+
+typedef struct WindowType {
+ Coord displayWidthV20; // use WinGetDisplayExtent instead
+ Coord displayHeightV20; // use WinGetDisplayExtent instead
+ void * displayAddrV20; // use the drawing functions instead
+ WindowFlagsType windowFlags;
+ RectangleType windowBounds;
+ AbsRectType clippingBounds;
+ BitmapPtr bitmapP;
+ FrameBitsType frameType;
+ DrawStateType * drawStateP; // was GraphicStatePtr
+ struct WindowType * nextWindow;
+} WindowType;
+
+typedef WindowType *WinPtr;
+typedef WindowType *WinHandle;
+
+
+//-----------------------------------------------
+// More graphics shapes
+//-----------------------------------------------
+typedef struct WinLineType {
+ Coord x1;
+ Coord y1;
+ Coord x2;
+ Coord y2;
+} WinLineType;
+
+// Rectangles, Points defined in Rect.h
+
+
+
+//-----------------------------------------------
+// Low Memory Globals
+//-----------------------------------------------
+
+// This is the structure of a low memory global reserved for the Window Manager
+// In GRAPHIC_VERSION_2, it held a single drawing state. In this version, it
+// holds stack information for structures that are allocated from the dynamic heap
+typedef struct GraphicStateType {
+ DrawStateType * drawStateP;
+ DrawStateType * drawStateStackP;
+ Int16 drawStateIndex;
+ UInt16 screenLockCount;
+} GraphicStateType;
+
+// ----------------------
+// Window manager errors
+// ----------------------
+#define winErrPalette (winErrorClass | 1)
+
+
+
+//-----------------------------------------------
+// Macros
+//-----------------------------------------------
+
+// For now, the window handle is a pointer to a window structure,
+// this however may change, so use the following macros.
+
+#define WinGetWindowPointer(winHandle) ((WindowType *) winHandle)
+
+#define WinGetWindowHandle(winPtr) ((WinHandle) winPtr)
+
+#if ERROR_CHECK_LEVEL == ERROR_CHECK_FULL
+#define ECWinValidateHandle(winHandle) WinValidateHandle(winHandle)
+#else
+#define ECWinValidateHandle(winHandle)
+#endif
+
+
+
+
+#ifdef REMOVE_FOR_EMULATOR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------
+// Routines relating to windows management
+//-----------------------------------------------
+
+extern Boolean WinValidateHandle (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinValidateHandle);
+
+extern WinHandle WinCreateWindow (const RectangleType *bounds, FrameType frame,
+ Boolean modal, Boolean focusable, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateWindow);
+
+extern WinHandle WinCreateOffscreenWindow (Coord width, Coord height,
+ WindowFormatType format, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateOffscreenWindow);
+
+extern WinHandle WinCreateBitmapWindow (BitmapType *bitmapP, UInt16 *error)
+ SYS_TRAP(sysTrapWinCreateBitmapWindow);
+
+extern void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt)
+ SYS_TRAP(sysTrapWinDeleteWindow);
+
+extern void WinInitializeWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinInitializeWindow);
+
+extern void WinAddWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinAddWindow);
+
+extern void WinRemoveWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinRemoveWindow);
+
+extern void WinMoveWindowAddr (WindowType *oldLocationP, WindowType *newLocationP)
+ SYS_TRAP(sysTrapWinMoveWindowAddr);
+
+extern void WinSetActiveWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinSetActiveWindow);
+
+extern WinHandle WinSetDrawWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinSetDrawWindow);
+
+extern WinHandle WinGetDrawWindow (void)
+ SYS_TRAP(sysTrapWinGetDrawWindow);
+
+extern WinHandle WinGetActiveWindow (void)
+ SYS_TRAP(sysTrapWinGetActiveWindow);
+
+extern WinHandle WinGetDisplayWindow (void)
+ SYS_TRAP(sysTrapWinGetDisplayWindow);
+
+extern WinHandle WinGetFirstWindow (void)
+ SYS_TRAP(sysTrapWinGetFirstWindow);
+
+extern void WinEnableWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinEnableWindow);
+
+extern void WinDisableWindow (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinDisableWindow);
+
+extern void WinGetWindowFrameRect (WinHandle winHandle, RectangleType *r)
+ SYS_TRAP(sysTrapWinGetWindowFrameRect);
+
+extern void WinDrawWindowFrame (void)
+ SYS_TRAP(sysTrapWinDrawWindowFrame);
+
+extern void WinEraseWindow (void)
+ SYS_TRAP(sysTrapWinEraseWindow);
+
+extern WinHandle WinSaveBits (const RectangleType *source, UInt16 *error)
+ SYS_TRAP(sysTrapWinSaveBits);
+
+extern void WinRestoreBits (WinHandle winHandle, Coord destX, Coord destY)
+ SYS_TRAP(sysTrapWinRestoreBits);
+
+extern void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin,
+ const RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode)
+ SYS_TRAP(sysTrapWinCopyRectangle);
+
+extern void WinScrollRectangle (const RectangleType *rP, WinDirectionType direction,
+ Coord distance, RectangleType *vacatedP)
+ SYS_TRAP(sysTrapWinScrollRectangle);
+
+extern void WinGetDisplayExtent (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinGetDisplayExtent);
+
+extern void WinGetWindowBounds (RectangleType *rP)
+ SYS_TRAP(sysTrapWinGetWindowBounds);
+
+extern void WinSetWindowBounds (WinHandle winHandle, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinSetWindowBounds);
+
+extern void WinGetWindowExtent (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinGetWindowExtent);
+
+extern void WinDisplayToWindowPt (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinDisplayToWindowPt);
+
+extern void WinWindowToDisplayPt (Coord *extentX, Coord *extentY)
+ SYS_TRAP(sysTrapWinWindowToDisplayPt);
+
+extern BitmapType *WinGetBitmap (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinGetBitmap);
+
+extern void WinGetClip (RectangleType *rP)
+ SYS_TRAP(sysTrapWinGetClip);
+
+extern void WinSetClip (const RectangleType *rP)
+ SYS_TRAP(sysTrapWinSetClip);
+
+extern void WinResetClip (void)
+ SYS_TRAP(sysTrapWinResetClip);
+
+extern void WinClipRectangle (RectangleType *rP)
+ SYS_TRAP(sysTrapWinClipRectangle);
+
+extern Boolean WinModal (WinHandle winHandle)
+ SYS_TRAP(sysTrapWinModal);
+
+//-----------------------------------------------
+// Routines to draw shapes or frames shapes
+//-----------------------------------------------
+
+// Pixel(s)
+extern IndexedColorType WinGetPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinGetPixel);
+
+extern void WinPaintPixel (Coord x, Coord y) // uses drawing mode
+ SYS_TRAP(sysTrapWinPaintPixel);
+
+extern void WinDrawPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawPixel);
+
+extern void WinErasePixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinErasePixel);
+
+extern void WinInvertPixel (Coord x, Coord y)
+ SYS_TRAP(sysTrapWinInvertPixel);
+
+extern void WinPaintPixels (UInt16 numPoints, PointType pts[])
+ SYS_TRAP(sysTrapWinPaintPixels);
+
+// Line(s)
+extern void WinPaintLines (UInt16 numLines, WinLineType lines[])
+ SYS_TRAP(sysTrapWinPaintLines);
+
+extern void WinPaintLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinPaintLine);
+
+extern void WinDrawLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinDrawLine);
+
+extern void WinDrawGrayLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinDrawGrayLine);
+
+extern void WinEraseLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinEraseLine);
+
+extern void WinInvertLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinInvertLine);
+
+extern void WinFillLine (Coord x1, Coord y1, Coord x2, Coord y2)
+ SYS_TRAP(sysTrapWinFillLine);
+
+
+// Rectangle
+extern void WinPaintRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinPaintRectangle);
+
+extern void WinDrawRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinDrawRectangle);
+
+extern void WinEraseRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinEraseRectangle);
+
+extern void WinInvertRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinInvertRectangle);
+
+extern void WinFillRectangle (const RectangleType *rP, UInt16 cornerDiam)
+ SYS_TRAP(sysTrapWinFillRectangle);
+
+// Rectangle frames
+extern void WinPaintRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinPaintRectangleFrame);
+
+extern void WinDrawRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinDrawRectangleFrame);
+
+extern void WinDrawGrayRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinDrawGrayRectangleFrame);
+
+extern void WinEraseRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinEraseRectangleFrame);
+
+extern void WinInvertRectangleFrame (FrameType frame, const RectangleType *rP)
+ SYS_TRAP(sysTrapWinInvertRectangleFrame);
+
+extern void WinGetFramesRectangle (FrameType frame, const RectangleType *rP,
+ RectangleType *obscuredRect)
+ SYS_TRAP(sysTrapWinGetFramesRectangle);
+
+
+// Bitmap
+extern void WinDrawBitmap (BitmapPtr bitmapP, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawBitmap);
+
+extern void WinPaintBitmap (BitmapType *bitmapP, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintBitmap);
+
+
+// Characters
+extern void WinDrawChar (WChar theChar, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawChar);
+
+extern void WinDrawChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawChars);
+
+extern void WinPaintChar (WChar theChar, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintChar);
+
+extern void WinPaintChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinPaintChars);
+
+extern void WinDrawInvertedChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinDrawInvertedChars);
+
+extern void WinDrawTruncChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth)
+ SYS_TRAP(sysTrapWinDrawTruncChars);
+
+extern void WinEraseChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinEraseChars);
+
+extern void WinInvertChars (const Char *chars, Int16 len, Coord x, Coord y)
+ SYS_TRAP(sysTrapWinInvertChars);
+
+extern UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode)
+ SYS_TRAP(sysTrapWinSetUnderlineMode);
+
+
+
+//-----------------------------------------------
+// Routines for patterns and colors
+//-----------------------------------------------
+
+extern void WinPushDrawState (void) // "save" fore, back, text color, pattern, underline mode, font
+ SYS_TRAP(sysTrapWinPushDrawState);
+
+extern void WinPopDrawState (void) // "restore" saved drawing variables
+ SYS_TRAP(sysTrapWinPopDrawState);
+
+
+extern WinDrawOperation WinSetDrawMode (WinDrawOperation newMode)
+ SYS_TRAP(sysTrapWinSetDrawMode);
+
+
+extern IndexedColorType WinSetForeColor (IndexedColorType foreColor)
+ SYS_TRAP(sysTrapWinSetForeColor);
+
+extern IndexedColorType WinSetBackColor (IndexedColorType backColor)
+ SYS_TRAP(sysTrapWinSetBackColor);
+
+extern IndexedColorType WinSetTextColor (IndexedColorType textColor)
+ SYS_TRAP(sysTrapWinSetTextColor);
+
+// "obsolete" color call, supported for backwards compatibility
+extern void WinSetColors(const RGBColorType *newForeColorP, RGBColorType *oldForeColorP,
+ const RGBColorType *newBackColorP, RGBColorType *oldBackColorP)
+ SYS_TRAP(sysTrapWinSetColors);
+
+extern void WinGetPattern (CustomPatternType *patternP)
+ SYS_TRAP(sysTrapWinGetPattern);
+
+extern PatternType WinGetPatternType (void)
+ SYS_TRAP(sysTrapWinGetPatternType);
+
+extern void WinSetPattern (const CustomPatternType *patternP)
+ SYS_TRAP(sysTrapWinSetPattern);
+
+extern void WinSetPatternType (PatternType newPattern)
+ SYS_TRAP(sysTrapWinSetPatternType);
+
+extern Err WinPalette(UInt8 operation, Int16 startIndex,
+ UInt16 paletteEntries, RGBColorType *tableP)
+ SYS_TRAP(sysTrapWinPalette);
+
+extern IndexedColorType WinRGBToIndex(const RGBColorType *rgbP)
+ SYS_TRAP(sysTrapWinRGBToIndex);
+
+extern void WinIndexToRGB(IndexedColorType i, RGBColorType *rgbP)
+ SYS_TRAP(sysTrapWinIndexToRGB);
+
+
+
+//-----------------------------------------------
+// New WinScreen functions
+//-----------------------------------------------
+
+extern void WinScreenInit(void)
+ SYS_TRAP(sysTrapWinScreenInit);
+
+extern Err WinScreenMode(WinScreenModeOperation operation,
+ UInt32 *widthP,
+ UInt32 *heightP,
+ UInt32 *depthP,
+ Boolean *enableColorP)
+ SYS_TRAP(sysTrapWinScreenMode);
+
+
+//-----------------------------------------------
+// Screen tracking (double buffering) support
+//-----------------------------------------------
+extern UInt8 *WinScreenLock(WinLockInitType initMode)
+ SYS_TRAP(sysTrapWinScreenLock);
+
+extern void WinScreenUnlock(void)
+ SYS_TRAP(sysTrapWinScreenUnlock);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
+#endif //__WINDOW_H__