summaryrefslogtreecommitdiff
path: root/packages/palmunits/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/palmunits/src')
-rw-r--r--packages/palmunits/src/aboutbox.pp34
-rw-r--r--packages/palmunits/src/alarmmgr.pp255
-rw-r--r--packages/palmunits/src/applaunchcmd.pp299
-rw-r--r--packages/palmunits/src/attentionmgr.pp209
-rw-r--r--packages/palmunits/src/bitmap.pp185
-rw-r--r--packages/palmunits/src/category.pp90
-rw-r--r--packages/palmunits/src/chars.pp448
-rw-r--r--packages/palmunits/src/clipboard.pp64
-rw-r--r--packages/palmunits/src/connectionmgr.pp571
-rw-r--r--packages/palmunits/src/consolemgr.pp38
-rw-r--r--packages/palmunits/src/control.pp186
-rw-r--r--packages/palmunits/src/coretraps.pp1459
-rw-r--r--packages/palmunits/src/crc.pp50
-rw-r--r--packages/palmunits/src/datamgr.pp424
-rw-r--r--packages/palmunits/src/datetime.pp305
-rw-r--r--packages/palmunits/src/day.pp53
-rw-r--r--packages/palmunits/src/dlserver.pp403
-rw-r--r--packages/palmunits/src/encrypt.pp50
-rw-r--r--packages/palmunits/src/errorbase.pp270
-rw-r--r--packages/palmunits/src/event_.pp368
-rw-r--r--packages/palmunits/src/exglib.pp121
-rw-r--r--packages/palmunits/src/exgmgr.pp162
-rw-r--r--packages/palmunits/src/expansionmgr.pp237
-rw-r--r--packages/palmunits/src/fatalalert.pp38
-rw-r--r--packages/palmunits/src/featuremgr.pp66
-rw-r--r--packages/palmunits/src/field.pp239
-rw-r--r--packages/palmunits/src/filestream.pp348
-rw-r--r--packages/palmunits/src/find_.pp115
-rw-r--r--packages/palmunits/src/floatmgr.pp940
-rw-r--r--packages/palmunits/src/font.pp138
-rw-r--r--packages/palmunits/src/fontselect_.pp30
-rw-r--r--packages/palmunits/src/form.pp455
-rw-r--r--packages/palmunits/src/fslib.pp224
-rw-r--r--packages/palmunits/src/graffiti.pp183
-rw-r--r--packages/palmunits/src/graffitireference.pp43
-rw-r--r--packages/palmunits/src/graffitishift.pp56
-rw-r--r--packages/palmunits/src/hal.pp54
-rw-r--r--packages/palmunits/src/helper.pp171
-rw-r--r--packages/palmunits/src/helperserviceclass.pp127
-rw-r--r--packages/palmunits/src/hwrmiscflags.pp229
-rw-r--r--packages/palmunits/src/imcutils.pp73
-rw-r--r--packages/palmunits/src/inetmgr.pp964
-rw-r--r--packages/palmunits/src/inspoint.pp49
-rw-r--r--packages/palmunits/src/intlmgr.pp133
-rw-r--r--packages/palmunits/src/irlib.pp1538
-rw-r--r--packages/palmunits/src/keyboard.pp90
-rw-r--r--packages/palmunits/src/keymgr.pp67
-rw-r--r--packages/palmunits/src/launcher.pp38
-rw-r--r--packages/palmunits/src/libtraps.pp45
-rw-r--r--packages/palmunits/src/list.pp117
-rw-r--r--packages/palmunits/src/localemgr.pp237
-rw-r--r--packages/palmunits/src/localize.pp40
-rw-r--r--packages/palmunits/src/lz77mgr.pp171
-rw-r--r--packages/palmunits/src/m68khwr.pp115
-rw-r--r--packages/palmunits/src/memorymgr.pp259
-rw-r--r--packages/palmunits/src/menu_.pp191
-rw-r--r--packages/palmunits/src/modemmgr.pp144
-rw-r--r--packages/palmunits/src/netbitutils.pp158
-rw-r--r--packages/palmunits/src/netmgr.pp1657
-rw-r--r--packages/palmunits/src/notifymgr.pp397
-rw-r--r--packages/palmunits/src/overlaymgr.pp270
-rw-r--r--packages/palmunits/src/palmcompatibility.pp255
-rw-r--r--packages/palmunits/src/palmlocale.pp618
-rw-r--r--packages/palmunits/src/palmos.pp62
-rw-r--r--packages/palmunits/src/password.pp40
-rw-r--r--packages/palmunits/src/pdiconst.pp289
-rw-r--r--packages/palmunits/src/pdilib.pp264
-rw-r--r--packages/palmunits/src/penmgr.pp76
-rw-r--r--packages/palmunits/src/phonelookup.pp33
-rw-r--r--packages/palmunits/src/preferences.pp391
-rw-r--r--packages/palmunits/src/privaterecords.pp45
-rw-r--r--packages/palmunits/src/progress.pp251
-rw-r--r--packages/palmunits/src/rect.pp63
-rw-r--r--packages/palmunits/src/scrollbar.pp76
-rw-r--r--packages/palmunits/src/selday.pp37
-rw-r--r--packages/palmunits/src/seltime.pp50
-rw-r--r--packages/palmunits/src/seltimezone.pp40
-rw-r--r--packages/palmunits/src/seriallinkmgr.pp249
-rw-r--r--packages/palmunits/src/serialmgr.pp558
-rw-r--r--packages/palmunits/src/serialmgrold.pp306
-rw-r--r--packages/palmunits/src/slotdrvrlib.pp185
-rw-r--r--packages/palmunits/src/smslib.pp316
-rw-r--r--packages/palmunits/src/soundmgr.pp306
-rw-r--r--packages/palmunits/src/stringmgr.pp78
-rw-r--r--packages/palmunits/src/sysevent.pp153
-rw-r--r--packages/palmunits/src/sysevtmgr.pp218
-rw-r--r--packages/palmunits/src/systemmgr.pp1197
-rw-r--r--packages/palmunits/src/systemresources.pp411
-rw-r--r--packages/palmunits/src/sysutil.pp92
-rw-r--r--packages/palmunits/src/table.pp279
-rw-r--r--packages/palmunits/src/telephonymgr.pp1199
-rw-r--r--packages/palmunits/src/telephonymgrtypes.pp591
-rw-r--r--packages/palmunits/src/telephonymgrui.pp58
-rw-r--r--packages/palmunits/src/textmgr.pp721
-rw-r--r--packages/palmunits/src/textservicesmgr.pp118
-rw-r--r--packages/palmunits/src/timemgr.pp58
-rw-r--r--packages/palmunits/src/udamgr.pp197
-rw-r--r--packages/palmunits/src/uicolor.pp88
-rw-r--r--packages/palmunits/src/uicontrols.pp47
-rw-r--r--packages/palmunits/src/uiresources.pp310
-rw-r--r--packages/palmunits/src/vfsmgr.pp814
-rw-r--r--packages/palmunits/src/window.pp524
102 files changed, 28153 insertions, 0 deletions
diff --git a/packages/palmunits/src/aboutbox.pp b/packages/palmunits/src/aboutbox.pp
new file mode 100644
index 0000000000..a7e51267b8
--- /dev/null
+++ b/packages/palmunits/src/aboutbox.pp
@@ -0,0 +1,34 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: AboutBox.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines About Box routines
+ *
+ * History:
+ * October 25th, 1995 Created by Christopher Raff
+ *
+ *****************************************************************************)
+
+unit aboutbox;
+
+interface
+
+uses palmos,coretraps;
+
+// WARNING!!! This routine is for the private use of Palm applications.
+// It is released with the public headers so that the sample apps
+// released with the SDK can be compiled by developers.
+
+procedure AbtShowAbout(creator: UInt32); syscall sysTrapAbtShowAbout;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/alarmmgr.pp b/packages/palmunits/src/alarmmgr.pp
new file mode 100644
index 0000000000..f02e23fa88
--- /dev/null
+++ b/packages/palmunits/src/alarmmgr.pp
@@ -0,0 +1,255 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: AlarmMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Alarm Manager
+ *
+ * History:
+ * 4/11/95 VMK - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************)
+
+unit alarmmgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * Alarm Manager result codes
+ * (almErrorClass is defined in ErrorBase)
+ *************************************************************)
+
+const
+ almErrMemory = almErrorClass or 1; // ran out of memory
+ almErrFull = almErrorClass or 2; // alarm table is full
+
+(********************************************************************
+ * Alarm Manager Structures
+ ********************************************************************)
+
+// Structure passed with the sysAppLaunchCmdAlarmTriggered action code:
+//
+// This is a notification that an alarm set by the creator has
+// gone off. The action code handler should not do anything time-
+// consuming here. The intended use is to set the next alarm and/or
+// to perform some quick maintenance task. Particularly, this action code
+// handler is not allowed to display any UI(dialogs, etc.) -- this would delay
+// notification for alarms set by others. This action code may be ignored.
+
+type
+ SysAlarmTriggeredParamType = record
+ ref: UInt32; // --> alarm reference value passed by caller;
+ alarmSeconds: UInt32; // --> alarm date/time in seconds since 1/1/1904;
+
+ purgeAlarm: Boolean; // <-- if set to true on return, this alarm
+ // will be removed from the alarm table and the
+ // display notification will NOT be generated for it
+ padding: UInt8;
+ end;
+
+// Structure passed with the sysAppLaunchCmdDisplayAlarm action code:
+//
+// This is a notification to display an alarm. This action code
+// will be called sometime after the app receives a sysAppLaunchCmdAlarmTriggered
+// notification(perhaps after a significant delay). It is possible that this
+// notification will not be sent at all in the event the alarm table becomes full and
+// the alarm table entry is used to hold a new alarm (this does NOT apply to the
+// sysAppLaunchCmdAlarmTriggered notification). This action code may be ignored.
+
+ SysDisplayAlarmParamType = record
+ ref: UInt32; // alarm reference value passed by caller;
+ alarmSeconds: UInt32; // alarm date/time in seconds since 1/1/1904;
+ soundAlarm: Boolean; // non-zero if alarm needs to be sounded;
+ padding: UInt8;
+ end;
+
+(************************************************************
+ * <chg 4-1-98 RM>
+ *
+ * New PalmOS 3.2 support for procedure alarms. These alarms
+ * are designed to call a procedure pointer rather than send
+ * an action code to an application.
+ *
+ * They are set using the AlmSetProcAlarm() macro. The caller
+ * passes a pointer to a procedure of type AlmAlarmProc and
+ * this procedure will be called when the alarm goes off.
+ *
+ * When the alarm fires, the alarm proc will be called with
+ * an almProcCmd of almProcCmdTriggered and paramP containing
+ * to the alarm parameters.
+ *
+ * When a system time or date change occurs, the alarm proc will
+ * be called with a almProcCmdReschedule cmd. The alarm proc should
+ * reschedule itself at this time using AlmSetProcAlarm().
+ *
+ * The almProcCmd's at almProcCmdCustom are available for custom
+ * use by the alarm proc as it sees fit.
+ *
+ *************************************************************)
+
+type
+ AlmProcCmdEnum = WordEnum;
+
+const
+ almProcCmdTriggered = 0; // Alarm triggered
+ almProcCmdReschedule = Succ(almProcCmdTriggered); // Reschedule (usually as a result of time change)
+
+ // Alarm manager reserves all enums up to almProcCmdCustom
+ almProcCmdCustom = $8000;
+
+type
+ AlmAlarmProc = procedure({AlmProcCmdEnum} almProcCmd: UInt16; var paramP: SysAlarmTriggeredParamType);
+
+const
+ almProcAlarmCardNo = $8000; // passed in cardNo to AlmSetAlarm
+ // and AlmGetAlarm
+
+(********************************************************************
+ * Alarm Manager Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+//
+// ISSUES:
+// 1. Is the Alarms Database always on Card 0 ?
+//
+// A: We will store alarm info on the dynamic heap. Upon reset and
+// time change, apps will be notified via action code and will re-
+// submit their alarms.
+//
+// 2. Should a semaphore be used by the Alarm Manager ?
+//
+// A: No. Present implementation does not require it. May add one
+// in the future to ensure data integrity between tasks.
+//
+// 3. Pilot will need to go back to sleep even if the alarms dialog box is
+// not closed after some interval.
+//
+// A: This will happen in GetNextEvent.
+//
+// 4. We will need to sound the alarm for all newly triggered alarms
+// even while another alarm dialog box is on-screen.
+//
+// A: Yes. We will keep a flag in our globals to indicate when the
+// alarm manager is displaying an alarm. This way we do not hog
+// stack and dynamic heap memory with additional alarm boxes.
+//
+// 5. Should the alarm dialog box be system-modal ?
+//
+// A: Yes -- by swallowing the "QUIT" (and/or others) message in the alarm dialog's
+// event loop.
+//
+
+
+// AlmInit()
+//
+// Initializes the Alarm Manager.
+//
+// Create the Alarm Globals.
+//
+
+function AlmInit: Err; syscall sysTrapAlmInit;
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// AlmSetAlarm()
+//
+// Sets an alarm for the given application. If an alarm for that
+// application had been previously set, it will be replaced. Passing
+// a zero for alarmSeconds cancels the current alarm for the application.
+//
+
+function AlmSetAlarm(cardNo: UInt16; dbID: LocalID; ref, alarmSeconds: UInt32; quiet: Boolean): Err; syscall sysTrapAlmSetAlarm;
+
+// AlmGetAlarm()
+//
+// Gets the alarm seconds for a given app.
+// Zero is returned if there is no alarm setting for the app.
+
+function AlmGetAlarm(cardNo: UInt16; dbID: LocalID; var refP: UInt32): UInt32; syscall sysTrapAlmGetAlarm;
+
+// AlmEnableNotification
+//
+// Enables/disables Alarm Manager's notification mechanism. For example,
+// the HotSync application disables Alarm notifications during the sync
+// to ensure that apps do not try to access their data database until
+// the DesktopLink server had a chance to notify the apps whose databases
+// were modified during the session. This also prevents the alarm dialogs from
+// blocking the HotSync UI. A call to disable MUST always
+// precede the call to enable.
+//
+
+procedure AlmEnableNotification(enable: Boolean); syscall sysTrapAlmEnableNotification;
+
+// AlmDisplayAlarm()
+//
+// Displays any alarms that have gone off.
+//
+// This function is called by the Event Manager executing on some app's
+// thread. This permits us to access resources and execute system calls
+// which would not be possible at interrupt time.
+// 12/8/98 jb Added return code.
+
+function AlmDisplayAlarm(okToDisplay: Boolean): Boolean; syscall sysTrapAlmDisplayAlarm;
+
+// AlmCancelAll()
+//
+// Cancels all alarms managed by the Alarm Manager. This
+// function is presently called by the Time Manager to cancel all alarms
+// when the user changes date/time.
+//
+
+procedure AlmCancelAll; syscall sysTrapAlmCancelAll;
+
+// AlmAlarmCallback()
+//
+// This function is called at interrupt time by the Time Manager when
+// an alarm goes off.
+//
+
+procedure AlmAlarmCallback; syscall sysTrapAlmAlarmCallback;
+
+// AlmTimeChange()
+//
+// This function gets called by TimSetSeconds() and gives the alarm manager
+// a chance to notify all procedure alarms of the time change.
+//
+
+procedure AlmTimeChange; syscall sysTrapAlmTimeChange;
+
+procedure AlmSetProcAlarm(procP: AlmAlarmProc; ref, alarmSeconds: UInt32);
+
+function AlmGetProcAlarm(procP: AlmAlarmProc; var refP: UInt32): UInt32;
+
+implementation
+
+// macros
+
+procedure AlmSetProcAlarm(procP: AlmAlarmProc; ref, alarmSeconds: UInt32);
+begin
+ AlmSetAlarm(almProcAlarmCardNo, LocalID(procP), ref, alarmSeconds, True);
+end;
+
+function AlmGetProcAlarm(procP: AlmAlarmProc; var refP: UInt32): UInt32;
+begin
+ AlmGetProcAlarm := AlmGetAlarm(almProcAlarmCardNo, LocalID(procP), refP);
+end;
+
+end.
diff --git a/packages/palmunits/src/applaunchcmd.pp b/packages/palmunits/src/applaunchcmd.pp
new file mode 100644
index 0000000000..c812f2bb7a
--- /dev/null
+++ b/packages/palmunits/src/applaunchcmd.pp
@@ -0,0 +1,299 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: AppLaunchCmd.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Pilot launch commands for applications. Some launch commands
+ * are treated differently by different apps. The different
+ * parameter blocks used by the apps are kept here.
+ *
+ * History:
+ * 7/23/96 rsf - Created by Roger Flores
+ * 7/28/98 dia - Added generic LaunchWithCommand. Made
+ * AppLaunchWithCommand() use it.
+ *
+ *****************************************************************************)
+
+unit applaunchcmd;
+
+interface
+
+uses palmos, systemmgr;
+
+(*
+#define LaunchWithCommand(type, creator, command, commandParams) \
+{ \
+ UInt16 cardNo; \
+ LocalID dbID; \
+ DmSearchStateType searchState; \
+ Err err; \
+ DmGetNextDatabaseByTypeCreator(true, &searchState, type, \
+ creator, true, &cardNo, &dbID); \
+ ErrNonFatalDisplayIf(!dbID, "Could not find app"); \
+ if (dbID) { \
+ err = SysUIAppSwitch(cardNo, dbID, command, commandParams); \
+ ErrNonFatalDisplayIf(err, "Could not launch app"); \
+ } \
+ }
+
+#define AppLaunchWithCommand(appCreator, appCommand, appCommandParams) \
+ LaunchWithCommand (sysFileTApplication, appCreator, appCommand, appCommandParams)
+
+#define AppCallWithCommand(appCreator, appCommand, appCommandParams) \
+{ \
+ UInt16 cardNo; \
+ LocalID dbID; \
+ DmSearchStateType searchState; \
+ UInt32 result; \
+ Err err; \
+ DmGetNextDatabaseByTypeCreator(true, &searchState, sysFileTApplication, \
+ appCreator, true, &cardNo, &dbID); \
+ ErrNonFatalDisplayIf(!dbID, "Could not find app"); \
+ if (dbID) { \
+ err = SysAppLaunch(cardNo, dbID, 0, appCommand, (MemPtr) appCommandParams, &result); \
+ ErrNonFatalDisplayIf(err, "Could not launch app"); \
+ } \
+ }
+*)
+
+(************************************************************
+ * Param Block passsed with the sysAppLaunchCmdLookup Command
+ *************************************************************)
+
+//-------------------------------------------------------------------
+// sysAppLaunchCmdLookup parameter block for the Address Book
+//-------------------------------------------------------------------
+
+// This is a list of fields by which data may be looked up.
+type
+ AddressLookupFields = Enum;
+
+const
+ addrLookupName = 0;
+ addrLookupFirstName = Succ(addrLookupName);
+ addrLookupCompany = Succ(addrLookupFirstName);
+ addrLookupAddress = Succ(addrLookupCompany);
+ addrLookupCity = Succ(addrLookupAddress);
+ addrLookupState = Succ(addrLookupCity);
+ addrLookupZipCode = Succ(addrLookupState);
+ addrLookupCountry = Succ(addrLookupZipCode);
+ addrLookupTitle = Succ(addrLookupCountry);
+ addrLookupCustom1 = Succ(addrLookupTitle);
+ addrLookupCustom2 = Succ(addrLookupCustom1);
+ addrLookupCustom3 = Succ(addrLookupCustom2);
+ addrLookupCustom4 = Succ(addrLookupCustom3);
+ addrLookupNote = Succ(addrLookupCustom4); // This field is assumed to be < 4K
+ addrLookupWork = Succ(addrLookupNote);
+ addrLookupHome = Succ(addrLookupWork);
+ addrLookupFax = Succ(addrLookupHome);
+ addrLookupOther = Succ(addrLookupFax);
+ addrLookupEmail = Succ(addrLookupOther);
+ addrLookupMain = Succ(addrLookupEmail);
+ addrLookupPager = Succ(addrLookupMain);
+ addrLookupMobile = Succ(addrLookupPager);
+ addrLookupSortField = Succ(addrLookupMobile);
+ addrLookupListPhone = Succ(addrLookupSortField);
+ addrLookupFieldCount = Succ(addrLookupListPhone); // add new fields above this one
+
+ addrLookupNoField = $ff;
+
+const
+ addrLookupStringLength = 12;
+
+type
+ AddrLookupParamsType = record
+ title: PChar;
+ // Title to appear in the title bar. If NULL the default is used.
+
+ pasteButtonText: PChar;
+ // Text to appear in paste button. If NULL "paste" is used.
+
+ lookupString: array [0..addrLookupStringLength-1] of Char;
+ // Buffer containing string to lookup. If the string matches
+ // only one record then that record is used without
+ // presenting the user with the lookup dialog.
+
+ field1: AddressLookupFields;
+ // Field to search by. This field appears on the left side
+ // of the lookup dialog. If the field is the sort field then
+ // searches use a binary search. If the field isn't the sort
+ // field then the data does appear in sorted order and searching
+ // is performed by a linear search (can get slow).
+
+ field2: AddressLookupFields;
+ // Field to display on the right. Often displays some
+ // information about the person. If it is a phone field
+ // and a record has multiple instances of the phone type
+ // then the person appears once per instance of the phone
+ // type. Either field1 or field2 may be a phone field but
+ // not both.
+
+ field2Optional: Boolean;
+ // True means that the record need not have field2 for
+ // the record to be listed. False means that field2 is
+ // required in the record for it to be listed.
+
+ userShouldInteract: Boolean;
+ // True means that the user should resolve non unique
+ // lookups. False means a non unique and complete lookup
+ // returns resultStringH set to 0 and recordID set to 0;
+
+ formatStringP: PChar;
+ // When the user selects the paste button a string is generated
+ // to return data from the record. The format of the result string
+ // is controlled by this string. All characters which appear
+ // in this string are copied straight to the result string unless
+ // they are a field (a '^' follow by the field name). For
+ // example, the format string "^first - ^home" might result in
+ // "Roger - 123-4567".
+
+ // The field arguments are name, first, company, address, city
+ // state, zipcode, country, title, custom1, custom2, custom3,
+ // custom4, work, home, fax, other, email, main, pager, mobile,
+ // and listname.
+
+ resultStringH: MemHandle;
+ // If there is a format string a result string is allocated on
+ // the dynamic heap and its handle is returned here.
+
+ uniqueID: UInt32;
+ // The unique ID of the found record or 0 if none was found.
+ end;
+
+type
+ AddrLookupParamsPtr = ^AddrLookupParamsType;
+
+(************************************************************
+ * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command
+ *************************************************************)
+
+const
+ prefAppLaunchCmdSetActivePanel = sysAppLaunchCmdCustomBase + 1;
+ // Record this panel so switching to the Prefs app
+ // causes this panel to execute.
+
+type
+ PrefActivePanelParamsType = record
+ activePanel: UInt32;
+ // The creator ID of a panel. Usually sent by a panel so the prefs
+ // apps will switch to it. This allows the last used panel to appear
+ // when switching to the Prefs app.
+ end;
+
+ PrefActivePanelParamsPtr = ^PrefActivePanelParamsType;
+
+(************************************************************
+ * Param Block passsed with the sysAppLaunchCmdAddRecord Command
+ *************************************************************)
+
+//-------------------------------------------------------------------
+// sysAppLaunchCmdAddRecord parameter block for the Mail application
+//-------------------------------------------------------------------
+// Param Block passsed with the sysAppLaunchCmdAddRecord Command
+
+type
+ MailMsgPriorityType = Enum;
+
+const
+ mailPriorityHigh = 0;
+ mailPriorityNormal = Succ(mailPriorityHigh);
+ mailPriorityLow = Succ(mailPriorityNormal);
+
+type
+ MailAddRecordParamsType = record
+ secret: Boolean;
+ // True means that the message should be marked secret
+
+ signature: Boolean;
+ // True means that signature from the Mail application's preferences
+ // should be attached to the message.
+
+ confirmRead: Boolean;
+ // True means that a comfirmation should be sent when the message
+ // is read.
+
+ confirmDelivery: Boolean;
+ // True means that a comfirmation should be sent when the message
+ // is deliveried
+
+ priority: MailMsgPriorityType;
+ // high, normial, or low.
+
+ padding: UInt8;
+
+ subject: PChar;
+ // Message's subject, a null-terminated string (optional).
+
+ from: PChar;
+ // Message's send, a null-terminated string (not currently used).
+
+ to_: PChar;
+ // Address the the recipient, a null-terminated string (required).
+
+ cc: PChar;
+ // Copy Addresses, a null-terminated string (required).
+
+ bcc: PChar;
+ // Blind copy Addresses, a null-terminated string (required).
+
+ replyTo: PChar;
+ // Reply to address, a null-terminated string (required).
+
+ body: PChar;
+ // The text of the message, a null-terminated string (required).
+ end;
+
+ MailAddRecordParamsPtr = ^MailAddRecordParamsType;
+
+//-------------------------------------------------------------------
+// sysAppLaunchCmdAddRecord parameter block for the Messaging application
+//-------------------------------------------------------------------
+// Param Block passsed with the sysAppLaunchCmdAddRecord Command
+
+//category defines
+const
+ MsgInboxCategory = 0;
+ MsgOutboxCategory = 1;
+ MsgDeletedCategory = 2;
+ MsgFiledCategory = 3;
+ MsgDraftCategory = 4;
+
+type
+ MsgAddRecordParamsType = record
+ category: UInt16;
+ //is this an outgoing mesage? Or should it be put into a different category
+
+ edit: Boolean;
+ // True means that the message should be opened in the editor,instead of
+ // just dropped into the category (only applies to outBox category)
+
+ signature: Boolean;
+ // True means that signature from the Mail application's preferences
+ // should be attached to the message.
+
+ subject: PChar;
+ // Message's subject, a null-terminated string (optional).
+
+ from: PChar;
+ // Message's send, a null-terminated string (not currently used).
+
+ to_: PChar;
+ // Address the the recipient, a null-terminated string (required).
+
+ replyTo: PChar;
+ // Reply to address, a null-terminated string (required).
+
+ body: PChar;
+ // The text of the message, a null-terminated string (required).
+ end;
+
+ MsgAddRecordParamsPtr = ^MsgAddRecordParamsType;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/attentionmgr.pp b/packages/palmunits/src/attentionmgr.pp
new file mode 100644
index 0000000000..2d5fedec12
--- /dev/null
+++ b/packages/palmunits/src/attentionmgr.pp
@@ -0,0 +1,209 @@
+{$MACRO ON}
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: AttentionMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Attention Manager
+ *
+ * History:
+ * Name Date Description
+ * ---- ---- -----------
+ * peter 06/12/00 Initial Revision
+ * gap 07/21/00 Change parameter list and data structures to support
+ * specification of card number as well as dbID.
+ *
+ *****************************************************************************)
+
+unit attentionmgr;
+
+interface
+
+uses palmos, coretraps, rect, errorbase;
+
+(************************************************************
+ * Attention Manager result codes
+ * (attnErrorClass is defined in ErrorBase)
+ *************************************************************)
+
+const
+ attnErrMemory = attnErrorClass or 1; // ran out of memory
+
+(************************************************************
+ * Attention Indicator bounds
+ *************************************************************)
+
+const
+ kAttnIndicatorLeft = 0;
+ kAttnIndicatorTop = 0;
+ kAttnIndicatorWidth = 16;
+ kAttnIndicatorHeight = 15;
+
+(************************************************************
+ * Constants used for list view drawing.
+ *
+ * Applications should use the following constants to format
+ * the display of information in attention manager list view.
+ *
+ * The application's small icon should be drawn centered within
+ * the first kAttnListMaxIconWidth pixels of the drawing bounds.
+ *
+ * Two lines of text information describing the attention should
+ * then be drawn left justified starting at kAttnListTextOffset
+ * from the left edge of the drawing bounds.
+ *************************************************************)
+
+const
+ kAttnListMaxIconWidth = 15;
+ kAttnListTextOffset = 17;
+
+(********************************************************************
+ * Attention Manager Structures
+ ********************************************************************)
+
+type
+ AttnFlagsType = UInt32;
+
+const
+ kAttnFlagsSoundBit = AttnFlagsType($1);
+ kAttnFlagsLEDBit = AttnFlagsType($2);
+ kAttnFlagsVibrateBit = AttnFlagsType($4);
+ kAttnFlagsCustomEffectBit = AttnFlagsType($8);
+ // Note: More bits can be defined if/when hardware capability increases
+
+ kAttnFlagsAllBits = AttnFlagsType($FFFF);
+
+// The following are passed to AttnGetAttention() and AttnUpdate to specify
+// overrides from the user settings for an attention request.
+ kAttnFlagsUseUserSettings = AttnFlagsType($0);
+
+ kAttnFlagsAlwaysSound = kAttnFlagsSoundBit;
+ kAttnFlagsAlwaysLED = kAttnFlagsLEDBit;
+ kAttnFlagsAlwaysVibrate = kAttnFlagsVibrateBit;
+ kAttnFlagsAlwaysCustomEffect = kAttnFlagsCustomEffectBit;
+ kAttnFlagsEverything = kAttnFlagsAllBits;
+
+ kAttnFlagsNoSound = kAttnFlagsSoundBit shl 16;
+ kAttnFlagsNoLED = kAttnFlagsLEDBit shl 16;
+ kAttnFlagsNoVibrate = kAttnFlagsVibrateBit shl 16;
+ kAttnFlagsNoCustomEffect = kAttnFlagsCustomEffectBit shl 16;
+ kAttnFlagsNothing = kAttnFlagsAllBits shl 16;
+
+// The following are used to interpret the feature.
+ kAttnFtrCreator = Rsc('attn');
+ kAttnFtrCapabilities = 0; // Read to determine device capabilities and user settings.
+
+ kAttnFlagsUserWantsSound = kAttnFlagsSoundBit;
+ kAttnFlagsUserWantsLED = kAttnFlagsLEDBit;
+ kAttnFlagsUserWantsVibrate = kAttnFlagsVibrateBit;
+ kAttnFlagsUserWantsCustomEffect = kAttnFlagsCustomEffectBit; // Always false
+ kAttnFlagsUserSettingsMask = kAttnFlagsAllBits;
+
+ kAttnFlagsHasSound = kAttnFlagsSoundBit shl 16;
+ kAttnFlagsHasLED = kAttnFlagsLEDBit shl 16;
+ kAttnFlagsHasVibrate = kAttnFlagsVibrateBit shl 16;
+ kAttnFlagsHasCustomEffect = kAttnFlagsCustomEffectBit shl 16; // Always true
+ kAttnFlagsCapabilitiesMask = kAttnFlagsAllBits shl 16;
+
+type
+ AttnLevelType = UInt16;
+
+const
+ kAttnLevelInsistent = AttnLevelType(0);
+ kAttnLevelSubtle = AttnLevelType(1);
+
+type
+ AttnCommandType = UInt16;
+
+const
+ kAttnCommandDrawDetail = AttnCommandType(1);
+ kAttnCommandDrawList = AttnCommandType(2);
+ kAttnCommandPlaySound = AttnCommandType(3);
+ kAttnCommandCustomEffect = AttnCommandType(4);
+ kAttnCommandGoThere = AttnCommandType(5);
+ kAttnCommandGotIt = AttnCommandType(6);
+ kAttnCommandSnooze = AttnCommandType(7);
+ kAttnCommandIterate = AttnCommandType(8);
+
+type
+ AttnCommandArgsDrawDetailTag = record
+ bounds: RectangleType;
+ firstTime: Boolean;
+ flags: AttnFlagsType;
+ end;
+
+ AttnCommandArgsDrawListTag = record
+ bounds: RectangleType;
+ firstTime: Boolean;
+ flags: AttnFlagsType;
+ selected: Boolean;
+ end;
+
+ AttnCommandArgsGotItTag = record
+ dismissedByUser: Boolean;
+ end;
+
+ AttnCommandArgsIterateTag = record
+ iterationData: UInt32;
+ end;
+
+ AttnCommandArgsTag = record
+ case Integer of
+ 1: (drawDetail: AttnCommandArgsDrawDetailTag);
+ 2: (drawList: AttnCommandArgsDrawListTag);
+ 3: (gotIt: AttnCommandArgsGotItTag);
+ 4: (iterate: AttnCommandArgsIterateTag);
+ end;
+ AttnCommandArgsType = AttnCommandArgsTag;
+
+type
+ AttnLaunchCodeArgsType = record
+ command: AttnCommandType;
+ userData: UInt32;
+ commandArgsP: ^AttnCommandArgsType;
+ end;
+
+type
+ AttnCallbackProc = function(command: AttnCommandType; userData: UInt32; var commandArgsP: AttnCommandArgsType): Err;
+
+// These details go with the sysNotifyGotUsersAttention notification.
+type
+ AttnNotifyDetailsType = record
+ flags: AttnFlagsType;
+ end;
+
+(********************************************************************
+ * Public Attention Manager Routines
+ ********************************************************************)
+
+function AttnGetAttention(cardNo: UInt16; dbID: LocalID; userData: UInt32;
+ callbackFnP: AttnCallbackProc; level: AttnLevelType; flags: AttnFlagsType;
+ nagRateInSeconds, nagRepeatLimit: UInt16): Err; syscall sysTrapAttnGetAttention;
+
+function AttnUpdate(cardNo: UInt16; dbID: LocalID; userData: UInt32;
+ callbackFnP: AttnCallbackProc; var flagsP: AttnFlagsType;
+ var nagRateInSecondsP, nagRepeatLimitP: UInt16): Boolean; syscall sysTrapAttnUpdate;
+
+function AttnForgetIt(cardNo: UInt16; dbID: LocalID; userData: UInt32): Boolean; syscall sysTrapAttnForgetIt;
+
+function AttnGetCounts(cardNo: UInt16; dbID: LocalID; var insistentCountP, subtleCountP: UInt16): UInt16; syscall sysTrapAttnGetCounts;
+
+procedure AttnListOpen; syscall sysTrapAttnListOpen;
+
+procedure AttnIterate(cardNo: UInt16; dbID: LocalID; iterationData: UInt32); syscall sysTrapAttnIterate;
+
+function AttnDoSpecialEffects(flags: AttnFlagsType): Err; syscall sysTrapAttnDoSpecialEffects;
+
+procedure AttnIndicatorEnable(enableIt: Boolean); syscall sysTrapAttnIndicatorEnable;
+
+function AttnIndicatorEnabled: Boolean; syscall sysTrapAttnIndicatorEnabled;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/bitmap.pp b/packages/palmunits/src/bitmap.pp
new file mode 100644
index 0000000000..48053f39d3
--- /dev/null
+++ b/packages/palmunits/src/bitmap.pp
@@ -0,0 +1,185 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Bitmap.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit bitmap;
+
+interface
+
+uses palmos, coretraps;
+
+//-----------------------------------------------
+// The Bitmap Structure.
+//-----------------------------------------------
+
+// bitmap version numbers
+const
+ BitmapVersionZero = 0;
+ BitmapVersionOne = 1;
+ BitmapVersionTwo = 2;
+
+// Compression Types for BitmapVersionTwo.
+type
+ BitmapCompressionType = Enum;
+
+const
+ BitmapCompressionTypeScanLine = 0;
+ BitmapCompressionTypeRLE = Succ(BitmapCompressionTypeScanLine);
+
+ BitmapCompressionTypePackBits = Succ(BitmapCompressionTypeRLE);
+ BitmapCompressionTypeEnd = Succ(BitmapCompressionTypePackBits);
+ // must follow last compression algorithm
+
+ BitmapCompressionTypeBest = $64;
+ BitmapCompressionTypeNone = $FF;
+
+type
+ BitmapFlagsType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+ {
+ 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 directColor:1; // direct color bitmap
+ UInt16 reserved:10
+ }
+{$endif}
+ end;
+
+// this definition correspond to the 'Tbmp' and 'tAIB' resource types
+ BitmapType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS} // These fields will not be available in the next OS release!
+ width: Int16;
+ height: Int16;
+ rowBytes: UInt16;
+ flags: BitmapFlagsType;
+ pixelSize: UInt8; // bits/pixel
+ version: UInt8; // version of bitmap. This is vers 2
+ nextDepthOffset: UInt16; // # of DWords to next BitmapType
+ // from beginnning of this one
+ transparentIndex: UInt8; // v2 only, if flags.hasTransparency is true,
+ // index number of transparent color
+ compressionType: UInt8; // v2 only, if flags.compressed is true, this is
+ // the type, see BitmapCompressionType
+
+ reserved: UInt16; // for future use, must be zero!
+
+ // if (flags.hasColorTable)
+ // ColorTableType colorTable // NOTE: Could have 0 entries (2 bytes long)
+ //
+ // if (flags.directColor)
+ // BitmapDirectInfoType directInfo;
+ //
+ // if (flags.indirect)
+ // void* bitsP; // pointer to actual bits
+ // else
+ // UInt8 bits[]; // or actual bits
+ //
+{$endif}
+ end;
+
+ BitmapPtr = ^BitmapType;
+
+//-----------------------------------------------
+// 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.
+//-----------------------------------------------
+
+ RGBColorType = record
+ index: UInt8; // index of color or best match to cur CLUT or unused.
+ r: UInt8; // amount of red, 0->255
+ g: UInt8; // amount of green, 0->255
+ b: UInt8; // amount of blue, 0->255
+ end;
+ RGBColorPtr = ^RGBColorType;
+
+// -----------------------------------------------
+// For direct color bitmaps (flags.directColor set), this structure follows
+// the color table if one is present, or immediately follows the BitmapType if a
+// color table is not present.
+// The only type of direct color bitmap that is currently supported in version 3
+// of the Window Manager (feature: sysFtrCreator, #sysFtrNumWinVersion) are
+// 16 bits/pixel with redBits=5, greenBits=6, blueBits=5.
+// -----------------------------------------------
+
+ BitmapDirectInfoType = record
+ redBits: UInt8; // # of red bits in each pixel
+ greenBits: UInt8; // # of green bits in each pixel
+ blueBits: UInt8; // # of blue bits in each pixel
+ reserved: UInt8; // must be zero
+ transparentColor: RGBColorType; // transparent color (index field ignored)
+ end;
+
+// -----------------------------------------------
+// Color Table
+// -----------------------------------------------
+
+ ColorTableType = record
+ // high bits (numEntries > 256) reserved
+ numEntries: UInt16; // number of entries in table
+ // RGBColorType entry[]; // array 0..numEntries-1 of colors
+ // starts immediately after numEntries
+ end;
+ ColorTablePtr = ^ColorTableType;
+
+// get start of color table entries aray given pointer to ColorTableType
+
+function ColorTableEntries(ctP: ColorTablePtr): RGBColorPtr;
+
+//-----------------------------------------------
+// Routines relating to bitmap management
+//-----------------------------------------------
+
+function BmpCreate(width, height: Coord; depth: UInt8; var colortableP: ColorTableType; var error: UInt16): BitmapPtr; syscall sysTrapBmpCreate;
+
+function BmpDelete(bitmapP: BitmapPtr): Err; syscall sysTrapBmpDelete;
+
+function BmpCompress(bitmapP: BitmapPtr; compType: BitmapCompressionType): Err; syscall sysTrapBmpCompress;
+
+function BmpGetBits(bitmapP: BitmapPtr): Pointer; syscall sysTrapBmpGetBits;
+
+function BmpGetColortable(bitmapP: BitmapPtr): ColorTablePtr; syscall sysTrapBmpGetColortable;
+
+function BmpSize(bitmapP: BitmapPtr): UInt16; syscall sysTrapBmpSize;
+
+function BmpBitsSize(bitmapP: BitmapPtr): UInt16; syscall sysTrapBmpBitsSize;
+
+procedure BmpGetSizes(bitmapP: BitmapPtr; var dataSizeP: UInt32; var headerSizeP: UInt32); syscall sysTrapBmpGetSizes;
+
+function BmpColortableSize(bitmapP: BitmapPtr): UInt16; syscall sysTrapBmpColortableSize;
+
+procedure BmpGetDimensions(bitmapP: BitmapPtr; var widthP, heightP: Coord; var rowBytesP: UInt16); syscall sysTrapBmpGetDimensions;
+
+function BmpGetBitDepth(bitmapP: BitmapPtr): UInt8; syscall sysTrapBmpGetBitDepth;
+
+function BmpGetNextBitmap(bitmapP: BitmapPtr): BitmapPtr; syscall sysTrapBmpGetNextBitmap;
+
+implementation
+
+function ColorTableEntries(ctP: ColorTablePtr): RGBColorPtr;
+begin
+ ColorTableEntries := RGBColorPtr(PChar(ctP) + SizeOf(ctP^));
+end;
+
+end.
diff --git a/packages/palmunits/src/category.pp b/packages/palmunits/src/category.pp
new file mode 100644
index 0000000000..a7c0327d1a
--- /dev/null
+++ b/packages/palmunits/src/category.pp
@@ -0,0 +1,90 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Category.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines category structures and routines.
+
+ *
+ * History:
+ * 03/07/95 art Created by Art Lamb
+ * 07/14/99 bob Fix up const junk
+ * 08/12/99 gap Add new constants categoryHideEditCategory & categoryDefaultEditCategoryString.
+ * 11/13/00 kwk The listP param for CategoryCreateList[V10] is not const.
+ *
+ *****************************************************************************)
+
+unit category;
+
+interface
+
+uses palmos, coretraps, datamgr, control, list, form;
+
+// Note: although these constants are in the range of system resource IDs, the are actually
+// constants passed to CategoryCreateList, CategorySelect, and CategoryFreeList which will
+// produce the desired action. The reason the constants are in this range is to keep them
+// out of the numeric range that developers can use for resource IDs in the attempt to avoid
+// conflicts.
+
+const
+ categoryHideEditCategory = 10000;
+ categoryDefaultEditCategoryString = 10001;
+
+type
+ AppInfoType = record
+ renamedCategories: UInt16;
+ categoryLabels: array [0..dmRecNumCategories-1, 0..dmCategoryLength-1] of Char;
+ categoryUniqIDs: array [0..dmRecNumCategories-1] of UInt8;
+ lastUniqID: UInt8; // Uniq IDs generated by the device are between
+ // 0 - 127. Those from the PC are 128 - 255.
+ padding: UInt8;
+ end;
+ AppInfoTag = AppInfoType;
+ AppInfoPtr = ^AppInfoType;
+
+procedure CategoryCreateListV10(db: DmOpenRef; lst: ListPtr; currentCategory: UInt16; showAll: Boolean); syscall sysTrapCategoryCreateListV10;
+
+procedure CategoryCreateList(db: DmOpenRef; listP: ListPtr;
+ currentCategory: UInt16; showAll, showUneditables: Boolean;
+ numUneditableCategories: UInt8; editingStrID: UInt32; resizeList: Boolean); syscall sysTrapCategoryCreateList;
+
+procedure CategoryFreeListV10(db: DmOpenRef; lst: ListPtr); syscall sysTrapCategoryFreeListV10;
+
+procedure CategoryFreeList(db: DmOpenRef; listP: ListPtr; showAll: Boolean; editingStrID: UInt32); syscall sysTrapCategoryFreeList;
+
+function CategoryFind(db: DmOpenRef; const name: PChar): UInt16; syscall sysTrapCategoryFind;
+
+procedure CategoryGetName(db: DmOpenRef; index: UInt16; name: PChar); syscall sysTrapCategoryGetName;
+
+function CategoryEditV10(db: DmOpenRef; var category: UInt16): Boolean; syscall sysTrapCategoryEditV10;
+
+function CategoryEditV20(db: DmOpenRef; var category: UInt16; titleStrID: UInt32): Boolean; syscall sysTrapCategoryEditV20;
+
+function CategoryEdit(db: DmOpenRef; var category: UInt16; titleStrID: UInt32; numUneditableCategories: UInt8): Boolean; syscall sysTrapCategoryEdit;
+
+function CategorySelectV10(db: DmOpenRef; const frm: FormPtr; ctlID, lstID: UInt16; title: Boolean;
+ var categoryP: UInt16; categoryName: PChar): Boolean; syscall sysTrapCategorySelectV10;
+
+function CategorySelect(db: DmOpenRef; const frm: FormPtr; ctlID, lstID: UInt16; title: Boolean; var categoryP: UInt16;
+ categoryName: PChar; numUneditableCategories: UInt8; editingStrID: UInt32): Boolean; syscall sysTrapCategorySelect;
+
+function CategoryGetNext(db: DmOpenRef; index: UInt16): UInt16; syscall sysTrapCategoryGetNext;
+
+procedure CategorySetTriggerLabel(ctl: ControlPtr; name: PChar); syscall sysTrapCategorySetTriggerLabel;
+
+procedure CategoryTruncateName(name: PChar; maxWidth: UInt16); syscall sysTrapCategoryTruncateName;
+
+procedure CategoryInitialize(appInfoP: AppInfoPtr; localizedAppInfoStrID: UInt16); syscall sysTrapCategoryInitialize;
+
+procedure CategorySetName(db: DmOpenRef; index: UInt16; const nameP: PChar); syscall sysTrapCategorySetName;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/chars.pp b/packages/palmunits/src/chars.pp
new file mode 100644
index 0000000000..aba603c025
--- /dev/null
+++ b/packages/palmunits/src/chars.pp
@@ -0,0 +1,448 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Chars.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ * 2001-02-10 jwm Added symbol11Help and corrected values of *ArrowDisabled
+ *
+ *****************************************************************************)
+
+unit chars;
+
+interface
+
+uses palmos;
+
+// 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.
+
+const
+ chrNull = $0000;
+ chrStartOfHeading = $0001;
+ chrStartOfText = $0002;
+ chrEndOfText = $0003;
+ chrEndOfTransmission = $0004;
+ chrEnquiry = $0005;
+ chrAcknowledge = $0006;
+ chrBell = $0007;
+ chrBackspace = $0008;
+ chrHorizontalTabulation = $0009;
+ chrLineFeed = $000A;
+ chrVerticalTabulation = $000B;
+ chrFormFeed = $000C;
+ chrCarriageReturn = $000D;
+ chrShiftOut = $000E;
+ chrShiftIn = $000F;
+ chrDataLinkEscape = $0010;
+ chrDeviceControlOne = $0011;
+ chrDeviceControlTwo = $0012;
+ chrDeviceControlThree = $0013;
+ chrDeviceControlFour = $0014;
+ chrNegativeAcknowledge = $0015;
+ chrSynchronousIdle = $0016;
+ chrEndOfTransmissionBlock = $0017;
+ chrCancel = $0018;
+ chrEndOfMedium = $0019;
+ chrSubstitute = $001A;
+ chrEscape = $001B;
+ chrFileSeparator = $001C;
+ chrGroupSeparator = $001D;
+ chrRecordSeparator = $001E;
+ chrUnitSeparator = $001F;
+ chrSpace = $0020;
+ chrExclamationMark = $0021;
+ chrQuotationMark = $0022;
+ chrNumberSign = $0023;
+ chrDollarSign = $0024;
+ chrPercentSign = $0025;
+ chrAmpersand = $0026;
+ chrApostrophe = $0027;
+ chrLeftParenthesis = $0028;
+ chrRightParenthesis = $0029;
+ chrAsterisk = $002A;
+ chrPlusSign = $002B;
+ chrComma = $002C;
+ chrHyphenMinus = $002D;
+ chrFullStop = $002E;
+ chrSolidus = $002F;
+ chrDigitZero = $0030;
+ chrDigitOne = $0031;
+ chrDigitTwo = $0032;
+ chrDigitThree = $0033;
+ chrDigitFour = $0034;
+ chrDigitFive = $0035;
+ chrDigitSix = $0036;
+ chrDigitSeven = $0037;
+ chrDigitEight = $0038;
+ chrDigitNine = $0039;
+ chrColon = $003A;
+ chrSemicolon = $003B;
+ chrLessThanSign = $003C;
+ chrEqualsSign = $003D;
+ chrGreaterThanSign = $003E;
+ chrQuestionMark = $003F;
+ chrCommercialAt = $0040;
+ chrCapital_A = $0041;
+ chrCapital_B = $0042;
+ chrCapital_C = $0043;
+ chrCapital_D = $0044;
+ chrCapital_E = $0045;
+ chrCapital_F = $0046;
+ chrCapital_G = $0047;
+ chrCapital_H = $0048;
+ chrCapital_I = $0049;
+ chrCapital_J = $004A;
+ chrCapital_K = $004B;
+ chrCapital_L = $004C;
+ chrCapital_M = $004D;
+ chrCapital_N = $004E;
+ chrCapital_O = $004F;
+ chrCapital_P = $0050;
+ chrCapital_Q = $0051;
+ chrCapital_R = $0052;
+ chrCapital_S = $0053;
+ chrCapital_T = $0054;
+ chrCapital_U = $0055;
+ chrCapital_V = $0056;
+ chrCapital_W = $0057;
+ chrCapital_X = $0058;
+ chrCapital_Y = $0059;
+ chrCapital_Z = $005A;
+ chrLeftSquareBracket = $005B;
+// chrReverseSolidus $005C (not in Japanese fonts)
+ chrRightSquareBracket = $005D;
+ chrCircumflexAccent = $005E;
+ chrLowLine = $005F;
+ chrGraveAccent = $0060;
+ chrSmall_A = $0061;
+ chrSmall_B = $0062;
+ chrSmall_C = $0063;
+ chrSmall_D = $0064;
+ chrSmall_E = $0065;
+ chrSmall_F = $0066;
+ chrSmall_G = $0067;
+ chrSmall_H = $0068;
+ chrSmall_I = $0069;
+ chrSmall_J = $006A;
+ chrSmall_K = $006B;
+ chrSmall_L = $006C;
+ chrSmall_M = $006D;
+ chrSmall_N = $006E;
+ chrSmall_O = $006F;
+ chrSmall_P = $0070;
+ chrSmall_Q = $0071;
+ chrSmall_R = $0072;
+ chrSmall_S = $0073;
+ chrSmall_T = $0074;
+ chrSmall_U = $0075;
+ chrSmall_V = $0076;
+ chrSmall_W = $0077;
+ chrSmall_X = $0078;
+ chrSmall_Y = $0079;
+ chrSmall_Z = $007A;
+ chrLeftCurlyBracket = $007B;
+ chrVerticalLine = $007C;
+ chrRightCurlyBracket = $007D;
+ chrTilde = $007E;
+ chrDelete = $007F;
+
+// Special meanings given to characters by the PalmOS
+ chrTab = chrHorizontalTabulation; // $0009
+ vchrPageUp = chrVerticalTabulation; // $000B
+ vchrPageDown = chrFormFeed; // $000C
+ chrOtaSecure = chrDeviceControlFour; // $0014
+ chrOta = chrNegativeAcknowledge; // $0015
+ chrCommandStroke = chrSynchronousIdle; // $0016
+ chrShortcutStroke = chrEndOfTransmissionBlock; // $0017
+ chrEllipsis = chrCancel; // $0018
+ chrNumericSpace = chrEndOfMedium; // $0019
+ chrCardIcon = chrSubstitute; // $001A Card Icon glyph, added in PalmOS 4.0
+ chrLeftArrow = chrFileSeparator; // $001C
+ chrRightArrow = chrGroupSeparator; // $001D
+ chrUpArrow = chrRecordSeparator; // $001E
+ chrDownArrow = chrUnitSeparator; // $001F
+
+// 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.
+ vchrLowBattery = $0101; // Display low battery dialog
+ vchrEnterDebugger = $0102; // Enter Debugger
+ vchrNextField = $0103; // Go to next field in form
+ vchrStartConsole = $0104; // Startup console task
+ vchrMenu = $0105; // Ctl-A
+ vchrCommand = $0106; // Ctl-C
+ vchrConfirm = $0107; // Ctl-D
+ vchrLaunch = $0108; // Ctl-E
+ vchrKeyboard = $0109; // Ctl-F popup the keyboard in appropriate mode
+ vchrFind = $010A;
+ vchrCalc = $010B;
+ vchrPrevField = $010C;
+ vchrAlarm = $010D; // sent before displaying an alarm
+ vchrRonamatic = $010E; // stroke from graffiti area to top half of screen
+ vchrGraffitiReference = $010F; // popup the Graffiti reference
+ vchrKeyboardAlpha = $0110; // popup the keyboard in alpha mode
+ vchrKeyboardNumeric = $0111; // popup the keyboard in number mode
+ vchrLock = $0112; // switch to the Security app and lock the device
+ vchrBacklight = $0113; // toggle state of backlight
+ vchrAutoOff = $0114; // power off due to inactivity timer
+// Added for PalmOS 3.0
+ vchrExgTest = $0115; // put exchange Manager into test mode (&.t)
+ vchrSendData = $0116; // Send data if possible
+ vchrIrReceive = $0117; // Initiate an Ir receive manually (&.i)
+// Added for PalmOS 3.1
+ vchrTsm1 = $0118; // Text Services silk-screen button
+ vchrTsm2 = $0119; // Text Services silk-screen button
+ vchrTsm3 = $011A; // Text Services silk-screen button
+ vchrTsm4 = $011B; // Text Services silk-screen button
+// Added for PalmOS 3.2
+ vchrRadioCoverageOK = $011C; // Radio coverage check successful
+ vchrRadioCoverageFail = $011D; // Radio coverage check failure
+ vchrPowerOff = $011E; // Posted after autoOffChr or hardPowerChr
+ // to put system to sleep with SysSleep.
+// Added for PalmOS 3.5
+ vchrResumeSleep = $011F; // Posted by NotifyMgr clients after they
+ // have deferred a sleep request in order
+ // to resume it.
+ vchrLateWakeup = $0120; // Posted by the system after waking up
+ // to broadcast a late wakeup notification.
+ // FOR SYSTEM USE ONLY
+ vchrTsmMode = $0121; // Posted by TSM to trigger mode change.
+ vchrBrightness = $0122; // Activates brightness adjust dialog
+ vchrContrast = $0123; // Activates contrast adjust dialog
+
+ vchrExpCardInserted = $0124; // ExpansionMgr card inserted & removed.
+ vchrExpCardRemoved = $0125; // NOTE: these keys will never show up in an
+ // app's event loop (they are caught inside
+ // EvtGetEvent()), and will probably be
+ // deprecated soon (see comments in ExpansionMgr.c).
+
+ vchrExgIntData = $01FF; // Exchange Manager wakeup event
+
+// Added for PalmOS 4.0 NOTE: 0x1FF is used above - not in numeric order!
+ vchrAttnStateChanged = $0126; // Posted by AttentionMgr API to open or update dialog
+ vchrAttnUnsnooze = $0127; // Posted when AttentionMgr snooze timer expires
+ vchrAttnIndicatorTapped = $0128; // Posted when AttentionIndicator is tapped
+ vchrAttnAllowClose = $0129; // Posted when AttnAllowClose is called
+ vchrAttnReopen = $012A; // Posted when AttnReopen is called
+ vchrCardCloseMenu = $012B; // Posted when a card is inserted
+ vchrIrGotData = $012C; // Posted when IR Receive initiated
+ // and copying of an app is imminent
+
+// The application launching buttons generate the following
+// key codes and will also set the commandKeyMask bit in the
+// modifiers field
+ vchrHardKeyMin = $0200;
+ vchrHardKeyMax = $02FF; // 256 hard keys
+
+ vchrHard1 = $0204;
+ vchrHard2 = $0205;
+ vchrHard3 = $0206;
+ vchrHard4 = $0207;
+ vchrHardPower = $0208;
+ vchrHardCradle = $0209; // Button on cradle pressed
+ vchrHardCradle2 = $020A; // Button on cradle pressed and hwrDockInGeneric1
+ // input on dock asserted (low).
+ vchrHardContrast = $020B; // Sumo's Contrast button
+ vchrHardAntenna = $020C; // Eleven's Antenna switch
+ vchrHardBrightness = $020D; // Hypothetical Brightness button
+ vchrPageUpWhenOff = $020E; // The m100 device's page-up clock button
+ vchrHardEarbud = $020F; // Hypothetical Earbud 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
+ vchrThumperMin = $0300;
+ vchrThumperMax = $03FF; // 256 command keys
+
+// Motorola
+ vchrCessnaMin = $14CD;
+ vchrCessnaMax = $14CD; // 1 command key
+
+// TRG
+ vchrCFlashMin = $1500;
+ vchrCFlashMax = $150F; // 16 command keys
+
+// Symbol
+ vchrSPTMin = $15A0;
+ vchrSPTMax = $15AF; // 16 command keys
+
+// Handspring
+ vchrSlinkyMin = $1600;
+ vchrSlinkyMax = $16FF; // 256 command keys
+
+// Palm
+ vchrPalmMin = $1700; // 256 command keys
+ vchrPalmMax = $17ff;
+
+// Old names for some of the characters.
+ nullChr = chrNull; // $0000
+ backspaceChr = chrBackspace; // $0008
+ tabChr = chrHorizontalTabulation; // $0009
+ linefeedChr = chrLineFeed; // $000A
+ pageUpChr = vchrPageUp; // $000B
+ chrPageUp = vchrPageUp; // $000B
+ pageDownChr = vchrPageDown; // $000C
+ chrPageDown = vchrPageDown; // $000C
+ crChr = chrCarriageReturn; // $000D
+ returnChr = chrCarriageReturn; // $000D
+ otaSecureChr = chrOtaSecure; // $0014
+ otaChr = chrOta; // $0015
+
+ escapeChr = chrEscape; // $001B
+ leftArrowChr = chrLeftArrow; // $001C
+ rightArrowChr = chrRightArrow; // $001D
+ upArrowChr = chrUpArrow; // $001E
+ downArrowChr = chrDownArrow; // $001F
+ spaceChr = chrSpace; // $0020
+ quoteChr = chrQuotationMark; // $0022 '"'
+ commaChr = chrComma; // $002C ','
+ periodChr = chrFullStop; // $002E '.'
+ colonChr = chrColon; // $003A ':'
+ lowBatteryChr = vchrLowBattery; // $0101
+ enterDebuggerChr = vchrEnterDebugger; // $0102
+ nextFieldChr = vchrNextField; // $0103
+ startConsoleChr = vchrStartConsole; // $0104
+ menuChr = vchrMenu; // $0105
+ commandChr = vchrCommand; // $0106
+ confirmChr = vchrConfirm; // $0107
+ launchChr = vchrLaunch; // $0108
+ keyboardChr = vchrKeyboard; // $0109
+ findChr = vchrFind; // $010A
+ calcChr = vchrCalc; // $010B
+ prevFieldChr = vchrPrevField; // $010C
+ alarmChr = vchrAlarm; // $010D
+ ronamaticChr = vchrRonamatic; // $010E
+ graffitiReferenceChr = vchrGraffitiReference; // $010F
+ keyboardAlphaChr = vchrKeyboardAlpha; // $0110
+ keyboardNumericChr = vchrKeyboardNumeric; // $0111
+ lockChr = vchrLock; // $0112
+ backlightChr = vchrBacklight; // $0113
+ autoOffChr = vchrAutoOff; // $0114
+ exgTestChr = vchrExgTest; // $0115
+ sendDataChr = vchrSendData; // $0116
+ irReceiveChr = vchrIrReceive; // $0117
+ radioCoverageOKChr = vchrRadioCoverageOK; // $011C
+ radioCoverageFailChr = vchrRadioCoverageFail; // $011D
+ powerOffChr = vchrPowerOff; // $011E
+ resumeSleepChr = vchrResumeSleep; // $011F
+ lateWakeupChr = vchrLateWakeup; // $0120
+ brightnessChr = vchrBrightness; // $0121
+ contrastChr = vchrContrast; // $0122
+ hardKeyMin = vchrHardKeyMin; // $0200
+ hardKeyMax = vchrHardKeyMax; // $02FF
+ hard1Chr = vchrHard1; // $0204
+ hard2Chr = vchrHard2; // $0205
+ hard3Chr = vchrHard3; // $0206
+ hard4Chr = vchrHard4; // $0207
+ hardPowerChr = vchrHardPower; // $0208
+ hardCradleChr = vchrHardCradle; // $0209
+ hardCradle2Chr = vchrHardCradle2; // $020A
+ hardContrastChr = vchrHardContrast; // $020B
+ hardAntennaChr = vchrHardAntenna; // $020C
+ hardBrightnessChr = vchrHardBrightness; // $020D
+ hardEarbudChr = vchrHardEarbud; // 0x020F
+
+// 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
+type
+ symbolChars = Enum;
+
+const
+ symbolLeftArrow = 3;
+ symbolRightArrow = Succ(symbolLeftArrow);
+ symbolUpArrow = Succ(symbolRightArrow);
+ symbolDownArrow = Succ(symbolUpArrow);
+ symbolSmallDownArrow = Succ(symbolDownArrow);
+ symbolSmallUpArrow = Succ(symbolSmallDownArrow);
+ symbolMemo = 9;
+ symbolHelp = Succ(symbolMemo);
+ symbolNote = Succ(symbolHelp);
+ symbolNoteSelected = Succ(symbolNote);
+ symbolCapsLock = Succ(symbolNoteSelected);
+ symbolNumLock = Succ(symbolCapsLock);
+ symbolShiftUpper = Succ(symbolNumLock);
+ symbolShiftPunc = Succ(symbolShiftUpper);
+ symbolShiftExt = Succ(symbolShiftPunc);
+ symbolShiftNone = Succ(symbolShiftExt);
+ symbolNoTime = Succ(symbolShiftNone);
+ symbolAlarm = Succ(symbolNoTime);
+ symbolRepeat = Succ(symbolAlarm);
+ symbolCheckMark = Succ(symbolRepeat);
+ // 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 = Succ(symbolCheckMark);
+ symbolClubChr = Succ(symbolDiamondChr);
+ symbolHeartChr = Succ(symbolClubChr);
+ symbolSpadeCh = Succ(symbolHeartChr);
+
+// Character in the 7 point symbol font. Resource ID 9005
+type
+ symbol7Chars = Enum;
+
+const
+ symbol7ScrollUp = 1;
+ symbol7ScrollDown = Succ(symbol7ScrollUp);
+ symbol7ScrollUpDisabled = Succ(symbol7ScrollDown);
+ symbol7ScrollDownDisabled = Succ(symbol7ScrollUpDisabled);
+
+// Characters in the 11 point symbol font. Resource ID 9004
+type
+ symbol11Chars = Enum;
+
+const
+ symbolCheckboxOff = 0;
+ symbolCheckboxOn = Succ(symbolCheckboxOff);
+ symbol11LeftArrow = Succ(symbolCheckboxOn);
+ symbol11RightArrow = Succ(symbol11LeftArrow);
+ symbol11Help = Succ(symbol11RightArrow);
+ symbol11LeftArrowDisabled = Succ(symbol11Help); // New for Palm OS v3.2
+ symbol11RightArrowDisabled = Succ(symbol11LeftArrowDisabled); // New for Palm OS v3.2
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/clipboard.pp b/packages/palmunits/src/clipboard.pp
new file mode 100644
index 0000000000..f260b98834
--- /dev/null
+++ b/packages/palmunits/src/clipboard.pp
@@ -0,0 +1,64 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: clipBoard.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines clipboard structures and routines.
+ *
+ * History:
+ * September 1, 1994 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit clipboard;
+
+interface
+
+uses palmos, coretraps;
+
+const
+ numClipboardForamts = 3;
+ numClipboardFormats = numClipboardForamts;
+ cbdMaxTextLength = 1000;
+
+// Clipboard standard formats
+type
+ clipboardFormats = Enum;
+
+const
+ clipboardText = 0;
+ clipboardInk = Succ(clipboardText);
+ clipboardBitmap = Succ(clipboardInk);
+
+type
+ ClipboardFormatType = clipboardFormats;
+
+type
+ ClipboardItem = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CLIPBOARDS} // These fields will not be available in the next OS release!
+ item: MemHandle;
+ length: UInt16;
+{$endif}
+ end;
+ ClipboardItemTag = ClipboardItem;
+
+//----------------------------------------------------------
+// Clipboard Functions
+//----------------------------------------------------------
+
+procedure ClipboardAddItem(const format: ClipboardFormatType; const ptr: Pointer; length: UInt16); syscall sysTrapClipboardAddItem;
+
+function ClipboardAppendItem(const format: ClipboardFormatType; const ptr: Pointer; length: UInt16): Err; syscall sysTrapClipboardAppendItem;
+
+function ClipboardGetItem(const format: ClipboardFormatType; var length: UInt16): MemHandle; syscall sysTrapClipboardGetItem;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/connectionmgr.pp b/packages/palmunits/src/connectionmgr.pp
new file mode 100644
index 0000000000..6cbac398c1
--- /dev/null
+++ b/packages/palmunits/src/connectionmgr.pp
@@ -0,0 +1,571 @@
+{$INLINE ON}
+{$MACRO ON}
+
+{$define Rsc := }
+(***********************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ConnectionMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Connection Manager Interface. The Connection Manager allows
+ * other applications to access, add, and delete connection profiles
+ * contained in the Connection Panel.
+ *
+ * History:
+ * 8/19/98 ADH Initial Implementation
+ * 03/01/2000 PPL Rewrite API for New Connection Manager
+ * 03/30/2000 PPL Constant change from cncXXXX to kCncXXXX
+ * and # defining old names (cncXXXX) for compatibility.
+ * 10/19/00 PPL Update the header with GuideLines
+ * 10/20/00 PPL Remove CncProfileBroacast - The notification it sent
+ * is always in usage.
+ * 10/23/00 PPL Update Connection Manager API
+ * 11/06/2000 PPL Use the CncProfileId abstract type for profileIDs
+ *
+ ***********************************************************************)
+
+unit connectionmgr;
+
+interface
+
+uses palmos, coretraps, errorbase, datamgr, modemmgr;
+
+(***********************************************************************
+ * Definition
+ ***********************************************************************)
+
+type
+ CncProfileID = UInt32;
+
+(***********************************************************************
+ * Connection Profile Broadcasting
+ ***********************************************************************)
+
+const
+ kCncProfileNotifyCurrentVersion = 1;
+
+type
+ CncProfileNotifyDetailsTag = record
+ // In: version - This definition is version 1 (kCncProfileNotifyCurrentVersion)
+ // later versions should include all the fields of version 1 plus
+ // any additional fields of CncProfileNotifyDetailsType
+ version: UInt16;
+
+ // In: Broacasted Profile ID
+ profileID: CncProfileID;
+
+ // In: Device Kind of the profile
+ deviceKind: UInt16;
+
+ // In: Resquested Action
+ request: UInt16;
+ end;
+ CncProfileNotifyDetailsType = CncProfileNotifyDetailsTag;
+
+(***********************************************************************
+ * Constants
+ ***********************************************************************)
+const
+ kCncProfileInvalidId = CncProfileID(0);
+
+// Request's modifiers flags
+const
+ kCncNotifyBecomeCurrentModifier = $8000; // Change the Client current settings
+ kCncNotifyAlertUserModifier = $4000; // ask for Client UI
+ kNotifyRequestMofifiersMask = kCncNotifyBecomeCurrentModifier or kCncNotifyAlertUserModifier;
+
+// Requests
+ kCncNotifyCreateRequest = 1; // the profile has been created
+ kCncNotifyModifyRequest = 2; // the profile has been modified
+ kCncNotifyDeleteRequest = 3; // the profile has been deleted
+ kCncNotifyUpdateListRequest = 4; // the profile has been deleted
+
+(***********************************************************************
+ * Connection Profile ParamID Definition Macros and Constants
+ ***********************************************************************)
+
+const
+ kCncParamOSRange = $0000; // bit #15 set at 0
+ kCncParamThirdPartiesRange = $8000; // bit #15 set at 1
+
+ kCncParamFixedLength = $0000; // bit #14 set to 0
+ kCncParamVariableLength = $4000; // bit #14 set to 1
+
+ kCncParamIDMask = $07FF; // bit #0 to #10 set to 1 (11 bits)
+ kCncParamTypeMask = $7800; // bit #11 to #14 set to 1 (4 bits)
+
+// parameter type definition macros
+ kCncParamFixedLen = $00; // higth bit of 4 set to 0
+ kCncParamVariableLen = $08; // higth bit of 4 set to 1
+
+//#define CncDefineParameterType( variableBit , typeOrder) ( ( (variableBit) | (typeOrder) ) << 11)
+
+// bit number is comprised between 0 and 31
+
+// #define CncDefineSystemFlagMask(bitnum) (1 << (bitnum))
+
+const
+ kCncParamSystemFlag = (kCncParamFixedLen or 0) shl 11; // 0x0000
+ kCncParamUInt8 = (kCncParamFixedLen or 1) shl 11; // 0x0800
+ kCncParamUInt16 = (kCncParamFixedLen or 2) shl 11; // 0x1000
+ kCncParamUInt32 = (kCncParamFixedLen or 3) shl 11; // 0x1800
+// [free slot from 4 to 7]
+
+ kCncParamUInt8Size = SizeOf(UInt8);
+ kCncParamUInt16Size = SizeOf(UInt16);
+ kCncParamUInt32Size = SizeOf(UInt32);
+
+ kCncParamSystemFlagSize = kCncParamUInt8Size;
+
+ kCncParamString = (kCncParamVariableLen or 1) shl 11; // 0x4800
+ kCncParamBuffer = (kCncParamVariableLen or 2) shl 11; // 0x5000
+// [free slot from 3 to 7]
+
+// full Parameter ID definition macro
+(*
+#define CncDefineParamID(parameterRange, parameterType, parameterID) ( (parameterRange) | (parameterType) | (parameterID) )
+
+#define CncIsSystemRange(parameterID) ( ( (parameterID) & kCncParamThirdPartiesRange) != kCncParamThirdPartiesRange)
+#define CncIsThirdPartiesRange(parameterID) ( ( (parameterID) & kCncParamThirdPartiesRange ) == kCncParamThirdPartiesRange)
+
+#define CncIsFixedLengthParamType(parameterID) ( ( (parameterID) & kCncParamVariableLength) != kCncParamVariableLength )
+#define CncIsVariableLengthParamType(parameterID) ( ( (parameterID) & kCncParamVariableLength ) == kCncParamVariableLength)
+
+#define CncGetTrueParamID(parameterID) ( (parameterID) & kCncParamIDMask)
+#define CncGetParamType(parameterID) ( (parameterID) & kCncParamTypeMask)
+
+#define CncIsSystemFlags(parameterID) ( ! (CncGetParamType( (parameterID) ) ) )
+#define CncGetSystemFlagBitnum(parameterID) CncGetTrueParamID(parameterID)
+*)
+
+// Some tests
+
+(***********************************************************************
+ * Cnc Manager Feature
+ ***********************************************************************)
+
+const
+ kCncFtrCncMgrCreator = Rsc('cmgr');
+
+ kCncFtrCncMgrVersion = 0;
+ kCncMgrVersion = $00040001; // 4.0 = 4->high 0->low
+// feature index 1 and 2 are reserved
+
+(***********************************************************************
+ * Parameter size values
+ ***********************************************************************)
+
+const
+// 22 for compatibility
+ kCncProfileNameSize = 22;
+
+// 81 defined in ModemMgr.h
+ kCncProfileUsualInitStringSize = mdmCmdBufSize;
+
+// 81 defined in ModemMgr.h
+ kCncProfileClassicResetStringSize = mdmCmdSize; // Old size was 8
+ kCncProfileUsualResetStringSize = mdmCmdBufSize;
+
+(***********************************************************************
+ * Parameters values
+ ***********************************************************************)
+
+// device kinds
+ kCncDeviceKindSerial = 0;
+ kCncDeviceKindModem = 1;
+ kCncDeviceKindPhone = 2;
+ kCncDeviceKindLocalNetwork = 3;
+
+// Old flow controls
+ kCncFlowControlAuto = 0;
+ kCncFlowControlOFF = 1;
+ kCncFlowControlON = 2;
+
+ kCncProfileVersion = 4;
+
+(***********************************************************************
+ * Error Codes
+ ***********************************************************************)
+
+ kCncErrAddProfileFailed = cncErrorClass or $01; // Add profile attempt failed
+ kCncErrProfileListFull = cncErrorClass or $02; // Add attempt failed because the
+ // profile list is full.
+ kCncErrGetProfileFailed = cncErrorClass or $03; // Get profile attempt failed
+ kCncErrDBAccessFailed = cncErrorClass or $04; // Connection database not found or access failed
+ kCncErrGetProfileListFailed = cncErrorClass or $05; // Could not get profile list
+ kCncErrProfileReadOnly = cncErrorClass or $06; // The profile can not be altered
+ kCncErrProfileNotFound = cncErrorClass or $07; // The profile could not be found
+
+// New API error code
+ kCncErrProfileParamNotFound = cncErrorClass or $08; // The profile parameter could not be found
+ kCncErrProfileParamReadOnly = cncErrorClass or $09; // The profile parameter can only be read
+ kCncErrProfileParamNameHasChange = cncErrorClass or $0a; // The profile parameter Name has been modified to be unique
+ kCncErrProfileGetParamFailed = cncErrorClass or $0b; // failed to get a parameter in a profile
+ kCncErrProfileSetParamFailed = cncErrorClass or $0c; // failed to Set a parameter in a profile
+ kCncErrProfileBadParamSize = cncErrorClass or $0d; // failed to Set a parameter in a profile
+ kCncErrProfileBadSystemFlagBitnum = cncErrorClass or $0e; // the bit num of a system flag is not comprise between 0 and 31
+
+(***********************************************************************
+ * Parameters ID and Sizes
+ ***********************************************************************)
+
+const
+// void param has a size of zero bytes
+ kCncNoParam = 0;
+ kCncNoParamSize = 0;
+
+// 22 bytes limited - for compatibility
+ kCncParamName = kCncParamOSRange or kCncParamString or 1;
+ kCncParamNameMaxSize = kCncProfileNameSize;
+
+ kCncParamPort = kCncParamOSRange or kCncParamUInt32 or 2;
+ kCncParamPortSize = kCncParamUInt32Size;
+
+ kCncParamBaud = kCncParamOSRange or kCncParamUInt32 or 3;
+ kCncParamBaudSize = kCncParamUInt32Size;
+
+ kCncParamVolume = kCncParamOSRange or kCncParamUInt16 or 4;
+ kCncParamVolumeSize = kCncParamUInt16Size;
+
+ kCncParamFlowControl = kCncParamOSRange or kCncParamUInt16 or 5;
+ kCncParamFlowControlSize = kCncParamUInt16Size;
+
+// New piece of info - communication time Out (CTS)
+ kCncParamTimeOut = kCncParamOSRange or kCncParamUInt32 or 6;
+ kCncParamTimeOutSize = kCncParamUInt32Size;
+
+ kCncParamInitString = kCncParamOSRange or kCncParamString or 7;
+ kCncParamInitStringMaxSize = mdmCmdBufSize;
+
+ kCncParamResetString = kCncParamOSRange or kCncParamString or 8;
+ kCncParamResetStringMaxSize = mdmCmdBufSize;
+
+// New piece of info - extented device kind cf kCncDeviveXXX after
+ kCncParamDeviceKind = kCncParamOSRange or kCncParamUInt16 or 9;
+ kCncParamDeviceKindSize = kCncParamUInt16Size;
+
+// country index for the profile
+ kCncParamCountryIndex = kCncParamOSRange or kCncParamUInt16 or 11;
+ kCncParamCountryIndexSize = kCncParamUInt16Size;
+
+// dialing mode, old pulse param
+ kCncParamDialingMode = kCncParamOSRange or kCncParamUInt8 or 12;
+ kCncParamDialingModeSize = kCncParamUInt8Size;
+
+ kCncParamVersion = kCncParamOSRange or kCncParamUInt8 or 13;
+ kCncParamVersionSize = kCncParamUInt8Size;
+
+ kCncParamReceiveTimeOut = kCncParamOSRange or kCncParamUInt32 or 14;
+ kCncParamReceiveTimeOutSize = kCncParamUInt32Size;
+
+// International Reset string (count [strings])
+ kCncParamIntlModemResetStringList = kCncParamOSRange or kCncParamBuffer or 15;
+
+
+// International country string (count [strings])
+ kCncParamIntlModemCountryStringList = kCncParamOSRange or kCncParamBuffer or 16;
+
+// special parameters : system flags
+// the meaning of these parameters is for the connection panel
+// up to 32 flags system flag will be possible
+
+// bit numbering
+ kCncParamReadOnlyBit = 0;
+ kCncParamInvisibleBit = 1;
+ kCncParamNonEditableBit = 2;
+ kCncParamNoDetailsBit = 3;
+ kCncParamLockedBit = 4;
+ kCncParamReservedBit5 = 5;
+ kCncParamReservedBit6 = 6;
+ kCncParamReservedBit7 = 7;
+ kCncParamReservedBit8 = 8;
+ kCncParamReservedBit9 = 9;
+ kCncParamReservedBit10 = 10;
+ kCncParamReservedBit11 = 11;
+ kCncParamReservedBit12 = 12;
+ kCncParamReservedBit13 = 13;
+ kCncParamReservedBit14 = 14;
+ kCncParamReservedBit15 = 15;
+ kCncParamSystemBit16 = 16;
+ kCncParamSystemBit17 = 17;
+ kCncParamReservedBit18 = 18;
+ kCncParamReservedBit19 = 19;
+ kCncParamReservedBit20 = 20;
+ kCncParamReservedBit21 = 21;
+ kCncParamReservedBit22 = 22;
+ kCncParamReservedBit23 = 23;
+ kCncParamReservedBit24 = 24;
+ kCncParamReservedBit25 = 25;
+ kCncParamReservedBit26 = 26;
+ kCncParamReservedBit27 = 27;
+ kCncParamReservedBit28 = 28;
+ kCncParamReservedBit29 = 29;
+ kCncParamReservedBit30 = 30;
+ kCncParamReservedBit31 = 31;
+
+ kCncParamSystemFlagsNum = $07FF;
+
+// the following parameter handles the system flags as an UInt32 integer (all the flags, at once)
+ kCncParamSystemFlags = kCncParamOSRange or kCncParamSystemFlag or kCncParamSystemFlagsNum;
+ kCncParamSystemFlagsSize = kCncParamUInt32Size;
+
+// bit parameters definition : to handle flags bit per bit
+ kCncParamReadOnly = kCncParamOSRange or kCncParamSystemFlag or 0;
+
+ kCncParamReadOnlySize = kCncParamSystemFlagSize;
+
+ kCncParamInvisible = kCncParamOSRange or kCncParamSystemFlag or 1;
+ kCncParamInvisibleSize = kCncParamSystemFlagSize;
+
+ kCncParamNonEditable = kCncParamOSRange or kCncParamSystemFlag or 2;
+ kCncParamNonEditableSize = kCncParamSystemFlagSize;
+
+ kCncParamNoDetails = kCncParamOSRange or kCncParamSystemFlag or 3;
+ kCncParamNoDetailsSize = kCncParamSystemFlagSize;
+
+ kCncParamLocked = kCncParamOSRange or kCncParamSystemFlag or 4;
+ kCncParamLockedSize = kCncParamSystemFlagSize;
+
+(* Bluetooth parameter IDs - New pieces of info *)
+
+// 48 bit blue Tooth address (BD_ADDR) - This address is derived from the IEEE802 standard
+
+ kCncParamBluetoothDeviceAddr = kCncParamOSRange or kCncParamBuffer or 50;
+ kCncParamBluetoothDeviceAddrSize = 8;
+
+// Bluetooth device name - 248 bytes coded according to the UTF-8 standard at max + NULL terninaison
+ kCncParamBluetoothDeviceName = kCncParamOSRange or kCncParamString or 51;
+ kCncParamBluetoothDeviceNameMaxSize = 249;
+
+// Caution : system parameter range ID from 80 to 200 are reserved for telephony services
+// and should never be reused by any other component
+
+(***********************************************************************
+ * Telephony Manager parameter
+ ***********************************************************************)
+
+(* TT-AT specific parameters *)
+
+// New piece gathering several parts (uses the serial manager flags cf SerialMgr.h )
+ kCncParamSerialPortFlags = kCncParamOSRange or kCncParamUInt32 or 84;
+ kCncParamSerialPortFlagsSize = kCncParamUInt32Size;
+
+// Telephony Task type - mobile telephony
+ kCncParamTTType = kCncParamOSRange or kCncParamUInt32 or 90;
+ kCncParamTTTypeSize = kCncParamUInt32Size;
+
+// Telephony Task Creator - mobile telephony
+ kCncParamTTCreator = kCncParamOSRange or kCncParamUInt32 or 91;
+ kCncParamTTCreatorSize = kCncParamUInt32Size;
+
+// Phone Driver Name - mobile telephony
+ kCncParam_PSDName = kCncParamOSRange or kCncParamString or 92;
+ kCncParam_PSDNameSize = dmDBNameLength;
+
+// Phone Driver creator - mobile telephony
+ kCncParam_PSDCreator = kCncParamOSRange or kCncParamUInt32 or 93;
+ kCncParam_PSDCreatorSize = kCncParamUInt32Size;
+
+// Phone Driver type - mobile telephony
+ kCncParam_PSDType = kCncParamOSRange or kCncParamUInt32 or 94;
+ kCncParam_PSDTypeSize = kCncParamUInt32Size;
+
+// Phone Driver Param Buffer - mobile telephony
+ kCncParam_PSDParameterBuffer = kCncParamOSRange or kCncParamBuffer or 100;
+
+(***********************************************************************
+ * New Connection Manager trap selectors
+ ***********************************************************************)
+
+ sysTrapCncMgrProfileSettingGet = 1;
+ sysTrapCncMgrProfileSettingSet = 2;
+ sysTrapCncMgrProfileGetCurrent = 3;
+ sysTrapCncMgrProfileSetCurrent = 4;
+ sysTrapCncMgrProfileGetIDFromName = 5;
+ sysTrapCncMgrProfileCreate = 6;
+ sysTrapCncMgrProfileDelete = 7;
+ sysTrapCncMgrProfileGetIDFromIndex = 8;
+ sysTrapCncMgrProfileGetIndex = 9;
+ sysTrapCncMgrProfileCount = 10;
+ sysTrapCncMgrProfileOpenDB = 11;
+ sysTrapCncMgrProfileCloseDB = 12;
+
+(***********************************************************************
+ * Connection Manager Library Macros
+ ***********************************************************************)
+
+(***********************************************************************
+ * New Connection Mgr API
+ ***********************************************************************)
+
+function CncProfileSettingGet(profileId: CncProfileID; paramId: UInt16; paramBufferP: Pointer; var ioParamSizeP: UInt16): Err;
+
+function CncProfileSettingSet(iProfileId: CncProfileID; paramId: UInt16; const paramBufferP: Pointer; paramSize: UInt16): Err;
+
+function CncProfileSetCurrent(profileId: CncProfileID): Err;
+
+function CncProfileGetCurrent(var profileIdP: CncProfileID): Err;
+
+function CncProfileGetIDFromName(const profileNameP: PChar; var profileIdP: CncProfileID): Err;
+
+function CncProfileCreate(var profileIdP: CncProfileID): Err;
+
+function CncProfileDelete(profileId: CncProfileID): Err;
+
+function CncProfileGetIDFromIndex(index: UInt16; var profileIdP: CncProfileID): Err;
+
+function CncProfileGetIndex(profileId: CncProfileID; var indexP: UInt16): Err;
+
+function CncProfileCount(var profilesCountP: UInt16): Err;
+
+function CncProfileOpenDB: Err;
+
+function CncProfileCloseDB: Err;
+
+(***********************************************************************
+ * Old Connection Mgr API, For compatibility only
+ ***********************************************************************)
+
+const
+// Maximum size for a Connection Profile Name
+ cncProfileNameSize = 22;
+
+// Error Codes
+ cncErrAddProfileFailed = cncErrorClass or 1; // Add profile attempt failed
+ cncErrProfileListFull = cncErrorClass or 2; // Add attempt failed because the
+ // profile list is full.
+ cncErrGetProfileFailed = cncErrorClass or 3; // Get profile attempt failed
+ cncErrConDBNotFound = cncErrorClass or 4; // Connection database not found
+ cncErrGetProfileListFailed = cncErrorClass or 5; // Could not get profile list
+ cncErrProfileReadOnly = cncErrorClass or 6; // The profile can not be altered
+ cncErrProfileNotFound = cncErrorClass or 7; // The profile could not be found
+
+// Functions
+
+function CncGetProfileList(var nameListPPP: PCharPtr; var countP: UInt16): Err; syscall sysTrapCncGetProfileList;
+
+function CncGetProfileInfo(name: PChar; var port, baud: UInt32; var volume, handShake: UInt16;
+ initString: PChar; var resetString: Char; var isModem, isPulse: Boolean): Err; syscall sysTrapCncGetProfileInfo;
+
+function CncAddProfile(name: PChar; port, baud: UInt32; volum, handShake: UInt16;
+ const initString, resetString: PChar; isMode, isPulse: Boolean): Err; syscall sysTrapCncAddProfile;
+
+function CncDeleteProfile(const name: PChar): Err; syscall sysTrapCncDeleteProfile;
+
+implementation
+
+function __CncProfileSettingGet(profileId: CncProfileID; paramId: UInt16; paramBufferP: Pointer; var ioParamSizeP: UInt16): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileSettingSet(iProfileId: CncProfileID; paramId: UInt16; const paramBufferP: Pointer; paramSize: UInt16): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileSetCurrent(profileId: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileGetCurrent(var profileIdP: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileGetIDFromName(const profileNameP: PChar; var profileIdP: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileCreate(var profileIdP: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileDelete(profileId: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileGetIDFromIndex(index: UInt16; var profileIdP: CncProfileID): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileGetIndex(profileId: CncProfileID; var indexP: UInt16): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileCount(var profilesCountP: UInt16): Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileOpenDB: Err; syscall sysTrapCncMgrDispatch;
+function __CncProfileCloseDB: Err; syscall sysTrapCncMgrDispatch;
+
+function CncProfileSettingGet(profileId: CncProfileID; paramId: UInt16; paramBufferP: Pointer; var ioParamSizeP: UInt16): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileSettingGet, D2
+ end;
+ CncProfileSettingGet := __CncProfileSettingGet(profileId, paramId, paramBufferP, ioParamSizeP);
+end;
+
+function CncProfileSettingSet(iProfileId: CncProfileID; paramId: UInt16; const paramBufferP: Pointer; paramSize: UInt16): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileSettingSet, D2
+ end;
+ CncProfileSettingSet := __CncProfileSettingSet(iProfileId, paramId, paramBufferP, paramSize);
+end;
+
+function CncProfileSetCurrent(profileId: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileSetCurrent, D2
+ end;
+ CncProfileSetCurrent := __CncProfileSetCurrent(profileId);
+end;
+
+function CncProfileGetCurrent(var profileIdP: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileGetCurrent, D2;
+ end;
+ CncProfileGetCurrent := __CncProfileGetCurrent(profileIdP);
+end;
+
+function CncProfileGetIDFromName(const profileNameP: PChar; var profileIdP: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileGetIDFromName, D2;
+ end;
+ CncProfileGetIDFromName := __CncProfileGetIDFromName(profileNameP, profileIdP);
+end;
+
+function CncProfileCreate(var profileIdP: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileCreate, D2;
+ end;
+ CncProfileCreate := __CncProfileCreate(profileIdP);
+end;
+
+function CncProfileDelete(profileId: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileDelete, D2;
+ end;
+ CncProfileDelete := __CncProfileDelete(profileId);
+end;
+
+function CncProfileGetIDFromIndex(index: UInt16; var profileIdP: CncProfileID): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileGetIDFromIndex, D2;
+ end;
+ CncProfileGetIDFromIndex := __CncProfileGetIDFromIndex(index, profileIdP);
+end;
+
+function CncProfileGetIndex(profileId: CncProfileID; var indexP: UInt16): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileGetIndex, D2;
+ end;
+ CncProfileGetIndex := __CncProfileGetIndex(profileID, indexP);
+end;
+
+function CncProfileCount(var profilesCountP: UInt16): Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileCount, D2
+ end;
+ CncProfileCount := __CncProfileCount(profilesCountP);
+end;
+
+function CncProfileOpenDB: Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileOpenDB, D2;
+ end;
+ CncProfileOpenDB := __CncProfileOpenDB;
+end;
+
+function CncProfileCloseDB: Err;
+begin
+ asm
+ move.l #$sysTrapCncMgrProfileCloseDB, D2;
+ end;
+ CnCProfileCloseDB := __CncProfileCloseDB;
+end;
+
+end.
diff --git a/packages/palmunits/src/consolemgr.pp b/packages/palmunits/src/consolemgr.pp
new file mode 100644
index 0000000000..c1ec32c3d8
--- /dev/null
+++ b/packages/palmunits/src/consolemgr.pp
@@ -0,0 +1,38 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ConsoleMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This module implements simple text in and text out to a console
+ * application on the other end of the serial port. It talks through
+ * the Serial Link Manager and sends and receives packets of type slkPktTypeConsole.
+ *
+ * History:
+ * 10/25/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit consolemgr;
+
+interface
+
+uses palmos, coretraps;
+
+(********************************************************************
+ * Console Manager Routines
+ ********************************************************************)
+
+function ConPutS(const message: PChar): Err; syscall sysTrapConPutS;
+
+function ConGetS(message: PChar; timeout: Int32): Err; syscall sysTrapConGetS;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/control.pp b/packages/palmunits/src/control.pp
new file mode 100644
index 0000000000..2f97b5adab
--- /dev/null
+++ b/packages/palmunits/src/control.pp
@@ -0,0 +1,186 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Control.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines check box structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 Fix up const stuff
+ * bob 4/16/99 add GraphicControlType
+ *
+ *****************************************************************************)
+{$MACRO ON}
+
+unit control;
+
+interface
+
+uses palmos, coretraps, rect, datamgr, font;
+
+type
+ ControlAttrType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt8 usable :1; // set if part of ui
+ UInt8 enabled :1; // set if interactable (not grayed out)
+ UInt8 visible :1; // set if drawn (set internally)
+ UInt8 on :1; // set if on (checked)
+ UInt8 leftAnchor :1; // set if bounds expand to the right
+ // clear if bounds expand to the left
+ UInt8 frame :3;
+ UInt8 drawnAsSelected :1; // support for old-style graphic controls
+ // where control overlaps a bitmap
+ UInt8 graphical :1; // set if images are used instead of text
+ UInt8 vertical :1; // true for vertical sliders
+ UInt8 reserved :5;
+}
+{$endif}
+ end;
+ ControlAttrTag = ControlAttrType;
+
+type
+ controlStyles = Enum;
+
+const
+ buttonCtl = 0;
+ pushButtonCtl = Succ(buttonCtl);
+ checkboxCtl = Succ(pushButtonCtl);
+ popupTriggerCtl = Succ(checkboxCtl);
+ selectorTriggerCtl = Succ(popupTriggerCtl);
+ repeatingButtonCtl = Succ(selectorTriggerCtl);
+ sliderCtl = Succ(repeatingButtonCtl);
+ feedbackSliderCtl = Succ(sliderCtl);
+
+type
+ ControlStyleType = controlStyles;
+
+type
+ buttonFrames = Enum;
+
+const
+ noButtonFrame = 0;
+ standardButtonFrame = Succ(noButtonFrame);
+ boldButtonFrame = Succ(standardButtonFrame);
+ rectangleButtonFrame = Succ(boldButtonFrame);
+
+type
+ ButtonFrameType = buttonFrames;
+
+type
+ ControlType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ bounds: RectangleType;
+ text: PChar;
+ attr: ControlAttrType;
+ style: ControlStyleType;
+ font: FontID;
+ group: UInt8;
+ reserved: UInt8;
+{$endif}
+ end;
+
+ ControlPtr = ^ControlType; // deprecated, use ControlType *
+
+// GraphicControlType *'s can be cast to ControlType *'s and passed to all
+// Control API functions (as long as the 'graphical' bit in the attrs is set)
+
+ GraphicControlType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ bounds: RectangleType;
+ bitmapID: DmResID; // overlays text in ControlType
+ selectedBitmapID: DmResID; // overlays text in ControlType
+ attr: ControlAttrType;
+ style: ControlStyleType;
+ unused: FontID;
+ group: UInt8;
+ reserved: UInt8;
+{$endif}
+ end;
+ GraphicControlPtr = ^GraphicControlType;
+
+// SliderControlType *'s can be cast to ControlType *'s and passed to all
+// Control API functions (as long as the control style is a slider)
+
+ SliderControlType = record
+{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_CONTROLS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ bounds: RectangleType;
+ thumbID: DmResID; // overlays text in ControlType
+ backgroundID: DmResID; // overlays text in ControlType
+ attr: ControlAttrType; // graphical *is* set
+ style: ControlStyleType; // must be sliderCtl or repeatingSliderCtl
+ reserved: UInt8;
+ minValue: Int16;
+ maxValue: Int16;
+ pageSize: Int16;
+ value: Int16;
+ activeSliderP: MemPtr;
+{$endif}
+ end;
+ SliderControlPtr = ^SliderControlType;
+
+//----------------------------------------------------------
+// Control Functions
+//----------------------------------------------------------
+
+procedure CtlDrawControl(controlP: ControlPtr); syscall sysTrapCtlDrawControl;
+
+procedure CtlEraseControl(controlP: ControlPtr); syscall sysTrapCtlEraseControl;
+
+procedure CtlHideControl(controlP: ControlPtr); syscall sysTrapCtlHideControl;
+
+procedure CtlShowControl(controlP: ControlPtr); syscall sysTrapCtlShowControl;
+
+function CtlEnabled(const controlP: ControlPtr): Boolean; syscall sysTrapCtlEnabled;
+
+procedure CtlSetEnabled(controlP: ControlPtr; usable: Boolean); syscall sysTrapCtlSetEnabled;
+
+procedure CtlSetUsable(controlP: ControlPtr; usable: Boolean); syscall sysTrapCtlSetUsable;
+
+function CtlGetValue(const controlP: ControlPtr): Int16; syscall sysTrapCtlGetValue;
+
+procedure CtlSetValue(controlP: ControlPtr; newValue: Int16); syscall sysTrapCtlSetValue;
+
+function CtlGetLabel(const controlP: ControlPtr): PChar; syscall sysTrapCtlGetLabel;
+
+procedure CtlSetLabel(controlP: ControlPtr; const newLabel: PChar); syscall sysTrapCtlSetLabel;
+
+procedure CtlSetGraphics(ctlP: ControlPtr; newBitmapID, newSelectedBitmapID: DmResID); syscall sysTrapCtlSetGraphics;
+
+procedure CtlSetSliderValues(ctlP: ControlPtr; {const} var minValueP, maxValueP, pageSizeP, valueP: UInt16); syscall sysTrapCtlSetSliderValues;
+
+procedure CtlGetSliderValues(const ctlP: ControlPtr; var minValueP, maxValueP, pageSizeP, valueP: UInt16); syscall sysTrapCtlGetSliderValues;
+
+procedure CtlHitControl(const controlP: ControlPtr); syscall sysTrapCtlHitControl;
+
+type
+ EventPtr = Pointer;
+
+function CtlHandleEvent(controlP: ControlPtr; pEvent: EventPtr): Boolean; syscall sysTrapCtlHandleEvent;
+
+function CtlValidatePointer(const controlP: ControlPtr): Boolean; syscall sysTrapCtlValidatePointer;
+
+function CtlNewControl(formPP: PointerPtr; ID: UInt16; style: ControlStyleType; const textP: PChar;
+ x, y, width, height: Coord; font: FontID; group: UInt8; leftAnchor: Boolean): ControlPtr; syscall sysTrapCtlNewControl;
+
+function CtlNewGraphicControl(formPP: PointerPtr; ID: UInt16; style: ControlStyleType; bitmapID, selectedBitmapID: DmResID;
+ x, y, width, height: Coord; group: UInt8; leftAnchor: Boolean): GraphicControlPtr; syscall sysTrapCtlNewGraphicControl;
+
+function CtlNewSliderControl(formPP: PointerPtr; ID: UInt16; style: ControlStyleType; thumbID, backgroundID: DmResID;
+ x, y, width, height: Coord; minValue, maxValue, pageSize, value: UInt16): SliderControlPtr; syscall sysTrapCtlNewSliderControl;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/coretraps.pp b/packages/palmunits/src/coretraps.pp
new file mode 100644
index 0000000000..731440cdf0
--- /dev/null
+++ b/packages/palmunits/src/coretraps.pp
@@ -0,0 +1,1459 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: CoreTraps.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Palm OS core trap numbers
+ *
+ * History:
+ * 06/13/95 Created by Ron Marianetti
+ * 06/13/95 RM Created by Ron Marianetti
+ * ??/??/?? ??? Added Rocky changes
+ * 02/04/98 srj Added Hardware LCD Contrast Trap for Razor
+ * 05/05/98 art Reused sysTrapPsrInit, new name sysTrapIntlDispatch.
+ * 06/17/98 jhl mapped NVPrefs to FlashMgr stuff
+ * 07/03/98 kwk Added WinDrawChar, WinDrawTruncChars, and
+ * FntWidthToOffset for Instant Karma.
+ * 07/07/98 srj Added System LCD Contrast Trap for Razor
+ * 08/05/98 scl Cross-merged Razor's SysTraps with Main's
+ * 09/07/98 kwk Added SysWantEvent, EvtPeekEvent traps for
+ * Instant Karma/Razor.
+ * 09/18/98 scl Cross-merged Razor's SysTraps with Main's
+ * 10/13/98 kwk Removed EvtPeekEvent trap.
+ * 10/28/98 scl Cross-merged Razor's SysTraps with Main's
+ * 10/29/98 Bob Move FtrPtr* traps from 3.2 to 3.1
+ * 05/21/99 kwk Added TsmDispatch and OmDispatch traps.
+ * 06/30/99 CS Added DmOpenDBNoOverlay and ResLoadConstant traps.
+ * 07/01/99 kwk Added DmOpenDBWithLocale trap.
+ * 07/09/99 kwk Added HwrGetSilkscreenIID trap.
+ * 07/12/99 kwk Added SysFatalAlertInit trap.
+ * 07/15/99 kwk Added EvtGetSilkscreenAreaList trap.
+ * 07/15/99 bob Moved macros to PalmTypes.h, moved library stuff to LibTraps.h.
+ * 07/28/99 kwk Added DateTemplateToAscii trap.
+ * 09/14/99 gap Removed EvtGetTrapState.
+ * 09/14/99 jed Renamed NotifyMgr trap constants.
+ * 09/16/99 jmp Noted that old Floating Point traps are maintained for
+ * for backwards compatibility only -- i.e., FloatMgr.h now specifies
+ * the new Floating Point dispatched traps.
+ * 09/22/99 jmp Added MenuEraseMenu trap; we won't be creating any public headers
+ * for this routine in 3.5, but we needed to syscallize the routine
+ * to fix 3.5-specific issues.
+ * 11/22/00 bob Added FldSetMaxVisibleLines trap
+ *
+ *****************************************************************************)
+
+unit coretraps;
+
+interface
+
+// Regular traps start here and go up by 1's
+const
+ sysTrapBase = $A000;
+
+ sysTrapMemInit = $A000;
+ sysTrapMemInitHeapTable = $A001;
+ sysTrapMemStoreInit = $A002;
+ sysTrapMemCardFormat = $A003;
+ sysTrapMemCardInfo = $A004;
+ sysTrapMemStoreInfo = $A005;
+ sysTrapMemStoreSetInfo = $A006;
+ sysTrapMemNumHeaps = $A007;
+ sysTrapMemNumRAMHeaps = $A008;
+ sysTrapMemHeapID = $A009;
+ sysTrapMemHeapPtr = $A00A;
+ sysTrapMemHeapFreeBytes = $A00B;
+ sysTrapMemHeapSize = $A00C;
+ sysTrapMemHeapFlags = $A00D;
+ sysTrapMemHeapCompact = $A00E;
+ sysTrapMemHeapInit = $A00F;
+ sysTrapMemHeapFreeByOwnerID = $A010;
+ sysTrapMemChunkNew = $A011;
+ sysTrapMemChunkFree = $A012;
+ sysTrapMemPtrNew = $A013;
+ sysTrapMemPtrRecoverHandle = $A014;
+ sysTrapMemPtrFlags = $A015;
+ sysTrapMemPtrSize = $A016;
+ sysTrapMemPtrOwner = $A017;
+ sysTrapMemPtrHeapID = $A018;
+ sysTrapMemPtrCardNo = $A019;
+ sysTrapMemPtrToLocalID = $A01A;
+ sysTrapMemPtrSetOwner = $A01B;
+ sysTrapMemPtrResize = $A01C;
+ sysTrapMemPtrResetLock = $A01D;
+ sysTrapMemHandleNew = $A01E;
+ sysTrapMemHandleLockCount = $A01F;
+ sysTrapMemHandleToLocalID = $A020;
+ sysTrapMemHandleLock = $A021;
+ sysTrapMemHandleUnlock = $A022;
+ sysTrapMemLocalIDToGlobal = $A023;
+ sysTrapMemLocalIDKind = $A024;
+ sysTrapMemLocalIDToPtr = $A025;
+ sysTrapMemMove = $A026;
+ sysTrapMemSet = $A027;
+ sysTrapMemStoreSearch = $A028;
+ sysTrapSysReserved10Trap1 = $A029; // "Reserved" trap in Palm OS 1.0 and later (was sysTrapMemPtrDataStorage)
+
+ sysTrapMemKernelInit = $A02A;
+ sysTrapMemHandleFree = $A02B;
+ sysTrapMemHandleFlags = $A02C;
+ sysTrapMemHandleSize = $A02D;
+ sysTrapMemHandleOwner = $A02E;
+ sysTrapMemHandleHeapID = $A02F;
+ sysTrapMemHandleDataStorage = $A030;
+ sysTrapMemHandleCardNo = $A031;
+ sysTrapMemHandleSetOwner = $A032;
+ sysTrapMemHandleResize = $A033;
+ sysTrapMemHandleResetLock = $A034;
+ sysTrapMemPtrUnlock = $A035;
+ sysTrapMemLocalIDToLockedPtr = $A036;
+ sysTrapMemSetDebugMode = $A037;
+ sysTrapMemHeapScramble = $A038;
+ sysTrapMemHeapCheck = $A039;
+ sysTrapMemNumCards = $A03A;
+ sysTrapMemDebugMode = $A03B;
+ sysTrapMemSemaphoreReserve = $A03C;
+ sysTrapMemSemaphoreRelease = $A03D;
+ sysTrapMemHeapDynamic = $A03E;
+ sysTrapMemNVParams = $A03F;
+
+ sysTrapDmInit = $A040;
+ sysTrapDmCreateDatabase = $A041;
+ sysTrapDmDeleteDatabase = $A042;
+ sysTrapDmNumDatabases = $A043;
+ sysTrapDmGetDatabase = $A044;
+ sysTrapDmFindDatabase = $A045;
+ sysTrapDmDatabaseInfo = $A046;
+ sysTrapDmSetDatabaseInfo = $A047;
+ sysTrapDmDatabaseSize = $A048;
+ sysTrapDmOpenDatabase = $A049;
+ sysTrapDmCloseDatabase = $A04A;
+ sysTrapDmNextOpenDatabase = $A04B;
+ sysTrapDmOpenDatabaseInfo = $A04C;
+ sysTrapDmResetRecordStates = $A04D;
+ sysTrapDmGetLastErr = $A04E;
+ sysTrapDmNumRecords = $A04F;
+ sysTrapDmRecordInfo = $A050;
+ sysTrapDmSetRecordInfo = $A051;
+ sysTrapDmAttachRecord = $A052;
+ sysTrapDmDetachRecord = $A053;
+ sysTrapDmMoveRecord = $A054;
+ sysTrapDmNewRecord = $A055;
+ sysTrapDmRemoveRecord = $A056;
+ sysTrapDmDeleteRecord = $A057;
+ sysTrapDmArchiveRecord = $A058;
+ sysTrapDmNewHandle = $A059;
+ sysTrapDmRemoveSecretRecords = $A05A;
+ sysTrapDmQueryRecord = $A05B;
+ sysTrapDmGetRecord = $A05C;
+ sysTrapDmResizeRecord = $A05D;
+ sysTrapDmReleaseRecord = $A05E;
+ sysTrapDmGetResource = $A05F;
+ sysTrapDmGet1Resource = $A060;
+ sysTrapDmReleaseResource = $A061;
+ sysTrapDmResizeResource = $A062;
+ sysTrapDmNextOpenResDatabase = $A063;
+ sysTrapDmFindResourceType = $A064;
+ sysTrapDmFindResource = $A065;
+ sysTrapDmSearchResource = $A066;
+ sysTrapDmNumResources = $A067;
+ sysTrapDmResourceInfo = $A068;
+ sysTrapDmSetResourceInfo = $A069;
+ sysTrapDmAttachResource = $A06A;
+ sysTrapDmDetachResource = $A06B;
+ sysTrapDmNewResource = $A06C;
+ sysTrapDmRemoveResource = $A06D;
+ sysTrapDmGetResourceIndex = $A06E;
+ sysTrapDmQuickSort = $A06F;
+ sysTrapDmQueryNextInCategory = $A070;
+ sysTrapDmNumRecordsInCategory = $A071;
+ sysTrapDmPositionInCategory = $A072;
+ sysTrapDmSeekRecordInCategory = $A073;
+ sysTrapDmMoveCategory = $A074;
+ sysTrapDmOpenDatabaseByTypeCreator = $A075;
+ sysTrapDmWrite = $A076;
+ sysTrapDmStrCopy = $A077;
+ sysTrapDmGetNextDatabaseByTypeCreator = $A078;
+ sysTrapDmWriteCheck = $A079;
+ sysTrapDmMoveOpenDBContext = $A07A;
+ sysTrapDmFindRecordByID = $A07B;
+ sysTrapDmGetAppInfoID = $A07C;
+ sysTrapDmFindSortPositionV10 = $A07D;
+ sysTrapDmSet = $A07E;
+ sysTrapDmCreateDatabaseFromImage = $A07F;
+
+ sysTrapDbgSrcMessage = $A080;
+ sysTrapDbgMessage = $A081;
+ sysTrapDbgGetMessage = $A082;
+ sysTrapDbgCommSettings = $A083;
+
+ sysTrapErrDisplayFileLineMsg = $A084;
+ sysTrapErrSetJump = $A085;
+ sysTrapErrLongJump = $A086;
+ sysTrapErrThrow = $A087;
+ sysTrapErrExceptionList = $A088;
+
+ sysTrapSysBroadcastActionCode = $A089;
+ sysTrapSysUnimplemented = $A08A;
+ sysTrapSysColdBoot = $A08B;
+ sysTrapSysReset = $A08C;
+ sysTrapSysDoze = $A08D;
+ sysTrapSysAppLaunch = $A08E;
+ sysTrapSysAppStartup = $A08F;
+ sysTrapSysAppExit = $A090;
+ sysTrapSysSetA5 = $A091;
+ sysTrapSysSetTrapAddress = $A092;
+ sysTrapSysGetTrapAddress = $A093;
+ sysTrapSysTranslateKernelErr = $A094;
+ sysTrapSysSemaphoreCreate = $A095;
+ sysTrapSysSemaphoreDelete = $A096;
+ sysTrapSysSemaphoreWait = $A097;
+ sysTrapSysSemaphoreSignal = $A098;
+ sysTrapSysTimerCreate = $A099;
+ sysTrapSysTimerWrite = $A09A;
+ sysTrapSysTaskCreate = $A09B;
+ sysTrapSysTaskDelete = $A09C;
+ sysTrapSysTaskTrigger = $A09D;
+ sysTrapSysTaskID = $A09E;
+ sysTrapSysTaskUserInfoPtr = $A09F;
+ sysTrapSysTaskDelay = $A0A0;
+ sysTrapSysTaskSetTermProc = $A0A1;
+ sysTrapSysUILaunch = $A0A2;
+ sysTrapSysNewOwnerID = $A0A3;
+ sysTrapSysSemaphoreSet = $A0A4;
+ sysTrapSysDisableInts = $A0A5;
+ sysTrapSysRestoreStatus = $A0A6;
+ sysTrapSysUIAppSwitch = $A0A7;
+ sysTrapSysCurAppInfoPV20 = $A0A8;
+ sysTrapSysHandleEvent = $A0A9;
+ sysTrapSysInit = $A0AA;
+ sysTrapSysQSort = $A0AB;
+ sysTrapSysCurAppDatabase = $A0AC;
+ sysTrapSysFatalAlert = $A0AD;
+ sysTrapSysResSemaphoreCreate = $A0AE;
+ sysTrapSysResSemaphoreDelete = $A0AF;
+ sysTrapSysResSemaphoreReserve = $A0B0;
+ sysTrapSysResSemaphoreRelease = $A0B1;
+ sysTrapSysSleep = $A0B2;
+ sysTrapSysKeyboardDialogV10 = $A0B3;
+ sysTrapSysAppLauncherDialog = $A0B4;
+ sysTrapSysSetPerformance = $A0B5;
+ sysTrapSysBatteryInfoV20 = $A0B6;
+ sysTrapSysLibInstall = $A0B7;
+ sysTrapSysLibRemove = $A0B8;
+ sysTrapSysLibTblEntry = $A0B9;
+ sysTrapSysLibFind = $A0BA;
+ sysTrapSysBatteryDialog = $A0BB;
+ sysTrapSysCopyStringResource = $A0BC;
+ sysTrapSysKernelInfo = $A0BD;
+ sysTrapSysLaunchConsole = $A0BE;
+ sysTrapSysTimerDelete = $A0BF;
+ sysTrapSysSetAutoOffTime = $A0C0;
+ sysTrapSysFormPointerArrayToStrings = $A0C1;
+ sysTrapSysRandom = $A0C2;
+ sysTrapSysTaskSwitching = $A0C3;
+ sysTrapSysTimerRead = $A0C4;
+
+ sysTrapStrCopy = $A0C5;
+ sysTrapStrCat = $A0C6;
+ sysTrapStrLen = $A0C7;
+ sysTrapStrCompare = $A0C8;
+ sysTrapStrIToA = $A0C9;
+ sysTrapStrCaselessCompare = $A0CA;
+ sysTrapStrIToH = $A0CB;
+ sysTrapStrChr = $A0CC;
+ sysTrapStrStr = $A0CD;
+ sysTrapStrAToI = $A0CE;
+ sysTrapStrToLower = $A0CF;
+
+ sysTrapSerReceiveISP = $A0D0;
+
+ sysTrapSlkOpen = $A0D1;
+ sysTrapSlkClose = $A0D2;
+ sysTrapSlkOpenSocket = $A0D3;
+ sysTrapSlkCloseSocket = $A0D4;
+ sysTrapSlkSocketRefNum = $A0D5;
+ sysTrapSlkSocketSetTimeout = $A0D6;
+ sysTrapSlkFlushSocket = $A0D7;
+ sysTrapSlkSetSocketListener = $A0D8;
+ sysTrapSlkSendPacket = $A0D9;
+ sysTrapSlkReceivePacket = $A0DA;
+ sysTrapSlkSysPktDefaultResponse = $A0DB;
+ sysTrapSlkProcessRPC = $A0DC;
+
+ sysTrapConPutS = $A0DD;
+ sysTrapConGetS = $A0DE;
+
+ sysTrapFplInit = $A0DF; // Obsolete, here for compatibilty only!
+ sysTrapFplFree = $A0E0; // Obsolete, here for compatibilty only!
+ sysTrapFplFToA = $A0E1; // Obsolete, here for compatibilty only!
+ sysTrapFplAToF = $A0E2; // Obsolete, here for compatibilty only!
+ sysTrapFplBase10Info = $A0E3; // Obsolete, here for compatibilty only!
+ sysTrapFplLongToFloat = $A0E4; // Obsolete, here for compatibilty only!
+ sysTrapFplFloatToLong = $A0E5; // Obsolete, here for compatibilty only!
+ sysTrapFplFloatToULong = $A0E6; // Obsolete, here for compatibilty only!
+ sysTrapFplMul = $A0E7; // Obsolete, here for compatibilty only!
+ sysTrapFplAdd = $A0E8; // Obsolete, here for compatibilty only!
+ sysTrapFplSub = $A0E9; // Obsolete, here for compatibilty only!
+ sysTrapFplDiv = $A0EA; // Obsolete, here for compatibilty only!
+
+ sysTrapWinScreenInit = $A0EB; // was sysTrapScrInit
+ sysTrapScrCopyRectangle = $A0EC;
+ sysTrapScrDrawChars = $A0ED;
+ sysTrapScrLineRoutine = $A0EE;
+ sysTrapScrRectangleRoutine = $A0EF;
+ sysTrapScrScreenInfo = $A0F0;
+ sysTrapScrDrawNotify = $A0F1;
+ sysTrapScrSendUpdateArea = $A0F2;
+ sysTrapScrCompressScanLine = $A0F3;
+ sysTrapScrDeCompressScanLine = $A0F4;
+
+ sysTrapTimGetSeconds = $A0F5;
+ sysTrapTimSetSeconds = $A0F6;
+ sysTrapTimGetTicks = $A0F7;
+ sysTrapTimInit = $A0F8;
+ sysTrapTimSetAlarm = $A0F9;
+ sysTrapTimGetAlarm = $A0FA;
+ sysTrapTimHandleInterrupt = $A0FB;
+ sysTrapTimSecondsToDateTime = $A0FC;
+ sysTrapTimDateTimeToSeconds = $A0FD;
+ sysTrapTimAdjust = $A0FE;
+ sysTrapTimSleep = $A0FF;
+ sysTrapTimWake = $A100;
+
+ sysTrapCategoryCreateListV10 = $A101;
+ sysTrapCategoryFreeListV10 = $A102;
+ sysTrapCategoryFind = $A103;
+ sysTrapCategoryGetName = $A104;
+ sysTrapCategoryEditV10 = $A105;
+ sysTrapCategorySelectV10 = $A106;
+ sysTrapCategoryGetNext = $A107;
+ sysTrapCategorySetTriggerLabel = $A108;
+ sysTrapCategoryTruncateName = $A109;
+
+ sysTrapClipboardAddItem = $A10A;
+ sysTrapClipboardCheckIfItemExist = $A10B;
+ sysTrapClipboardGetItem = $A10C;
+
+ sysTrapCtlDrawControl = $A10D;
+ sysTrapCtlEraseControl = $A10E;
+ sysTrapCtlHideControl = $A10F;
+ sysTrapCtlShowControl = $A110;
+ sysTrapCtlGetValue = $A111;
+ sysTrapCtlSetValue = $A112;
+ sysTrapCtlGetLabel = $A113;
+ sysTrapCtlSetLabel = $A114;
+ sysTrapCtlHandleEvent = $A115;
+ sysTrapCtlHitControl = $A116;
+ sysTrapCtlSetEnabled = $A117;
+ sysTrapCtlSetUsable = $A118;
+ sysTrapCtlEnabled = $A119;
+
+ sysTrapEvtInitialize = $A11A;
+ sysTrapEvtAddEventToQueue = $A11B;
+ sysTrapEvtCopyEvent = $A11C;
+ sysTrapEvtGetEvent = $A11D;
+ sysTrapEvtGetPen = $A11E;
+ sysTrapEvtSysInit = $A11F;
+ sysTrapEvtGetSysEvent = $A120;
+ sysTrapEvtProcessSoftKeyStroke = $A121;
+ sysTrapEvtGetPenBtnList = $A122;
+ sysTrapEvtSetPenQueuePtr = $A123;
+ sysTrapEvtPenQueueSize = $A124;
+ sysTrapEvtFlushPenQueue = $A125;
+ sysTrapEvtEnqueuePenPoint = $A126;
+ sysTrapEvtDequeuePenStrokeInfo = $A127;
+ sysTrapEvtDequeuePenPoint = $A128;
+ sysTrapEvtFlushNextPenStroke = $A129;
+ sysTrapEvtSetKeyQueuePtr = $A12A;
+ sysTrapEvtKeyQueueSize = $A12B;
+ sysTrapEvtFlushKeyQueue = $A12C;
+ sysTrapEvtEnqueueKey = $A12D;
+ sysTrapEvtDequeueKeyEvent = $A12E;
+ sysTrapEvtWakeup = $A12F;
+ sysTrapEvtResetAutoOffTimer = $A130;
+ sysTrapEvtKeyQueueEmpty = $A131;
+ sysTrapEvtEnableGraffiti = $A132;
+
+ sysTrapFldCopy = $A133;
+ sysTrapFldCut = $A134;
+ sysTrapFldDrawField = $A135;
+ sysTrapFldEraseField = $A136;
+ sysTrapFldFreeMemory = $A137;
+ sysTrapFldGetBounds = $A138;
+ sysTrapFldGetTextPtr = $A139;
+ sysTrapFldGetSelection = $A13A;
+ sysTrapFldHandleEvent = $A13B;
+ sysTrapFldPaste = $A13C;
+ sysTrapFldRecalculateField = $A13D;
+ sysTrapFldSetBounds = $A13E;
+ sysTrapFldSetText = $A13F;
+ sysTrapFldGetFont = $A140;
+ sysTrapFldSetFont = $A141;
+ sysTrapFldSetSelection = $A142;
+ sysTrapFldGrabFocus = $A143;
+ sysTrapFldReleaseFocus = $A144;
+ sysTrapFldGetInsPtPosition = $A145;
+ sysTrapFldSetInsPtPosition = $A146;
+ sysTrapFldSetScrollPosition = $A147;
+ sysTrapFldGetScrollPosition = $A148;
+ sysTrapFldGetTextHeight = $A149;
+ sysTrapFldGetTextAllocatedSize = $A14A;
+ sysTrapFldGetTextLength = $A14B;
+ sysTrapFldScrollField = $A14C;
+ sysTrapFldScrollable = $A14D;
+ sysTrapFldGetVisibleLines = $A14E;
+ sysTrapFldGetAttributes = $A14F;
+ sysTrapFldSetAttributes = $A150;
+ sysTrapFldSendChangeNotification = $A151;
+ sysTrapFldCalcFieldHeight = $A152;
+ sysTrapFldGetTextHandle = $A153;
+ sysTrapFldCompactText = $A154;
+ sysTrapFldDirty = $A155;
+ sysTrapFldWordWrap = $A156;
+ sysTrapFldSetTextAllocatedSize = $A157;
+ sysTrapFldSetTextHandle = $A158;
+ sysTrapFldSetTextPtr = $A159;
+ sysTrapFldGetMaxChars = $A15A;
+ sysTrapFldSetMaxChars = $A15B;
+ sysTrapFldSetUsable = $A15C;
+ sysTrapFldInsert = $A15D;
+ sysTrapFldDelete = $A15E;
+ sysTrapFldUndo = $A15F;
+ sysTrapFldSetDirty = $A160;
+ sysTrapFldSendHeightChangeNotification = $A161;
+ sysTrapFldMakeFullyVisible = $A162;
+
+ sysTrapFntGetFont = $A163;
+ sysTrapFntSetFont = $A164;
+ sysTrapFntGetFontPtr = $A165;
+ sysTrapFntBaseLine = $A166;
+ sysTrapFntCharHeight = $A167;
+ sysTrapFntLineHeight = $A168;
+ sysTrapFntAverageCharWidth = $A169;
+ sysTrapFntCharWidth = $A16A;
+ sysTrapFntCharsWidth = $A16B;
+ sysTrapFntDescenderHeight = $A16C;
+ sysTrapFntCharsInWidth = $A16D;
+ sysTrapFntLineWidth = $A16E;
+
+ sysTrapFrmInitForm = $A16F;
+ sysTrapFrmDeleteForm = $A170;
+ sysTrapFrmDrawForm = $A171;
+ sysTrapFrmEraseForm = $A172;
+ sysTrapFrmGetActiveForm = $A173;
+ sysTrapFrmSetActiveForm = $A174;
+ sysTrapFrmGetActiveFormID = $A175;
+ sysTrapFrmGetUserModifiedState = $A176;
+ sysTrapFrmSetNotUserModified = $A177;
+ sysTrapFrmGetFocus = $A178;
+ sysTrapFrmSetFocus = $A179;
+ sysTrapFrmHandleEvent = $A17A;
+ sysTrapFrmGetFormBounds = $A17B;
+ sysTrapFrmGetWindowHandle = $A17C;
+ sysTrapFrmGetFormId = $A17D;
+ sysTrapFrmGetFormPtr = $A17E;
+ sysTrapFrmGetNumberOfObjects = $A17F;
+ sysTrapFrmGetObjectIndex = $A180;
+ sysTrapFrmGetObjectId = $A181;
+ sysTrapFrmGetObjectType = $A182;
+ sysTrapFrmGetObjectPtr = $A183;
+ sysTrapFrmHideObject = $A184;
+ sysTrapFrmShowObject = $A185;
+ sysTrapFrmGetObjectPosition = $A186;
+ sysTrapFrmSetObjectPosition = $A187;
+ sysTrapFrmGetControlValue = $A188;
+ sysTrapFrmSetControlValue = $A189;
+ sysTrapFrmGetControlGroupSelection = $A18A;
+ sysTrapFrmSetControlGroupSelection = $A18B;
+ sysTrapFrmCopyLabel = $A18C;
+ sysTrapFrmSetLabel = $A18D;
+ sysTrapFrmGetLabel = $A18E;
+ sysTrapFrmSetCategoryLabel = $A18F;
+ sysTrapFrmGetTitle = $A190;
+ sysTrapFrmSetTitle = $A191;
+ sysTrapFrmAlert = $A192;
+ sysTrapFrmDoDialog = $A193;
+ sysTrapFrmCustomAlert = $A194;
+ sysTrapFrmHelp = $A195;
+ sysTrapFrmUpdateScrollers = $A196;
+ sysTrapFrmGetFirstForm = $A197;
+ sysTrapFrmVisible = $A198;
+ sysTrapFrmGetObjectBounds = $A199;
+ sysTrapFrmCopyTitle = $A19A;
+ sysTrapFrmGotoForm = $A19B;
+ sysTrapFrmPopupForm = $A19C;
+ sysTrapFrmUpdateForm = $A19D;
+ sysTrapFrmReturnToForm = $A19E;
+ sysTrapFrmSetEventHandler = $A19F;
+ sysTrapFrmDispatchEvent = $A1A0;
+ sysTrapFrmCloseAllForms = $A1A1;
+ sysTrapFrmSaveAllForms = $A1A2;
+ sysTrapFrmGetGadgetData = $A1A3;
+ sysTrapFrmSetGadgetData = $A1A4;
+ sysTrapFrmSetCategoryTrigger = $A1A5;
+
+ sysTrapUIInitialize = $A1A6;
+ sysTrapUIReset = $A1A7;
+
+ sysTrapInsPtInitialize = $A1A8;
+ sysTrapInsPtSetLocation = $A1A9;
+ sysTrapInsPtGetLocation = $A1AA;
+ sysTrapInsPtEnable = $A1AB;
+ sysTrapInsPtEnabled = $A1AC;
+ sysTrapInsPtSetHeight = $A1AD;
+ sysTrapInsPtGetHeight = $A1AE;
+ sysTrapInsPtCheckBlink = $A1AF;
+
+ sysTrapLstSetDrawFunction = $A1B0;
+ sysTrapLstDrawList = $A1B1;
+ sysTrapLstEraseList = $A1B2;
+ sysTrapLstGetSelection = $A1B3;
+ sysTrapLstGetSelectionText = $A1B4;
+ sysTrapLstHandleEvent = $A1B5;
+ sysTrapLstSetHeight = $A1B6;
+ sysTrapLstSetSelection = $A1B7;
+ sysTrapLstSetListChoices = $A1B8;
+ sysTrapLstMakeItemVisible = $A1B9;
+ sysTrapLstGetNumberOfItems = $A1BA;
+ sysTrapLstPopupList = $A1BB;
+ sysTrapLstSetPosition = $A1BC;
+
+ sysTrapMenuInit = $A1BD;
+ sysTrapMenuDispose = $A1BE;
+ sysTrapMenuHandleEvent = $A1BF;
+ sysTrapMenuDrawMenu = $A1C0;
+ sysTrapMenuEraseStatus = $A1C1;
+ sysTrapMenuGetActiveMenu = $A1C2;
+ sysTrapMenuSetActiveMenu = $A1C3;
+
+ sysTrapRctSetRectangle = $A1C4;
+ sysTrapRctCopyRectangle = $A1C5;
+ sysTrapRctInsetRectangle = $A1C6;
+ sysTrapRctOffsetRectangle = $A1C7;
+ sysTrapRctPtInRectangle = $A1C8;
+ sysTrapRctGetIntersection = $A1C9;
+
+ sysTrapTblDrawTable = $A1CA;
+ sysTrapTblEraseTable = $A1CB;
+ sysTrapTblHandleEvent = $A1CC;
+ sysTrapTblGetItemBounds = $A1CD;
+ sysTrapTblSelectItem = $A1CE;
+ sysTrapTblGetItemInt = $A1CF;
+ sysTrapTblSetItemInt = $A1D0;
+ sysTrapTblSetItemStyle = $A1D1;
+ sysTrapTblUnhighlightSelection = $A1D2;
+ sysTrapTblSetRowUsable = $A1D3;
+ sysTrapTblGetNumberOfRows = $A1D4;
+ sysTrapTblSetCustomDrawProcedure = $A1D5;
+ sysTrapTblSetRowSelectable = $A1D6;
+ sysTrapTblRowSelectable = $A1D7;
+ sysTrapTblSetLoadDataProcedure = $A1D8;
+ sysTrapTblSetSaveDataProcedure = $A1D9;
+ sysTrapTblGetBounds = $A1DA;
+ sysTrapTblSetRowHeight = $A1DB;
+ sysTrapTblGetColumnWidth = $A1DC;
+ sysTrapTblGetRowID = $A1DD;
+ sysTrapTblSetRowID = $A1DE;
+ sysTrapTblMarkRowInvalid = $A1DF;
+ sysTrapTblMarkTableInvalid = $A1E0;
+ sysTrapTblGetSelection = $A1E1;
+ sysTrapTblInsertRow = $A1E2;
+ sysTrapTblRemoveRow = $A1E3;
+ sysTrapTblRowInvalid = $A1E4;
+ sysTrapTblRedrawTable = $A1E5;
+ sysTrapTblRowUsable = $A1E6;
+ sysTrapTblReleaseFocus = $A1E7;
+ sysTrapTblEditing = $A1E8;
+ sysTrapTblGetCurrentField = $A1E9;
+ sysTrapTblSetColumnUsable = $A1EA;
+ sysTrapTblGetRowHeight = $A1EB;
+ sysTrapTblSetColumnWidth = $A1EC;
+ sysTrapTblGrabFocus = $A1ED;
+ sysTrapTblSetItemPtr = $A1EE;
+ sysTrapTblFindRowID = $A1EF;
+ sysTrapTblGetLastUsableRow = $A1F0;
+ sysTrapTblGetColumnSpacing = $A1F1;
+ sysTrapTblFindRowData = $A1F2;
+ sysTrapTblGetRowData = $A1F3;
+ sysTrapTblSetRowData = $A1F4;
+ sysTrapTblSetColumnSpacing = $A1F5;
+
+ sysTrapWinCreateWindow = $A1F6;
+ sysTrapWinCreateOffscreenWindow = $A1F7;
+ sysTrapWinDeleteWindow = $A1F8;
+ sysTrapWinInitializeWindow = $A1F9;
+ sysTrapWinAddWindow = $A1FA;
+ sysTrapWinRemoveWindow = $A1FB;
+ sysTrapWinSetActiveWindow = $A1FC;
+ sysTrapWinSetDrawWindow = $A1FD;
+ sysTrapWinGetDrawWindow = $A1FE;
+ sysTrapWinGetActiveWindow = $A1FF;
+ sysTrapWinGetDisplayWindow = $A200;
+ sysTrapWinGetFirstWindow = $A201;
+ sysTrapWinEnableWindow = $A202;
+ sysTrapWinDisableWindow = $A203;
+ sysTrapWinGetWindowFrameRect = $A204;
+ sysTrapWinDrawWindowFrame = $A205;
+ sysTrapWinEraseWindow = $A206;
+ sysTrapWinSaveBits = $A207;
+ sysTrapWinRestoreBits = $A208;
+ sysTrapWinCopyRectangle = $A209;
+ sysTrapWinScrollRectangle = $A20A;
+ sysTrapWinGetDisplayExtent = $A20B;
+ sysTrapWinGetWindowExtent = $A20C;
+ sysTrapWinDisplayToWindowPt = $A20D;
+ sysTrapWinWindowToDisplayPt = $A20E;
+ sysTrapWinGetClip = $A20F;
+ sysTrapWinSetClip = $A210;
+ sysTrapWinResetClip = $A211;
+ sysTrapWinClipRectangle = $A212;
+ sysTrapWinDrawLine = $A213;
+ sysTrapWinDrawGrayLine = $A214;
+ sysTrapWinEraseLine = $A215;
+ sysTrapWinInvertLine = $A216;
+ sysTrapWinFillLine = $A217;
+ sysTrapWinDrawRectangle = $A218;
+ sysTrapWinEraseRectangle = $A219;
+ sysTrapWinInvertRectangle = $A21A;
+ sysTrapWinDrawRectangleFrame = $A21B;
+ sysTrapWinDrawGrayRectangleFrame = $A21C;
+ sysTrapWinEraseRectangleFrame = $A21D;
+ sysTrapWinInvertRectangleFrame = $A21E;
+ sysTrapWinGetFramesRectangle = $A21F;
+ sysTrapWinDrawChars = $A220;
+ sysTrapWinEraseChars = $A221;
+ sysTrapWinInvertChars = $A222;
+ sysTrapWinGetPattern = $A223;
+ sysTrapWinSetPattern = $A224;
+ sysTrapWinSetUnderlineMode = $A225;
+ sysTrapWinDrawBitmap = $A226;
+ sysTrapWinModal = $A227;
+ sysTrapWinGetDrawWindowBounds = $A228;
+ sysTrapWinFillRectangle = $A229;
+ sysTrapWinDrawInvertedChars = $A22A;
+
+ sysTrapPrefOpenPreferenceDBV10 = $A22B;
+ sysTrapPrefGetPreferences = $A22C;
+ sysTrapPrefSetPreferences = $A22D;
+ sysTrapPrefGetAppPreferencesV10 = $A22E;
+ sysTrapPrefSetAppPreferencesV10 = $A22F;
+
+ sysTrapSndInit = $A230;
+ sysTrapSndSetDefaultVolume = $A231;
+ sysTrapSndGetDefaultVolume = $A232;
+ sysTrapSndDoCmd = $A233;
+ sysTrapSndPlaySystemSound = $A234;
+
+ sysTrapAlmInit = $A235;
+ sysTrapAlmCancelAll = $A236;
+ sysTrapAlmAlarmCallback = $A237;
+ sysTrapAlmSetAlarm = $A238;
+ sysTrapAlmGetAlarm = $A239;
+ sysTrapAlmDisplayAlarm = $A23A;
+ sysTrapAlmEnableNotification = $A23B;
+
+ sysTrapHwrGetRAMMapping = $A23C;
+ sysTrapHwrMemWritable = $A23D;
+ sysTrapHwrMemReadable = $A23E;
+ sysTrapHwrDoze = $A23F;
+ sysTrapHwrSleep = $A240;
+ sysTrapHwrWake = $A241;
+ sysTrapHwrSetSystemClock = $A242;
+ sysTrapHwrSetCPUDutyCycle = $A243;
+ sysTrapHwrDisplayInit = $A244; // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDInit
+ sysTrapHwrDisplaySleep = $A245; // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDSleep
+ sysTrapHwrTimerInit = $A246;
+ sysTrapHwrCursorV33 = $A247; // This trap obsoleted for OS 3.5 and later
+ sysTrapHwrBatteryLevel = $A248;
+ sysTrapHwrDelay = $A249;
+ sysTrapHwrEnableDataWrites = $A24A;
+ sysTrapHwrDisableDataWrites = $A24B;
+ sysTrapHwrLCDBaseAddrV33 = $A24C; // This trap obsoleted for OS 3.5 and later
+ sysTrapHwrDisplayDrawBootScreen = $A24D; // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDDrawBitmap
+ sysTrapHwrTimerSleep = $A24E;
+ sysTrapHwrTimerWake = $A24F;
+ sysTrapHwrDisplayWake = $A250; // Before OS 3.5, this trap a.k.a. sysTrapHwrLCDWake
+ sysTrapHwrIRQ1Handler = $A251;
+ sysTrapHwrIRQ2Handler = $A252;
+ sysTrapHwrIRQ3Handler = $A253;
+ sysTrapHwrIRQ4Handler = $A254;
+ sysTrapHwrIRQ5Handler = $A255;
+ sysTrapHwrIRQ6Handler = $A256;
+ sysTrapHwrDockSignals = $A257;
+ sysTrapHwrPluggedIn = $A258;
+
+ sysTrapCrc16CalcBlock = $A259;
+
+ sysTrapSelectDayV10 = $A25A;
+ sysTrapSelectTimeV33 = $A25B;
+
+ sysTrapDayDrawDaySelector = $A25C;
+ sysTrapDayHandleEvent = $A25D;
+ sysTrapDayDrawDays = $A25E;
+ sysTrapDayOfWeek = $A25F;
+ sysTrapDaysInMonth = $A260;
+ sysTrapDayOfMonth = $A261;
+
+ sysTrapDateDaysToDate = $A262;
+ sysTrapDateToDays = $A263;
+ sysTrapDateAdjust = $A264;
+ sysTrapDateSecondsToDate = $A265;
+ sysTrapDateToAscii = $A266;
+ sysTrapDateToDOWDMFormat = $A267;
+ sysTrapTimeToAscii = $A268;
+
+ sysTrapFind = $A269;
+ sysTrapFindStrInStr = $A26A;
+ sysTrapFindSaveMatch = $A26B;
+ sysTrapFindGetLineBounds = $A26C;
+ sysTrapFindDrawHeader = $A26D;
+
+ sysTrapPenOpen = $A26E;
+ sysTrapPenClose = $A26F;
+ sysTrapPenGetRawPen = $A270;
+ sysTrapPenCalibrate = $A271;
+ sysTrapPenRawToScreen = $A272;
+ sysTrapPenScreenToRaw = $A273;
+ sysTrapPenResetCalibration = $A274;
+ sysTrapPenSleep = $A275;
+ sysTrapPenWake = $A276;
+
+ sysTrapResLoadForm = $A277;
+ sysTrapResLoadMenu = $A278;
+
+ sysTrapFtrInit = $A279;
+ sysTrapFtrUnregister = $A27A;
+ sysTrapFtrGet = $A27B;
+ sysTrapFtrSet = $A27C;
+ sysTrapFtrGetByIndex = $A27D;
+
+ sysTrapGrfInit = $A27E;
+ sysTrapGrfFree = $A27F;
+ sysTrapGrfGetState = $A280;
+ sysTrapGrfSetState = $A281;
+ sysTrapGrfFlushPoints = $A282;
+ sysTrapGrfAddPoint = $A283;
+ sysTrapGrfInitState = $A284;
+ sysTrapGrfCleanState = $A285;
+ sysTrapGrfMatch = $A286;
+ sysTrapGrfGetMacro = $A287;
+ sysTrapGrfFilterPoints = $A288;
+ sysTrapGrfGetNumPoints = $A289;
+ sysTrapGrfGetPoint = $A28A;
+ sysTrapGrfFindBranch = $A28B;
+ sysTrapGrfMatchGlyph = $A28C;
+ sysTrapGrfGetGlyphMapping = $A28D;
+ sysTrapGrfGetMacroName = $A28E;
+ sysTrapGrfDeleteMacro = $A28F;
+ sysTrapGrfAddMacro = $A290;
+ sysTrapGrfGetAndExpandMacro = $A291;
+ sysTrapGrfProcessStroke = $A292;
+ sysTrapGrfFieldChange = $A293;
+
+ sysTrapGetCharSortValue = $A294;
+ sysTrapGetCharAttr = $A295;
+ sysTrapGetCharCaselessValue = $A296;
+
+ sysTrapPwdExists = $A297;
+ sysTrapPwdVerify = $A298;
+ sysTrapPwdSet = $A299;
+ sysTrapPwdRemove = $A29A;
+
+ sysTrapGsiInitialize = $A29B;
+ sysTrapGsiSetLocation = $A29C;
+ sysTrapGsiEnable = $A29D;
+ sysTrapGsiEnabled = $A29E;
+ sysTrapGsiSetShiftState = $A29F;
+
+ sysTrapKeyInit = $A2A0;
+ sysTrapKeyHandleInterrupt = $A2A1;
+ sysTrapKeyCurrentState = $A2A2;
+ sysTrapKeyResetDoubleTap = $A2A3;
+ sysTrapKeyRates = $A2A4;
+ sysTrapKeySleep = $A2A5;
+ sysTrapKeyWake = $A2A6;
+
+ sysTrapDlkControl = $A2A7; // was sysTrapCmBroadcast
+
+ sysTrapDlkStartServer = $A2A8;
+ sysTrapDlkGetSyncInfo = $A2A9;
+ sysTrapDlkSetLogEntry = $A2AA;
+
+ sysTrapIntlDispatch = $A2AB; // REUSED IN v3.1 (was sysTrapPsrInit in 1.0, removed in 2.0)
+ sysTrapSysLibLoad = $A2AC; // REUSED IN v2.0 (was sysTrapPsrClose)
+ sysTrapSndPlaySmf = $A2AD; // REUSED IN v3.0 (was sysTrapPsrGetCommand in 1.0, removed in 2.0)
+ sysTrapSndCreateMidiList = $A2AE; // REUSED IN v3.0 (was sysTrapPsrSendReply in 1.0, removed in 2.0)
+
+ sysTrapAbtShowAbout = $A2AF;
+
+ sysTrapMdmDial = $A2B0;
+ sysTrapMdmHangUp = $A2B1;
+
+ sysTrapDmSearchRecord = $A2B2;
+
+ sysTrapSysInsertionSort = $A2B3;
+ sysTrapDmInsertionSort = $A2B4;
+
+ sysTrapLstSetTopItem = $A2B5;
+
+// Palm OS 2.X traps Palm Pilot and 2.0 Upgrade Card
+
+ sysTrapSclSetScrollBar = $A2B6;
+ sysTrapSclDrawScrollBar = $A2B7;
+ sysTrapSclHandleEvent = $A2B8;
+
+ sysTrapSysMailboxCreate = $A2B9;
+ sysTrapSysMailboxDelete = $A2BA;
+ sysTrapSysMailboxFlush = $A2BB;
+ sysTrapSysMailboxSend = $A2BC;
+ sysTrapSysMailboxWait = $A2BD;
+
+ sysTrapSysTaskWait = $A2BE;
+ sysTrapSysTaskWake = $A2BF;
+ sysTrapSysTaskWaitClr = $A2C0;
+ sysTrapSysTaskSuspend = $A2C1;
+ sysTrapSysTaskResume = $A2C2;
+
+ sysTrapCategoryCreateList = $A2C3;
+ sysTrapCategoryFreeList = $A2C4;
+ sysTrapCategoryEditV20 = $A2C5;
+ sysTrapCategorySelect = $A2C6;
+
+ sysTrapDmDeleteCategory = $A2C7;
+
+ sysTrapSysEvGroupCreate = $A2C8;
+ sysTrapSysEvGroupSignal = $A2C9;
+ sysTrapSysEvGroupRead = $A2CA;
+ sysTrapSysEvGroupWait = $A2CB;
+
+ sysTrapEvtEventAvail = $A2CC;
+ sysTrapEvtSysEventAvail = $A2CD;
+ sysTrapStrNCopy = $A2CE;
+
+ sysTrapKeySetMask = $A2CF;
+
+ sysTrapSelectDay = $A2D0;
+
+ sysTrapPrefGetPreference = $A2D1;
+ sysTrapPrefSetPreference = $A2D2;
+ sysTrapPrefGetAppPreferences = $A2D3;
+ sysTrapPrefSetAppPreferences = $A2D4;
+
+ sysTrapFrmPointInTitle = $A2D5;
+
+ sysTrapStrNCat = $A2D6;
+
+ sysTrapMemCmp = $A2D7;
+
+ sysTrapTblSetColumnEditIndicator = $A2D8;
+
+ sysTrapFntWordWrap = $A2D9;
+
+ sysTrapFldGetScrollValues = $A2DA;
+
+ sysTrapSysCreateDataBaseList = $A2DB;
+ sysTrapSysCreatePanelList = $A2DC;
+
+ sysTrapDlkDispatchRequest = $A2DD;
+
+ sysTrapStrPrintF = $A2DE;
+ sysTrapStrVPrintF = $A2DF;
+
+ sysTrapPrefOpenPreferenceDB = $A2E0;
+
+ sysTrapSysGraffitiReferenceDialog = $A2E1;
+
+ sysTrapSysKeyboardDialog = $A2E2;
+
+ sysTrapFntWordWrapReverseNLines = $A2E3;
+ sysTrapFntGetScrollValues = $A2E4;
+
+ sysTrapTblSetRowStaticHeight = $A2E5;
+ sysTrapTblHasScrollBar = $A2E6;
+
+ sysTrapSclGetScrollBar = $A2E7;
+
+ sysTrapFldGetNumberOfBlankLines = $A2E8;
+
+ sysTrapSysTicksPerSecond = $A2E9;
+ sysTrapHwrBacklightV33 = $A2EA; // This trap obsoleted for OS 3.5 and later
+ sysTrapDmDatabaseProtect = $A2EB;
+
+ sysTrapTblSetBounds = $A2EC;
+
+ sysTrapStrNCompare = $A2ED;
+ sysTrapStrNCaselessCompare = $A2EE;
+
+ sysTrapPhoneNumberLookup = $A2EF;
+
+ sysTrapFrmSetMenu = $A2F0;
+
+ sysTrapEncDigestMD5 = $A2F1;
+
+ sysTrapDmFindSortPosition = $A2F2;
+
+ sysTrapSysBinarySearch = $A2F3;
+ sysTrapSysErrString = $A2F4;
+ sysTrapSysStringByIndex = $A2F5;
+
+ sysTrapEvtAddUniqueEventToQueue = $A2F6;
+
+ sysTrapStrLocalizeNumber = $A2F7;
+ sysTrapStrDelocalizeNumber = $A2F8;
+ sysTrapLocGetNumberSeparators = $A2F9;
+
+ sysTrapMenuSetActiveMenuRscID = $A2FA;
+
+ sysTrapLstScrollList = $A2FB;
+
+ sysTrapCategoryInitialize = $A2FC;
+
+ sysTrapEncDigestMD4 = $A2FD;
+ sysTrapEncDES = $A2FE;
+
+ sysTrapLstGetVisibleItems = $A2FF;
+
+ sysTrapWinSetBounds = $A300;
+
+ sysTrapCategorySetName = $A301;
+
+ sysTrapFldSetInsertionPoint = $A302;
+
+ sysTrapFrmSetObjectBounds = $A303;
+
+ sysTrapWinSetColors = $A304;
+
+ sysTrapFlpDispatch = $A305;
+ sysTrapFlpEmDispatch = $A306;
+
+// Palm OS 3.0 traps Palm III and 3.0 Upgrade Card
+
+ sysTrapExgInit = $A307;
+ sysTrapExgConnect = $A308;
+ sysTrapExgPut = $A309;
+ sysTrapExgGet = $A30A;
+ sysTrapExgAccept = $A30B;
+ sysTrapExgDisconnect = $A30C;
+ sysTrapExgSend = $A30D;
+ sysTrapExgReceive = $A30E;
+ sysTrapExgRegisterData = $A30F;
+ sysTrapExgNotifyReceiveV35 = $A310;
+ sysTrapSysReserved30Trap2 = $A311; // "Reserved" trap in Palm OS 3.0 and later (was sysTrapExgControl)
+ sysTrapPrgStartDialogV31 = $A312; // Updated in v3.2
+ sysTrapPrgStopDialog = $A313;
+ sysTrapPrgUpdateDialog = $A314;
+ sysTrapPrgHandleEvent = $A315;
+
+ sysTrapImcReadFieldNoSemicolon = $A316;
+ sysTrapImcReadFieldQuotablePrintable = $A317;
+ sysTrapImcReadPropertyParameter = $A318;
+ sysTrapImcSkipAllPropertyParameters = $A319;
+ sysTrapImcReadWhiteSpace = $A31A;
+ sysTrapImcWriteQuotedPrintable = $A31B;
+ sysTrapImcWriteNoSemicolon = $A31C;
+ sysTrapImcStringIsAscii = $A31D;
+
+ sysTrapTblGetItemFont = $A31E;
+ sysTrapTblSetItemFont = $A31F;
+
+ sysTrapFontSelect = $A320;
+ sysTrapFntDefineFont = $A321;
+
+ sysTrapCategoryEdit = $A322;
+
+ sysTrapSysGetOSVersionString = $A323;
+ sysTrapSysBatteryInfo = $A324;
+ sysTrapSysUIBusy = $A325;
+
+ sysTrapWinValidateHandle = $A326;
+ sysTrapFrmValidatePtr = $A327;
+ sysTrapCtlValidatePointer = $A328;
+ sysTrapWinMoveWindowAddr = $A329;
+ sysTrapFrmAddSpaceForObject = $A32A;
+ sysTrapFrmNewForm = $A32B;
+ sysTrapCtlNewControl = $A32C;
+ sysTrapFldNewField = $A32D;
+ sysTrapLstNewList = $A32E;
+ sysTrapFrmNewLabel = $A32F;
+ sysTrapFrmNewBitmap = $A330;
+ sysTrapFrmNewGadget = $A331;
+
+ sysTrapFileOpen = $A332;
+ sysTrapFileClose = $A333;
+ sysTrapFileDelete = $A334;
+ sysTrapFileReadLow = $A335;
+ sysTrapFileWrite = $A336;
+ sysTrapFileSeek = $A337;
+ sysTrapFileTell = $A338;
+ sysTrapFileTruncate = $A339;
+ sysTrapFileControl = $A33A;
+
+ sysTrapFrmActiveState = $A33B;
+
+ sysTrapSysGetAppInfo = $A33C;
+ sysTrapSysGetStackInfo = $A33D;
+
+ sysTrapWinScreenMode = $A33E; // was sysTrapScrDisplayMode
+ sysTrapHwrLCDGetDepthV33 = $A33F; // This trap obsoleted for OS 3.5 and later
+ sysTrapHwrGetROMToken = $A340;
+
+ sysTrapDbgControl = $A341;
+
+ sysTrapExgDBRead = $A342;
+ sysTrapExgDBWrite = $A343;
+
+ sysTrapHostControl = $A344; // Renamed from sysTrapSysGremlins, functionality generalized
+ sysTrapFrmRemoveObject = $A345;
+
+ sysTrapSysReserved30Trap1 = $A346; // "Reserved" trap in Palm OS 3.0 and later (was sysTrapSysReserved1)
+
+// NOTE: The following two traps are reserved for future mgrs
+// that may or may not be present on any particular device.
+// They are NOT present by default; code must check first!
+ sysTrapExpansionDispatch = $A347; // Reserved for ExpansionMgr (was sysTrapSysReserved2)
+ sysTrapFileSystemDispatch = $A348; // Reserved for FileSystemMgr (was sysTrapSysReserved3)
+
+ sysTrapOEMDispatch = $A349; // OEM trap in Palm OS 3.0 and later trap table (formerly sysTrapSysReserved4)
+
+// Palm OS 3.1 traps Palm IIIx and Palm V
+
+ sysTrapHwrLCDContrastV33 = $A34A; // This trap obsoleted for OS 3.5 and later
+ sysTrapSysLCDContrast = $A34B;
+ sysTrapUIContrastAdjust = $A34C; // Renamed from sysTrapContrastAdjust
+ sysTrapHwrDockStatus = $A34D;
+
+ sysTrapFntWidthToOffset = $A34E;
+ sysTrapSelectOneTime = $A34F;
+ sysTrapWinDrawChar = $A350;
+ sysTrapWinDrawTruncChars = $A351;
+
+ sysTrapSysNotifyInit = $A352; // Notification Manager traps
+ sysTrapSysNotifyRegister = $A353;
+ sysTrapSysNotifyUnregister = $A354;
+ sysTrapSysNotifyBroadcast = $A355;
+ sysTrapSysNotifyBroadcastDeferred = $A356;
+ sysTrapSysNotifyDatabaseAdded = $A357;
+ sysTrapSysNotifyDatabaseRemoved = $A358;
+
+ sysTrapSysWantEvent = $A359;
+
+ sysTrapFtrPtrNew = $A35A;
+ sysTrapFtrPtrFree = $A35B;
+ sysTrapFtrPtrResize = $A35C;
+
+ sysTrapSysReserved31Trap1 = $A35D; // "Reserved" trap in Palm OS 3.1 and later (was sysTrapSysReserved5)
+
+// Palm OS 3.2 & 3.3 traps Palm VII (3.2) and Fall '99 Palm OS Flash Update (3.3)
+
+ sysTrapHwrNVPrefSet = $A35E; // mapped to FlashParmsWrite
+ sysTrapHwrNVPrefGet = $A35F; // mapped to FlashParmsRead
+ sysTrapFlashInit = $A360;
+ sysTrapFlashCompress = $A361;
+ sysTrapFlashErase = $A362;
+ sysTrapFlashProgram = $A363;
+
+ sysTrapAlmTimeChange = $A364;
+ sysTrapErrAlertCustom = $A365;
+ sysTrapPrgStartDialog = $A366; // New version of sysTrapPrgStartDialogV31
+
+ sysTrapSerialDispatch = $A367;
+ sysTrapHwrBattery = $A368;
+ sysTrapDmGetDatabaseLockState = $A369;
+
+ sysTrapCncGetProfileList = $A36A;
+ sysTrapCncGetProfileInfo = $A36B;
+ sysTrapCncAddProfile = $A36C;
+ sysTrapCncDeleteProfile = $A36D;
+
+ sysTrapSndPlaySmfResource = $A36E;
+
+ sysTrapMemPtrDataStorage = $A36F; // Never actually installed until now.
+
+ sysTrapClipboardAppendItem = $A370;
+
+ sysTrapWiCmdV32 = $A371; // Code moved to INetLib; trap obsolete
+
+ // Palm OS 3.5 traps Palm IIIc and other products
+
+// HAL Display-layer new traps
+ sysTrapHwrDisplayAttributes = $A372;
+ sysTrapHwrDisplayDoze = $A373;
+ sysTrapHwrDisplayPalette = $A374;
+
+// Screen driver new traps
+ sysTrapBltFindIndexes = $A375;
+ sysTrapBmpGetBits = $A376; // was BltGetBitsAddr
+ sysTrapBltCopyRectangle = $A377;
+ sysTrapBltDrawChars = $A378;
+ sysTrapBltLineRoutine = $A379;
+ sysTrapBltRectangleRoutine = $A37A;
+
+// ScrUtils new traps
+ sysTrapScrCompress = $A37B;
+ sysTrapScrDecompress = $A37C;
+
+// System Manager new traps
+ sysTrapSysLCDBrightness = $A37D;
+
+// WindowColor new traps
+ sysTrapWinPaintChar = $A37E;
+ sysTrapWinPaintChars = $A37F;
+ sysTrapWinPaintBitmap = $A380;
+ sysTrapWinGetPixel = $A381;
+ sysTrapWinPaintPixel = $A382;
+ sysTrapWinDrawPixel = $A383;
+ sysTrapWinErasePixel = $A384;
+ sysTrapWinInvertPixel = $A385;
+ sysTrapWinPaintPixels = $A386;
+ sysTrapWinPaintLines = $A387;
+ sysTrapWinPaintLine = $A388;
+ sysTrapWinPaintRectangle = $A389;
+ sysTrapWinPaintRectangleFrame = $A38A;
+ sysTrapWinPaintPolygon = $A38B;
+ sysTrapWinDrawPolygon = $A38C;
+ sysTrapWinErasePolygon = $A38D;
+ sysTrapWinInvertPolygon = $A38E;
+ sysTrapWinFillPolygon = $A38F;
+ sysTrapWinPaintArc = $A390;
+ sysTrapWinDrawArc = $A391;
+ sysTrapWinEraseArc = $A392;
+ sysTrapWinInvertArc = $A393;
+ sysTrapWinFillArc = $A394;
+ sysTrapWinPushDrawState = $A395;
+ sysTrapWinPopDrawState = $A396;
+ sysTrapWinSetDrawMode = $A397;
+ sysTrapWinSetForeColor = $A398;
+ sysTrapWinSetBackColor = $A399;
+ sysTrapWinSetTextColor = $A39A;
+ sysTrapWinGetPatternType = $A39B;
+ sysTrapWinSetPatternType = $A39C;
+ sysTrapWinPalette = $A39D;
+ sysTrapWinRGBToIndex = $A39E;
+ sysTrapWinIndexToRGB = $A39F;
+ sysTrapWinScreenLock = $A3A0;
+ sysTrapWinScreenUnlock = $A3A1;
+ sysTrapWinGetBitmap = $A3A2;
+
+// UIColor new traps
+ sysTrapUIColorInit = $A3A3;
+ sysTrapUIColorGetTableEntryIndex = $A3A4;
+ sysTrapUIColorGetTableEntryRGB = $A3A5;
+ sysTrapUIColorSetTableEntry = $A3A6;
+ sysTrapUIColorPushTable = $A3A7;
+ sysTrapUIColorPopTable = $A3A8;
+
+// misc cleanup and API additions
+
+ sysTrapCtlNewGraphicControl = $A3A9;
+
+ sysTrapTblGetItemPtr = $A3AA;
+
+ sysTrapUIBrightnessAdjust = $A3AB;
+ sysTrapUIPickColor = $A3AC;
+
+ sysTrapEvtSetAutoOffTimer = $A3AD;
+
+// Misc int'l/overlay support.
+ sysTrapTsmDispatch = $A3AE;
+ sysTrapOmDispatch = $A3AF;
+ sysTrapDmOpenDBNoOverlay = $A3B0;
+ sysTrapDmOpenDBWithLocale = $A3B1;
+ sysTrapResLoadConstant = $A3B2;
+
+// new boot-time SmallROM HAL additions
+ sysTrapHwrPreDebugInit = $A3B3;
+ sysTrapHwrResetNMI = $A3B4;
+ sysTrapHwrResetPWM = $A3B5;
+
+ sysTrapKeyBootKeys = $A3B6;
+
+ sysTrapDbgSerDrvOpen = $A3B7;
+ sysTrapDbgSerDrvClose = $A3B8;
+ sysTrapDbgSerDrvControl = $A3B9;
+ sysTrapDbgSerDrvStatus = $A3BA;
+ sysTrapDbgSerDrvWriteChar = $A3BB;
+ sysTrapDbgSerDrvReadChar = $A3BC;
+
+// new boot-time BigROM HAL additions
+ sysTrapHwrPostDebugInit = $A3BD;
+ sysTrapHwrIdentifyFeatures = $A3BE;
+ sysTrapHwrModelSpecificInit = $A3BF;
+ sysTrapHwrModelInitStage2 = $A3C0;
+ sysTrapHwrInterruptsInit = $A3C1;
+
+ sysTrapHwrSoundOn = $A3C2;
+ sysTrapHwrSoundOff = $A3C3;
+
+// Kernel clock tick routine
+ sysTrapSysKernelClockTick = $A3C4;
+
+// MenuEraseMenu is exposed as of PalmOS 3.5, but there are
+// no public interfaces for it yet. Perhaps in a later release.
+ sysTrapMenuEraseMenu = $A3C5;
+
+ sysTrapSelectTime = $A3C6;
+
+// Menu Command Bar traps
+ sysTrapMenuCmdBarAddButton = $A3C7;
+ sysTrapMenuCmdBarGetButtonData = $A3C8;
+ sysTrapMenuCmdBarDisplay = $A3C9;
+
+// Silkscreen info
+ sysTrapHwrGetSilkscreenID = $A3CA;
+ sysTrapEvtGetSilkscreenAreaList = $A3CB;
+
+ sysTrapSysFatalAlertInit = $A3CC;
+ sysTrapDateTemplateToAscii = $A3CD;
+
+// New traps dealing with masking private records
+ sysTrapSecVerifyPW = $A3CE;
+ sysTrapSecSelectViewStatus = $A3CF;
+ sysTrapTblSetColumnMasked = $A3D0;
+ sysTrapTblSetRowMasked = $A3D1;
+ sysTrapTblRowMasked = $A3D2;
+
+// New form trap for dialogs with text entry field
+ sysTrapFrmCustomResponseAlert = $A3D3;
+ sysTrapFrmNewGsi = $A3D4;
+
+// New dynamic menu functions
+ sysTrapMenuShowItem = $A3D5;
+ sysTrapMenuHideItem = $A3D6;
+ sysTrapMenuAddItem = $A3D7;
+
+// New form traps for "smart gadgets"
+ sysTrapFrmSetGadgetHandler = $A3D8;
+
+// More new control functions
+ sysTrapCtlSetGraphics = $A3D9;
+ sysTrapCtlGetSliderValues = $A3DA;
+ sysTrapCtlSetSliderValues = $A3DB;
+ sysTrapCtlNewSliderControl = $A3DC;
+
+// Bitmap manager functions
+ sysTrapBmpCreate = $A3DD;
+ sysTrapBmpDelete = $A3DE;
+ sysTrapBmpCompress = $A3DF;
+// sysTrapBmpGetBits defined in Screen driver traps
+ sysTrapBmpGetColortable = $A3E0;
+ sysTrapBmpSize = $A3E1;
+ sysTrapBmpBitsSize = $A3E2;
+ sysTrapBmpColortableSize = $A3E3;
+// extra window namager
+ sysTrapWinCreateBitmapWindow = $A3E4;
+// Ask for a null event sooner (replaces a macro which Poser hated)
+ sysTrapEvtSetNullEventTick = $A3E5;
+
+// Exchange manager call to allow apps to select destination categories
+ sysTrapExgDoDialog = $A3E6;
+
+// this call will remove temporary UI like popup lists
+ sysTrapSysUICleanup = $A3E7;
+
+// The following 4 traps were "Reserved" traps, present only in SOME post-release builds of Palm OS 3.5
+ sysTrapWinSetForeColorRGB = $A3E8;
+ sysTrapWinSetBackColorRGB = $A3E9;
+ sysTrapWinSetTextColorRGB = $A3EA;
+ sysTrapWinGetPixelRGB = $A3EB;
+
+// TRAPS ABOVE THIS POINT CAN NOT CHANGE BECAUSE THEY HAVE
+// BEEN RELEASED TO CUSTOMERS IN SHIPPING ROMS AND SDKS.
+// (MOVE THIS COMMENT DOWN WHENEVER THE "NEXT" RELEASE OCCURS.)
+
+// WARNING!! The following are new traps for 4.0. If this file is merged
+// with MAIN sources, new traps that are added for products that precede
+// 4.0 MUST insert their traps BEFORE this section.
+
+ sysTrapSysReserved40Trap1 = $A3EC;
+ sysTrapSysReserved40Trap2 = $A3ED;
+ sysTrapSysReserved40Trap3 = $A3EE;
+ sysTrapSysReserved40Trap4 = $A3EF;
+
+// DO NOT CHANGE TRAPS ABOVE THIS LINE
+// THESE TRAPS HAVE BEEN RELEASED IN THE 3.5 SDK
+// NEW TRAPS FOR PALM OS 4.0 CAN BE ADDED AFTER THIS
+// THE ORDER IS NOT IMPORTANT AND CAN BE CHANGED.
+
+// New Trap selector added for New Connection Mgr API
+ sysTrapCncMgrDispatch = $A3F0;
+
+// new trap for notify from interrupt, implemented in SysEvtMgr.c
+ sysTrapSysNotifyBroadcastFromInterrupt = $A3F1;
+
+// new trap for waking the UI without generating a null event
+ sysTrapEvtWakeupWithoutNilEvent = $A3F2;
+
+// new trap for doing stable, fast, 7-bit string compare
+ sysTrapStrCompareAscii = $A3F3;
+
+// New trap for accessors available thru PalmOS glue
+ sysTrapAccessorDispatch = $A3F4;
+
+ sysTrapBltGetPixel = $A3F5;
+ sysTrapBltPaintPixel = $A3F6;
+ sysTrapScrScreenInit = $A3F7;
+ sysTrapScrUpdateScreenBitmap = $A3F8;
+ sysTrapScrPalette = $A3F9;
+ sysTrapScrGetColortable = $A3FA;
+ sysTrapScrGetGrayPat = $A3FB;
+ sysTrapScrScreenLock = $A3FC;
+ sysTrapScrScreenUnlock = $A3FD;
+ sysTrapFntPrvGetFontList = $A3FE;
+
+// Exchange manager functions
+ sysTrapExgRegisterDatatype = $A3FF;
+ sysTrapExgNotifyReceive = $A400;
+ sysTrapExgNotifyGoto = $A401;
+ sysTrapExgRequest = $A402;
+ sysTrapExgSetDefaultApplication = $A403;
+ sysTrapExgGetDefaultApplication = $A404;
+ sysTrapExgGetTargetApplication = $A405;
+ sysTrapExgGetRegisteredApplications = $A406;
+ sysTrapExgGetRegisteredTypes = $A407;
+ sysTrapExgNotifyPreview = $A408;
+ sysTrapExgControl = $A409;
+
+// 04/30/00 CS - New Locale Manager handles access to region-specific info like date formats
+ sysTrapLmDispatch = $A40A;
+
+// 05/10/00 kwk - New Memory Manager trap for retrieving ROM NVParam values (sys use only)
+ sysTrapMemGetRomNVParams = $A40B;
+
+// 05/12/00 kwk - Safe character width Font Mgr call
+ sysTrapFntWCharWidth = $A40C;
+
+// 05/17/00 kwk - Faster DmFindDatabase
+ sysTrapDmFindDatabaseWithTypeCreator = $A40D;
+
+// New Trap selectors added for time zone picker API
+ sysTrapSelectTimeZone = $A40E;
+ sysTrapTimeZoneToAscii = $A40F;
+
+// 08/18/00 kwk - trap for doing stable, fast, 7-bit string compare.
+// 08/21/00 kwk - moved here in place of sysTrapSelectDaylightSavingAdjustment.
+ sysTrapStrNCompareAscii = $A410;
+
+// New Trap selectors added for time zone conversion API
+ sysTrapTimTimeZoneToUTC = $A411;
+ sysTrapTimUTCToTimeZone = $A412;
+
+// New trap implemented in PhoneLookup.c
+ sysTrapPhoneNumberLookupCustom = $A413;
+
+// new trap for selecting debugger path.
+ sysTrapHwrDebugSelect = $A414;
+
+ sysTrapBltRoundedRectangle = $A415;
+ sysTrapBltRoundedRectangleFill = $A416;
+ sysTrapWinPrvInitCanvas = $A417;
+
+ sysTrapHwrCalcDynamicHeapSize = $A418;
+ sysTrapHwrDebuggerEnter = $A419;
+ sysTrapHwrDebuggerExit = $A41A;
+
+ sysTrapLstGetTopItem = $A41B;
+
+ sysTrapHwrModelInitStage3 = $A41C;
+
+// 06/21/00 peter - New Attention Manager
+ sysTrapAttnIndicatorAllow = $A41D;
+ sysTrapAttnIndicatorAllowed = $A41E;
+ sysTrapAttnIndicatorEnable = $A41F;
+ sysTrapAttnIndicatorEnabled = $A420;
+ sysTrapAttnIndicatorSetBlinkPattern = $A421;
+ sysTrapAttnIndicatorGetBlinkPattern = $A422;
+ sysTrapAttnIndicatorTicksTillNextBlink = $A423;
+ sysTrapAttnIndicatorCheckBlink = $A424;
+ sysTrapAttnInitialize = $A425;
+ sysTrapAttnGetAttention = $A426;
+ sysTrapAttnUpdate = $A427;
+ sysTrapAttnForgetIt = $A428;
+ sysTrapAttnGetCounts = $A429;
+ sysTrapAttnListOpen = $A42A;
+ sysTrapAttnHandleEvent = $A42B;
+ sysTrapAttnEffectOfEvent = $A42C;
+ sysTrapAttnIterate = $A42D;
+ sysTrapAttnDoSpecialEffects = $A42E;
+ sysTrapAttnDoEmergencySpecialEffects = $A42F;
+ sysTrapAttnAllowClose = $A430;
+ sysTrapAttnReopen = $A431;
+ sysTrapAttnEnableNotification = $A432;
+ sysTrapHwrLEDAttributes = $A433;
+ sysTrapHwrVibrateAttributes = $A434;
+
+// Trap for getting and setting the device password hint.
+ sysTrapSecGetPwdHint = $A435;
+ sysTrapSecSetPwdHint = $A436;
+
+ sysTrapHwrFlashWrite = $A437;
+
+ sysTrapKeyboardStatusNew = $A438;
+ sysTrapKeyboardStatusFree = $A439;
+ sysTrapKbdSetLayout = $A43A;
+ sysTrapKbdGetLayout = $A43B;
+ sysTrapKbdSetPosition = $A43C;
+ sysTrapKbdGetPosition = $A43D;
+ sysTrapKbdSetShiftState = $A43E;
+ sysTrapKbdGetShiftState = $A43F;
+ sysTrapKbdDraw = $A440;
+ sysTrapKbdErase = $A441;
+ sysTrapKbdHandleEvent = $A442;
+
+ sysTrapOEMDispatch2 = $A443;
+ sysTrapHwrCustom = $A444;
+
+// 08/28/00 kwk - Trap for getting form's active field.
+ sysTrapFrmGetActiveField = $A445;
+
+// 9/18/00 rkr - Added for playing sounds regardless of interruptible flag
+ sysTrapSndPlaySmfIrregardless = $A446;
+ sysTrapSndPlaySmfResourceIrregardless = $A447;
+ sysTrapSndInterruptSmfIrregardless = $A448;
+
+// 10/14/00 ABa: UDA manager
+ sysTrapUdaMgrDispatch = $A449;
+
+// WK: private traps for PalmOS
+ sysTrapPalmPrivate1 = $A44A;
+ sysTrapPalmPrivate2 = $A44B;
+ sysTrapPalmPrivate3 = $A44C;
+ sysTrapPalmPrivate4 = $A44D;
+
+// 11/07/00 tlw: Added accessors
+ sysTrapBmpGetDimensions = $A44E;
+ sysTrapBmpGetBitDepth = $A44F;
+ sysTrapBmpGetNextBitmap = $A450;
+ sysTrapTblGetNumberOfColumns = $A451;
+ sysTrapTblGetTopRow = $A452;
+ sysTrapTblSetSelection = $A453;
+ sysTrapFrmGetObjectIndexFromPtr = $A454;
+
+// 11/10/00 acs
+ sysTrapBmpGetSizes = $A455;
+ sysTrapWinGetBounds = $A456;
+
+ sysTrapBltPaintPixels = $A457;
+
+// 11/22/00 bob
+ sysTrapFldSetMaxVisibleLines = $A458;
+
+// 01/09/01 acs
+ sysTrapScrDefaultPaletteState = $A459;
+
+// WARNING!! LEAVE THIS AT THE END AND ALWAYS ADD NEW TRAPS TO
+// THE END OF THE TRAP TABLE BUT RIGHT BEFORE THIS TRAP, AND THEN
+// RENUMBER THIS ONE TO ONE MORE THAN THE ONE RIGHT BEFORE IT!!!!!!!!!
+
+ sysTrapLastTrapNumber = $A45A;
+
+const
+ sysNumTraps = sysTrapLastTrapNumber - sysTrapBase;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/crc.pp b/packages/palmunits/src/crc.pp
new file mode 100644
index 0000000000..15f34a812e
--- /dev/null
+++ b/packages/palmunits/src/crc.pp
@@ -0,0 +1,50 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Crc.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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 *.
+ *
+ *****************************************************************************)
+
+unit crc;
+
+interface
+
+uses palmos, coretraps;
+
+(********************************************************************
+ * CRC Calculation Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// Crc16CalcBlock()
+//
+// Calculate the 16-bit CRC of a data block using the table lookup method.
+//
+
+function Crc16CalcBlock(const bufP: Pointer; count, crc: UInt16): UInt16; syscall sysTrapCrc16CalcBlock;
+
+//UInt16 Crc16CalcBigBlock(void *bufP, UInt32 count, UInt16 crc);
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/datamgr.pp b/packages/palmunits/src/datamgr.pp
new file mode 100644
index 0000000000..408e46afae
--- /dev/null
+++ b/packages/palmunits/src/datamgr.pp
@@ -0,0 +1,424 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DataMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header for the Data Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit datamgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+type
+ DmResType = UInt32;
+ DmResID = UInt16;
+
+(************************************************************
+ * Category equates
+ *************************************************************)
+
+const
+ dmRecAttrCategoryMask = $0F; // mask for category #
+ dmRecNumCategories = 16; // number of categories
+ dmCategoryLength = 16; // 15 chars + 1 null terminator
+
+ dmAllCategories = $ff;
+ dmUnfiledCategory = 0;
+
+ dmMaxRecordIndex = $ffff;
+
+// 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)
+
+ dmRecAttrDelete = $80; // delete this record next sync
+ dmRecAttrDirty = $40; // archive this record next sync
+ dmRecAttrBusy = $20; // record currently in use
+ dmRecAttrSecret = $10; // "secret" record - password protected
+
+// All record atributes (for error-checking)
+ dmAllRecAttrs = dmRecAttrDelete or dmRecAttrDirty or dmRecAttrBusy or dmRecAttrSecret;
+
+// Record attributes which only the system is allowed to change (for error-checking)
+ dmSysOnlyRecAttrs = dmRecAttrBusy;
+
+(************************************************************
+ * Database Header equates
+ *************************************************************)
+
+ dmDBNameLength = 32; // 31 chars + 1 null terminator
+
+// Attributes of a Database
+//
+// *** IMPORTANT:
+// ***
+// *** Any changes to database attributes must be reflected in dmAllHdrAttrs and dmSysOnlyHdrAttrs ***
+// ***
+
+ dmHdrAttrResDB = $0001; // Resource database
+ dmHdrAttrReadOnly = $0002; // Read Only database
+ dmHdrAttrAppInfoDirty = $0004; // Set if Application Info block is dirty
+ // Optionally supported by an App's conduit
+ dmHdrAttrBackup = $0008; // Set if database should be backed up to PC if
+ // no app-specific synchronization conduit has
+ // been supplied.
+ dmHdrAttrOKToInstallNewer = $0010; // 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.
+ dmHdrAttrResetAfterInstall = $0020; // Device requires a reset after this database is
+ // installed.
+ dmHdrAttrCopyPrevention = $0040; // This database should not be copied to
+
+ dmHdrAttrStream = $0080; // This database is used for file stream implementation.
+ dmHdrAttrHidden = $0100; // 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.
+ dmHdrAttrLaunchableData = $0200; // 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.
+ dmHdrAttrRecyclable = $0400; // This database (resource or record) is recyclable:
+ // it will be deleted Real Soon Now, generally the next
+ // time the database is closed.
+
+ dmHdrAttrBundle = $0800; // This database (resource or record) is associated with
+ // the application with the same creator. It will be beamed
+ // and copied along with the application.
+
+ dmHdrAttrOpen = $8000; // Database not closed properly
+
+
+// All database atributes (for error-checking)
+ dmAllHdrAttrs = dmHdrAttrResDB or
+ dmHdrAttrReadOnly or
+ dmHdrAttrAppInfoDirty or
+ dmHdrAttrBackup or
+ dmHdrAttrOKToInstallNewer or
+ dmHdrAttrResetAfterInstall or
+ dmHdrAttrCopyPrevention or
+ dmHdrAttrStream or
+ dmHdrAttrLaunchableData or
+ dmHdrAttrRecyclable or
+ dmHdrAttrBundle or
+ dmHdrAttrOpen;
+
+// Database attributes which only the system is allowed to change (for error-checking)
+ dmSysOnlyHdrAttrs = dmHdrAttrResDB or dmHdrAttrOpen;
+
+(************************************************************
+ * Unique ID equates
+ *************************************************************)
+
+ 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.
+ dmDefaultRecordsID = 0; // Records in a default database are copied
+ // with their uniqueIDSeeds set in this range.
+ dmUnusedRecordID = 0; // Record ID not allowed on the device
+
+(************************************************************
+ * Mode flags passed to DmOpenDatabase
+ *************************************************************)
+
+ dmModeReadOnly = $0001; // read access
+ dmModeWrite = $0002; // write access
+ dmModeReadWrite = $0003; // read & write access
+ dmModeLeaveOpen = $0004; // leave open when app quits
+ dmModeExclusive = $0008; // don't let anyone else open it
+ dmModeShowSecret = $0010; // force show of secret records
+
+// Generic type used to represent an open Database
+type
+ DmOpenRef = Pointer;
+
+(************************************************************
+ * Structure passed to DmGetNextDatabaseByTypeCreator and used
+ * to cache search information between multiple searches.
+ *************************************************************)
+
+type
+ DmSearchStateType = record
+ info: array [0..8-1] of UInt32;
+ end;
+
+ DmSearchStatePtr = ^DmSearchStateType;
+
+(************************************************************
+ * Structures used by the sorting routines
+ *************************************************************)
+
+ SortRecordInfoType = record
+ attributes: UInt8; // record attributes;
+ uniqueID: array [0..3-1] of UInt8; // unique ID of record
+ end;
+
+ SortRecordInfoPtr = ^SortRecordInfoType;
+
+ DmComparF = function(p1, p2: Pointer; other: Int16; s1, s2: SortRecordInfoPtr; appInfoH: MemHandle): Int16;
+
+(************************************************************
+ * Database manager error codes
+ * the constant dmErrorClass is defined in ErrorBase.h
+ *************************************************************)
+
+const
+ dmErrMemError = dmErrorClass or 1;
+ dmErrIndexOutOfRange = dmErrorClass or 2;
+ dmErrInvalidParam = dmErrorClass or 3;
+ dmErrReadOnly = dmErrorClass or 4;
+ dmErrDatabaseOpen = dmErrorClass or 5;
+ dmErrCantOpen = dmErrorClass or 6;
+ dmErrCantFind = dmErrorClass or 7;
+ dmErrRecordInWrongCard = dmErrorClass or 8;
+ dmErrCorruptDatabase = dmErrorClass or 9;
+ dmErrRecordDeleted = dmErrorClass or 10;
+ dmErrRecordArchived = dmErrorClass or 11;
+ dmErrNotRecordDB = dmErrorClass or 12;
+ dmErrNotResourceDB = dmErrorClass or 13;
+ dmErrROMBased = dmErrorClass or 14;
+ dmErrRecordBusy = dmErrorClass or 15;
+ dmErrResourceNotFound = dmErrorClass or 16;
+ dmErrNoOpenDatabase = dmErrorClass or 17;
+ dmErrInvalidCategory = dmErrorClass or 18;
+ dmErrNotValidRecord = dmErrorClass or 19;
+ dmErrWriteOutOfBounds = dmErrorClass or 20;
+ dmErrSeekFailed = dmErrorClass or 21;
+ dmErrAlreadyOpenForWrites = dmErrorClass or 22;
+ dmErrOpenedByAnotherTask = dmErrorClass or 23;
+ dmErrUniqueIDNotFound = dmErrorClass or 24;
+ dmErrAlreadyExists = dmErrorClass or 25;
+ dmErrInvalidDatabaseName = dmErrorClass or 26;
+ dmErrDatabaseProtected = dmErrorClass or 27;
+ dmErrDatabaseNotProtected = dmErrorClass or 28;
+
+(************************************************************
+ * Values for the direction parameter of DmSeekRecordInCategory
+ *************************************************************)
+
+ dmSeekForward = 1;
+ dmSeekBackward = -1;
+
+(************************************************************
+ * Data Manager procedures
+ *************************************************************)
+
+// Initialization
+function DmInit: Err; syscall sysTrapDmInit;
+
+// Directory Lists
+function DmCreateDatabase(cardNo: UInt16; const nameP: PChar;
+ creator, type_: UInt32; resDB: Boolean): Err; syscall sysTrapDmCreateDatabase;
+
+function DmCreateDatabaseFromImage(bufferP: MemPtr): Err; syscall sysTrapDmCreateDatabaseFromImage;
+
+
+function DmDeleteDatabase(cardNo: UInt16; dbID: LocalID): Err; syscall sysTrapDmDeleteDatabase;
+
+function DmNumDatabases(cardNo: UInt16): UInt16; syscall sysTrapDmNumDatabases;
+
+function DmGetDatabase(cardNo, index: UInt16): LocalID; syscall sysTrapDmGetDatabase;
+
+function DmFindDatabase(cardNo: UInt16; const nameP: PChar): LocalID; syscall sysTrapDmFindDatabase;
+
+function DmGetNextDatabaseByTypeCreator(newSearch: Boolean; stateInfoP: DmSearchStatePtr;
+ type_, creator: UInt32; onlyLatestVers: Boolean;
+ var cardNoP: UInt16; var dbIDP: LocalID): Err; syscall sysTrapDmGetNextDatabaseByTypeCreator;
+
+// Database info
+function DmDatabaseInfo(cardNo: UInt16; dbID: LocalID; nameP: PChar;
+ var attributesP, versionP: UInt16; var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
+ var appInfoIDP, sortInfoIDP: LocalID; var typeP, creatorP: UInt32): Err; syscall sysTrapDmDatabaseInfo;
+
+function DmSetDatabaseInfo(cardNo: UInt16; dbID: LocalID; const nameP: PChar;
+ var attributesP, versionP: UInt16; var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
+ var appInfoIDP, sortInfoIDP: LocalID; var typeP, creatorP: UInt32): Err; syscall sysTrapDmSetDatabaseInfo;
+
+function DmDatabaseSize(cardNo: UInt16; dbID: LocalID; var numRecordsP, totalBytesP, dataBytesP: UInt32): Err; syscall 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.
+function DmDatabaseProtect(cardNo: UInt16; dbID: LocalID; protect: Boolean): Err; syscall sysTrapDmDatabaseProtect;
+
+// Open/close Databases
+function DmOpenDatabase(cardNo: UInt16; dbID: LocalID; mode: UInt16): DmOpenRef; syscall sysTrapDmOpenDatabase;
+
+function DmOpenDatabaseByTypeCreator(type_, creator: UInt32; mode: UInt16): DmOpenRef; syscall sysTrapDmOpenDatabaseByTypeCreator;
+
+function DmOpenDBNoOverlay(cardNo: UInt16; dbID: LocalID; mode: UInt16): DmOpenRef; syscall sysTrapDmOpenDBNoOverlay;
+
+function DmCloseDatabase(dbP: DmOpenRef): Err; syscall sysTrapDmCloseDatabase;
+
+// Info on open databases
+function DmNextOpenDatabase(currentP: DmOpenRef): DmOpenRef; syscall sysTrapDmNextOpenDatabase;
+
+function DmOpenDatabaseInfo(dbP: DmOpenRef; var dbIDP: LocalID;
+ var openCountP, modeP, cardNoP: UInt16; var resDBP: Boolean): Err; syscall sysTrapDmOpenDatabaseInfo;
+
+function DmGetAppInfoID(dbP: DmOpenRef): LocalID; syscall sysTrapDmGetAppInfoID;
+
+procedure DmGetDatabaseLockState(dbR: DmOpenRef; var highest: UInt8; count, busy: UInt32); syscall sysTrapDmGetDatabaseLockState;
+
+// Utility to unlock all records and clear busy bits
+function DmResetRecordStates(dbP: DmOpenRef): Err; syscall sysTrapDmResetRecordStates;
+
+// Error Query
+function DmGetLastErr: Err; syscall sysTrapDmGetLastErr;
+
+//------------------------------------------------------------
+// Record based access routines
+//------------------------------------------------------------
+
+// Record Info
+function DmNumRecords(dbP: DmOpenRef): UInt16; syscall sysTrapDmNumRecords;
+
+function DmNumRecordsInCategory(dbP: DmOpenRef; category: UInt16): UInt16; syscall sysTrapDmNumRecordsInCategory;
+
+function DmRecordInfo(dbP: DmOpenRef; index: UInt16;
+ var attrP: UInt16; var uniqueIDP: UInt32; var chunkIDP: LocalID): Err; syscall sysTrapDmRecordInfo;
+
+function DmSetRecordInfo(dbP: DmOpenRef; index: UInt16;
+ var attrP: UInt16; var uniqueIDP: UInt32): Err; syscall sysTrapDmSetRecordInfo;
+
+// Record attaching and detaching
+function DmAttachRecord(dbP: DmOpenRef; var atP: UInt16; newH: MemHandle; var oldHP: MemHandle): Err; syscall sysTrapDmAttachRecord;
+
+function DmDetachRecord(dbP: DmOpenRef; index: UInt16; var oldHP: MemHandle): Err; syscall sysTrapDmDetachRecord;
+
+function DmMoveRecord(dbP: DmOpenRef; from, to_: UInt16): Err; syscall sysTrapDmMoveRecord;
+
+// Record creation and deletion
+function DmNewRecord(dbP: DmOpenRef; var atP: UInt16; size: UInt32): MemHandle; syscall sysTrapDmNewRecord;
+
+function DmRemoveRecord(dbP: DmOpenRef; index: UInt16): Err; syscall sysTrapDmRemoveRecord;
+
+function DmDeleteRecord(dbP: DmOpenRef; index: UInt16): Err; syscall sysTrapDmDeleteRecord;
+
+function DmArchiveRecord(dbP: DmOpenRef; index: UInt16): Err; syscall sysTrapDmArchiveRecord;
+
+function DmNewHandle(dbP: DmOpenRef; size: UInt32): MemHandle; syscall sysTrapDmNewHandle;
+
+function DmRemoveSecretRecords(dbP: DmOpenRef): Err; syscall sysTrapDmRemoveSecretRecords;
+
+// Record viewing manipulation
+function DmFindRecordByID(dbP: DmOpenRef; uniqueID: UInt32; var indexP: UInt16): Err; syscall sysTrapDmFindRecordByID;
+
+function DmQueryRecord(dbP: DmOpenRef; index: UInt16): MemHandle; syscall sysTrapDmQueryRecord;
+
+function DmGetRecord(dbP: DmOpenRef; index: UInt16): MemHandle; syscall sysTrapDmGetRecord;
+
+function DmQueryNextInCategory(dbP: DmOpenRef; var indexP: UInt16; category: UInt16): MemHandle; syscall sysTrapDmQueryNextInCategory;
+
+function DmPositionInCategory(dbP: DmOpenRef; index, category: UInt16): UInt16; syscall sysTrapDmPositionInCategory;
+
+function DmSeekRecordInCategory(dbP: DmOpenRef; var indexP: UInt16; offset: UInt16;
+ direction: Int16; category: UInt16): Err; syscall sysTrapDmSeekRecordInCategory;
+
+
+function DmResizeRecord(dbP: DmOpenRef; index: UInt16; newSize: UInt32): MemHandle; syscall sysTrapDmResizeRecord;
+
+function DmReleaseRecord(dbP: DmOpenRef; index: UInt16; dirty: Boolean): Err; syscall sysTrapDmReleaseRecord;
+
+function DmSearchRecord(recH: MemHandle; var dbPP: DmOpenRef): UInt16; syscall sysTrapDmSearchRecord;
+
+// Category manipulation
+function DmMoveCategory(dbP: DmOpenRef; toCategory, fromCategory: UInt16; dirty: Boolean): Err; syscall sysTrapDmMoveCategory;
+
+function DmDeleteCategory(dbR: DmOpenRef; categoryNum: UInt16): Err; syscall sysTrapDmDeleteCategory;
+
+// Validation for writing
+function DmWriteCheck(recordP: Pointer; offset, bytes: UInt32): Err; syscall sysTrapDmWriteCheck;
+
+// Writing
+function DmWrite(recordP: Pointer; offset: UInt32; const srcP: Pointer; bytes: UInt32): Err; syscall sysTrapDmWrite;
+
+function DmStrCopy(recordP: Pointer; offset: UInt32; const srcP: PChar): Err; syscall sysTrapDmStrCopy;
+
+function DmSet(recordP: Pointer; offset, bytes: UInt32; value: UInt8): Err; syscall sysTrapDmSet;
+
+//------------------------------------------------------------
+// Resource based access routines
+//------------------------------------------------------------
+
+// High level access routines
+function DmGetResource(type_: DmResType; resID: DmResID): MemHandle; syscall sysTrapDmGetResource;
+
+function DmGet1Resource(type_: DmResType; resID: DmResID): MemHandle; syscall sysTrapDmGet1Resource;
+
+function DmReleaseResource(resourceH: MemHandle): Err; syscall sysTrapDmReleaseResource;
+
+function DmResizeResource(resourceH: MemHandle; newSize: UInt32): MemHandle; syscall sysTrapDmResizeResource;
+
+// Searching resource databases
+function DmNextOpenResDatabase(dbP: DmOpenRef): DmOpenRef; syscall sysTrapDmNextOpenResDatabase;
+
+function DmFindResourceType(dbP: DmOpenRef; resType: DmResType; typeIndex: UInt16): UInt16; syscall sysTrapDmFindResourceType;
+
+function DmFindResource(dbP: DmOpenRef; resType: DmResType; resID: DmResID; resH: MemHandle): UInt16; syscall sysTrapDmFindResource;
+
+function DmSearchResource(resType: DmResType; resID: DmResID; resH: MemHandle; var dbPP: DmOpenRef): UInt16; syscall sysTrapDmSearchResource;
+
+// Resource Info
+function DmNumResources(dbP: DmOpenRef): UInt16; syscall sysTrapDmNumResources;
+
+function DmResourceInfo(dbP: DmOpenRef; index: UInt16;
+ var resTypeP: DmResType; var resIDP: DmResID;
+ var chunkLocalIDP: LocalID): Err; syscall sysTrapDmResourceInfo;
+
+function DmSetResourceInfo(dbP: DmOpenRef; index: UInt16;
+ var resTypeP: DmResType; var resIDP: DmResID): Err; syscall sysTrapDmSetResourceInfo;
+
+// Resource attaching and detaching
+function DmAttachResource(dbP: DmOpenRef; newH: MemHandle;
+ resType: DmResType; resID: DmResID): Err; syscall sysTrapDmAttachResource;
+
+function DmDetachResource(dbP: DmOpenRef; index: UInt16; var oldHP: MemHandle): Err; syscall sysTrapDmDetachResource;
+
+// Resource creation and deletion
+function DmNewResource(dbP: DmOpenRef; resType: DmResType; resID: DmResID; size: UInt32): MemHandle; syscall sysTrapDmNewResource;
+
+function DmRemoveResource(dbP: DmOpenRef; index: UInt16): Err; syscall sysTrapDmRemoveResource;
+
+// Resource manipulation
+function DmGetResourceIndex(dbP: DmOpenRef; index: UInt16): MemHandle; syscall sysTrapDmGetResourceIndex;
+
+// Record sorting
+function DmQuickSort(dbP: DmOpenRef; compar: DmComparF; other: Int16): Err; syscall sysTrapDmQuickSort;
+
+function DmInsertionSort(dbR: DmOpenRef; compar: DmComparF; other: Int16): Err; syscall sysTrapDmInsertionSort;
+
+function DmFindSortPosition(dbP: DmOpenRef; newRecord: Pointer;
+ newRecordInfo: SortRecordInfoPtr; compar: DmComparF; other: Int16): UInt16; syscall sysTrapDmFindSortPosition;
+
+function DmFindSortPositionV10(dbP: DmOpenRef; newRecord: Pointer; compar: DmComparF; other: Int16): UInt16; syscall sysTrapDmFindSortPositionV10;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/datetime.pp b/packages/palmunits/src/datetime.pp
new file mode 100644
index 0000000000..c4023090b8
--- /dev/null
+++ b/packages/palmunits/src/datetime.pp
@@ -0,0 +1,305 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DateTime.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ * 05/16/00 CS Changed DayOfWeekType ot DayOfMonthType.
+ *
+ *****************************************************************************)
+unit datetime;
+
+interface
+
+uses palmos, coretraps, chars, localemgr;
+
+type
+ TimeFormatType = Enum;
+
+const
+ tfColon = 0;
+ tfColonAMPM = Succ(tfColon); // 1:00 pm
+ tfColon24h = Succ(tfColonAMPM); // 13:00
+ tfDot = Succ(tfColon24h);
+ tfDotAMPM = Succ(tfDot); // 1.00 pm
+ tfDot24h = Succ(tfDotAMPM); // 13.00
+ tfHoursAMPM = Succ(tfDot24h); // 1 pm
+ tfHours24h = Succ(tfHoursAMPM); // 13
+ tfComma24h = Succ(tfHours24h); // 13,00
+
+type
+ DaylightSavingsTypes = Enum;
+
+const
+ dsNone = 0; // Daylight Savings Time not observed
+ dsUSA = Succ(dsNone); // United States Daylight Savings Time
+ dsAustralia = Succ(dsUSA); // Australian Daylight Savings Time
+ dsWesternEuropean = Succ(dsAustralia); // Western European Daylight Savings Time
+ dsMiddleEuropean = Succ(dsWesternEuropean); // Middle European Daylight Savings Time
+ dsEasternEuropean = Succ(dsMiddleEuropean); // Eastern European Daylight Savings Time
+ dsGreatBritain = Succ(dsEasternEuropean); // Great Britain and Eire Daylight Savings Time
+ dsRumania = Succ(dsGreatBritain); // Rumanian Daylight Savings Time
+ dsTurkey = Succ(dsRumania); // Turkish Daylight Savings Time
+ dsAustraliaShifted = Succ(dsTurkey); // Australian Daylight Savings Time with shift in 1986
+
+// pass a TimeFormatType
+// Use24HourFormat(t) ((t) == tfColon24h || (t) == tfDot24h || (t) == tfHours24h || (t) == tfComma24h)
+// TimeSeparator(t) ((Char) ( t <= tfColon24h ? ':' : (t <= tfDot24h ? '.' : ',')))
+
+type
+ DateFormatType = Enum;
+
+const
+ dfMDYWithSlashes = 0; // 12/31/95
+ dfDMYWithSlashes = Succ(dfMDYWithSlashes); // 31/12/95
+ dfDMYWithDots = Succ(dfDMYWithSlashes); // 31.12.95
+ dfDMYWithDashes = Succ(dfDMYWithDots); // 31-12-95
+ dfYMDWithSlashes = Succ(dfDMYWithDashes); // 95/12/31
+ dfYMDWithDots = Succ(dfYMDWithSlashes); // 95.12.31
+ dfYMDWithDashes = Succ(dfYMDWithDots); // 95-12-31
+
+ dfMDYLongWithComma = Succ(dfYMDWithDashes); // Dec 31, 1995
+ dfDMYLong = Succ(dfMDYLongWithComma); // 31 Dec 1995
+ dfDMYLongWithDot = Succ(dfDMYLong); // 31. Dec 1995
+ dfDMYLongNoDay = Succ(dfDMYLongWithDot); // Dec 1995
+ dfDMYLongWithComma = Succ(dfDMYLongNoDay); // 31 Dec, 1995
+ dfYMDLongWithDot = Succ(dfDMYLongWithComma); // 1995.12.31
+ dfYMDLongWithSpace = Succ(dfYMDLongWithDot); // 1995 Dec 31
+
+ dfMYMed = Succ(dfYMDLongWithSpace); // Dec '95
+ dfMYMedNoPost = Succ(dfMYMed); // Dec 95 (added for French 2.0 ROM)
+ dfMDYWithDashes = Succ(dfMYMedNoPost); // 12-31-95 (added for 4.0 ROM)
+
+type
+ DateTimeType = record
+ second: Int16;
+ minute: Int16;
+ hour: Int16;
+ day: Int16;
+ month: Int16;
+ year: Int16;
+ weekDay: Int16; // Days since Sunday (0 to 6)
+ end;
+
+ DateTimePtr = ^DateTimeType;
+
+// This is the time format. Times are treated as words so don't
+// change the order of the members in this structure.
+//
+
+ TimeType = record
+ hours: UInt8;
+ minutes: UInt8;
+ end;
+
+ TimePtr = ^TimeType;
+
+const
+ 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.
+//
+
+type
+ DateType = record
+ Bits: UInt16;
+{
+ UInt16 year :7; // years since 1904 (MAC format)
+ UInt16 month :4;
+ UInt16 day :5;
+}
+ end;
+
+ DatePtr = ^DateType;
+
+(************************************************************
+ * Date Time Constants
+ *************************************************************)
+
+// Maximum lengths of strings return by the date and time formating
+// routine DateToAscii and TimeToAscii.
+const
+ timeStringLength = 9;
+ dateStringLength = 9;
+ longDateStrLength = 15;
+ dowDateStringLength = 19;
+ dowLongDateStrLength = 25;
+ timeZoneStringLength = 50;
+
+ firstYear = 1904;
+ numberOfYears = 128;
+ lastYear = firstYear + numberOfYears - 1;
+
+// Constants for time calculations
+// Could change these from xIny to yPerX
+ secondsInSeconds = 1;
+ minutesInSeconds = 60;
+ hoursInMinutes = 60;
+ hoursInSeconds = hoursInMinutes * minutesInSeconds;
+ hoursPerDay = 24;
+// daysInSeconds ((Int32)(hoursPerDay) * ((Int32)hoursInSeconds))
+ daysInSeconds = $15180; // cc bug
+
+ daysInWeek = 7;
+ daysInYear = 365;
+ daysInLeapYear = 366;
+ daysInFourYears = daysInLeapYear + 3 * daysInYear;
+
+ monthsInYear = 12;
+
+ maxDays = UInt32(numberOfYears div 4 * daysInFourYears - 1);
+ maxSeconds = UInt32((maxDays+1) * daysInSeconds - 1);
+
+// Values returned by DayOfWeek routine.
+ sunday = 0;
+ monday = 1;
+ tuesday = 2;
+ wednesday = 3;
+ thursday = 4;
+ friday = 5;
+ saturday = 6;
+
+// Months of the year
+ january = 1;
+ february = 2;
+ march = 3;
+ april = 4;
+ may = 5;
+ june = 6;
+ july = 7;
+ august = 8;
+ september = 9;
+ october = 10;
+ november = 11;
+ december = 12;
+
+// Values returned by DayOfMonth routine.
+type
+ DayOfMonthType = Enum;
+
+// It would have been cool to have a real DayOfWeekType, but we #define the
+// following for compatibility with existing code. Please use the new name
+// (DayOfMonthType).
+ DayOfWeekType = DayOfMonthType;
+
+const
+ dom1stSun = 0;
+ dom1stMon = Succ(dom1stSun);
+ dom1stTue = Succ(dom1stMon);
+ dom1stWen = Succ(dom1stTue);
+ dom1stThu = Succ(dom1stWen);
+ dom1stFri = Succ(dom1stThu);
+ dom1stSat = Succ(dom1stFri);
+ dom2ndSun = Succ(dom1stSat);
+ dom2ndMon = Succ(dom2ndSun);
+ dom2ndTue = Succ(dom2ndMon);
+ dom2ndWen = Succ(dom2ndTue);
+ dom2ndThu = Succ(dom2ndWen);
+ dom2ndFri = Succ(dom2ndThu);
+ dom2ndSat = Succ(dom2ndFri);
+ dom3rdSun = Succ(dom2ndSat);
+ dom3rdMon = Succ(dom3rdSun);
+ dom3rdTue = Succ(dom3rdMon);
+ dom3rdWen = Succ(dom3rdTue);
+ dom3rdThu = Succ(dom3rdWen);
+ dom3rdFri = Succ(dom3rdThu);
+ dom3rdSat = Succ(dom3rdFri);
+ dom4thSun = Succ(dom3rdSat);
+ dom4thMon = Succ(dom4thSun);
+ dom4thTue = Succ(dom4thMon);
+ dom4thWen = Succ(dom4thTue);
+ dom4thThu = Succ(dom4thWen);
+ dom4thFri = Succ(dom4thThu);
+ dom4thSat = Succ(dom4thFri);
+ domLastSun = Succ(dom4thSat);
+ domLastMon = Succ(domLastSun);
+ domLastTue = Succ(domLastMon);
+ domLastWen = Succ(domLastTue);
+ domLastThu = Succ(domLastWen);
+ domLastFri = Succ(domLastThu);
+ domLastSa = Succ(domLastFri);
+
+// Values used by DateTemplateToAscii routine.
+ dateTemplateChar = chrCircumflexAccent;
+
+ dateTemplateDayNum = '0';
+ dateTemplateDOWName = Succ(dateTemplateDayNum);
+ dateTemplateMonthName = Succ(dateTemplateDOWName);
+ dateTemplateMonthNum = Succ(dateTemplateMonthName);
+ dateTemplateYearNum = Succ(dateTemplateMonthNum);
+
+ dateTemplateShortModifier = 's';
+ dateTemplateRegularModifier = 'r';
+ dateTemplateLongModifier = 'l';
+ dateTemplateLeadZeroModifier = 'z';
+
+//************************************************************
+//* Date and Time macros
+//***********************************************************
+
+{
+// Convert a date in a DateType structure to an UInt16.
+ DateToInt(date) (*(UInt16 *) &date)
+
+
+// Convert a date in a DateType structure to a signed int.
+ TimeToInt(time) (*(Int16 *) &time)
+}
+
+//************************************************************
+//* Date Time procedures
+//************************************************************
+
+procedure TimSecondsToDateTime(seconds: UInt32; dateTimeP: DateTimePtr); syscall sysTrapTimSecondsToDateTime;
+
+function TimDateTimeToSeconds(dateTimeP: DateTimePtr): UInt32; syscall sysTrapTimDateTimeToSeconds;
+
+procedure TimAdjust(dateTimeP: DateTimePtr; adjustment: Int32); syscall sysTrapTimAdjust;
+
+procedure TimeToAscii(hours, minutes: UInt8; timeFormat: TimeFormatType; pString: PChar); syscall sysTrapTimeToAscii;
+
+function TimTimeZoneToUTC(seconds: UInt32; timeZone: Int16; daylightSavingAdjustment: Int16): UInt32; syscall sysTrapTimTimeZoneToUTC;
+
+function TimUTCToTimeZone(seconds: UInt32; timeZone: Int16; daylightSavingAdjustment: Int16): UInt32; syscall sysTrapTimUTCToTimeZone;
+
+procedure TimeZoneToAscii(timeZone: Int16; localeP: LmLocalePtr; string_: PChar); syscall sysTrapTimeZoneToAscii;
+
+function DaysInMonth(month, year: Int16): Int16; syscall sysTrapDaysInMonth;
+
+function DayOfWeek(month, day, year: Int16): Int16; syscall sysTrapDayOfWeek;
+
+function DayOfMonth(month, day, year: Int16): Int16; syscall sysTrapDayOfMonth;
+
+// Date routines.
+procedure DateSecondsToDate(seconds: UInt32; date: DatePtr); syscall sysTrapDateSecondsToDate;
+
+procedure DateDaysToDate(days: UInt32; date: DatePtr); syscall sysTrapDateDaysToDate;
+
+function DateToDays(date: DateType): UInt32; syscall sysTrapDateToDays;
+
+procedure DateAdjust(dateP: DatePtr; adjustment: Int32); syscall sysTrapDateAdjust;
+
+procedure DateToAscii(months, days: UInt8; years: UInt16;
+ dateFormat: DateFormatType; pString: PChar); syscall sysTrapDateToAscii;
+
+procedure DateToDOWDMFormat(months, days: UInt8; years: UInt16;
+ dateFormat: DateFormatType; pString: PChar); syscall sysTrapDateToDOWDMFormat;
+
+function DateTemplateToAscii(const templateP: PChar; months, days: UInt8;
+ years: UInt16; stringP: PChar; stringLen: Int16): UInt16; syscall sysTrapDateTemplateToAscii;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/day.pp b/packages/palmunits/src/day.pp
new file mode 100644
index 0000000000..0abb9b20d7
--- /dev/null
+++ b/packages/palmunits/src/day.pp
@@ -0,0 +1,53 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Day.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the date picker month object's structures
+ * and routines.
+ *
+ * History:
+ * May 31, 1995 Created by Roger Flores
+ *
+ *****************************************************************************)
+unit day;
+
+interface
+
+uses palmos, coretraps, rect, datetime, control;
+
+type
+ SelectDayType = Enum;
+
+const
+ selectDayByDay = 0; // return d/m/y
+ selectDayByWeek = 1; // return d/m/y with d as same day of the week
+ selectDayByMonth = 2; // return d/m/y with d as same day of the month
+
+type
+ DaySelectorType = record
+ bounds: RectangleType;
+ visible: Boolean;
+ reserved1: UInt8;
+ visibleMonth: Int16; // month actually displayed
+ visibleYear: Int16; // year actually displayed
+ selected: DateTimeType;
+ selectDayBy: SelectDayType;
+ reserved2: UInt8;
+ end;
+ DaySelectorPtr = ^DaySelectorType;
+
+procedure DayDrawDaySelector(const selectorP: DaySelectorPtr); syscall sysTrapDayDrawDaySelector;
+
+function DayHandleEvent(const selectorP: DaySelectorPtr; const pEvent: EventPtr): Boolean; syscall sysTrapDayHandleEvent;
+
+procedure DayDrawDays(const selectorP: DaySelectorPtr); syscall sysTrapDayDrawDays;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/dlserver.pp b/packages/palmunits/src/dlserver.pp
new file mode 100644
index 0000000000..8d9f56ad8e
--- /dev/null
+++ b/packages/palmunits/src/dlserver.pp
@@ -0,0 +1,403 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: DLServer.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit dlserver;
+
+interface
+
+uses palmos, coretraps, errorbase, datamgr;
+
+(************************************************************
+ * DLK result codes
+ * (dlkErrorClass is defined in SystemMgr.h)
+ *************************************************************)
+
+const
+ dlkErrParam = dlkErrorClass or 1; // invalid parameter
+ dlkErrMemory = dlkErrorClass or 2; // memory allocation error
+ dlkErrNoSession = dlkErrorClass or 3; // could not establish a session
+
+ dlkErrSizeErr = dlkErrorClass or 4; // reply length was too big
+
+ dlkErrLostConnection = dlkErrorClass or 5; // lost connection
+ dlkErrInterrupted = dlkErrorClass or 6; // sync was interrupted (see sync state)
+ dlkErrUserCan = dlkErrorClass or 7; // cancelled by user
+ dlkErrIncompatibleProducts = dlkErrorClass or 8; // incompatible desktop version
+ dlkErrNPOD = dlkErrorClass or 9; // New Password, Old Desktop
+
+(********************************************************************
+ * Desktop Link system preferences resource for user info
+ * id = sysResIDDlkUserInfo, defined in SystemResources.h
+ ********************************************************************)
+
+const
+ dlkMaxUserNameLength = 40;
+ dlkUserNameBufSize = dlkMaxUserNameLength + 1;
+
+const
+ dlkMaxLogSize = 20 * 1024;
+// dlkMaxLogSize = 2 * 1024;
+
+type
+ DlkSyncStateType = Enum;
+
+const
+ dlkSyncStateNeverSynced = 0; // never synced
+ dlkSyncStateInProgress = Succ(dlkSyncStateNeverSynced); // sync is in progress
+ dlkSyncStateLostConnection = Succ(dlkSyncStateInProgress); // connection lost during sync
+ dlkSyncStateLocalCan = Succ(dlkSyncStateLostConnection); // cancelled by local user on handheld
+ dlkSyncStateRemoteCan = Succ(dlkSyncStateLocalCan); // cancelled by user from desktop
+ dlkSyncStateLowMemoryOnTD = Succ(dlkSyncStateRemoteCan); // sync ended due to low memory on handheld
+ dlkSyncStateAborted = Succ(dlkSyncStateLowMemoryOnTD); // sync was aborted for some other reason
+ dlkSyncStateCompleted = Succ(dlkSyncStateAborted); // sync completed normally
+
+ // Added in PalmOS v3.0:
+ dlkSyncStateIncompatibleProducts = Succ(dlkSyncStateCompleted); // sync ended because desktop HotSync product
+ // is incompatible with this version
+ // of the handheld HotSync
+ dlkSyncStateNPOD = Succ(dlkSyncStateIncompatibleProducts); // New Password, Old Desktop
+
+const
+ dlkUserInfoPrefVersion = $0102; // current user info pref version: 1.2
+
+type
+ DlkUserInfoHdrType = record
+ version: UInt16; // pref version number
+ userID: UInt32; // user id
+ viewerID: UInt32; // id assigned to viewer by the desktop
+ lastSyncPC: UInt32; // last sync PC id
+ succSyncDate: UInt32; // last successful sync date
+ lastSyncDate: UInt32; // last sync date
+ lastSyncState: DlkSyncStateType; // last sync status
+ reserved1: UInt8; // Explicitly account for 16-bit alignment padding
+ lanSyncEnabled: UInt16; // if non-zero, LAN Sync is enabled
+ hsTcpPortNum: UInt32; // TCP/IP port number of Desktop HotSync
+ dwReserved1: UInt32; // RESERVED -- set to NULL!
+ dwReserved2: UInt32; // RESERVED -- set to NULL!
+ userNameLen: UInt8; // length of name field(including null)
+ reserved2: UInt8; // Explicitly account for 16-bit alignment padding
+ syncLogLen: UInt16; // length of sync log(including null)
+ end;
+
+ DlkUserInfoType = record
+ header: DlkUserInfoHdrType; // fixed size header
+ nameAndLog: array [0..1] of Char; // user name, followed by sync log;
+ // both null-terminated(for debugging)
+ end;
+
+ DlkUserInfoPtr = ^DlkUserInfoType; // user info pointer
+
+(********************************************************************
+ * Desktop Link system preferences resource for the Conduit Filter Table
+ * id = sysResIDDlkCondFilterTab, defined in SystemResources.h
+ ********************************************************************)
+
+//
+// Table for specifying conduits to "filter out" during HotSync
+//
+
+// This table consists of DlkCondFilterTableHdrType header followed by a
+// variable number of DlkCondFilterEntryType entries
+
+type
+ DlkCondFilterTableHdrType = record
+ entryCount: UInt16;
+ end;
+ DlkCondFilterTableHdrPtr = ^DlkCondFilterTableHdrType;
+
+ DlkCondFilterEntryType = record
+ creator: UInt32;
+ type_: UInt32;
+ end;
+ DlkCondFilterEntryPtr = ^DlkCondFilterEntryType;
+
+ DlkCondFilterTableType = record
+ hdr: DlkCondFilterTableHdrType; // table header
+ entry: array [0..0] of DlkCondFilterEntryType; // variable number of entries
+ end;
+ DlkCondFilterTablePtr = ^DlkCondFilterTableType;
+
+(********************************************************************
+ * DLK Session Structures
+ ********************************************************************)
+
+// DesktopLink event notification callback. If non-zero is returned,
+// sync will be cancelled as soon as a safe point is reached.
+type
+ DlkEventType = Enum;
+
+const
+ dlkEventOpeningConduit = 1; // conduit is being opened -- paramP
+ // is null;
+
+ dlkEventDatabaseOpened = Succ(dlkEventOpeningConduit); // client has opened a database -- paramP
+ // points to DlkEventDatabaseOpenedType;
+
+ dlkEventCleaningUp = Succ(dlkEventDatabaseOpened); // last stage of sync -- cleaning up (notifying apps, etc) --
+ // paramP is null
+
+ dlkEventSystemResetRequested = Succ(dlkEventCleaningUp); // system reset was requested by the desktop client
+ // (the normal action is to delay the reset until
+ // end of sync) -- paramP is null
+
+// Prototype for the event notification callback
+type
+ DlkEventProc = function(eventRef: UInt32; dlkEvent: DlkEventType; paramP: Pointer): Int16;
+
+// Parameter structure for dlkEventDatabaseOpened
+// Added new fields for Pilot v2.0 vmk 12/24/96
+type
+ DlkEventDatabaseOpenedType = record
+ dbR: DmOpenRef; // open database ref (v2.0)
+ dbNameP: PChar; // database name
+ dbType: UInt32; // databse type (v2.0)
+ dbCreator: UInt32; // database creator
+ end;
+
+// Prototype for the "user cancel" check callback function
+
+type
+ DlkUserCanProc = function(canRef: UInt32): Int16;
+
+//
+// List of modified database creators maintained by DLP Server
+//
+ DlkDBCreatorList = record
+ count: UInt16; // number of entries in the list
+ listH: MemHandle; // chunk MemHandle of the creators list
+ end;
+
+//
+// Desktop Link Server state flags
+//
+const
+ dlkStateFlagVerExchanged = $8000;
+ dlkStateFlagSyncDateSet = $4000;
+
+//
+// DLP Server session information
+//
+
+type
+ DlkServerSessionType = record
+ htalLibRefNum: UInt16; // HTAL library reference number - the library has a live connection
+ maxHtalXferSize: UInt32; // Maximum transfer block size
+
+ // Information supplied by user
+ eventProcP: DlkEventProc; // ptr to DesktopLink event notification proc
+ eventRef: UInt32; // user reference value for event proc
+ canProcP: DlkUserCanProc; // ptr to user-cancel function
+ canRef: UInt32; // parameter for canProcP()
+ condFilterH: MemHandle; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+
+ // Current database information
+ dlkDBID: UInt8; // Desktop Link database MemHandle of the open database
+ reserved1: UInt8;
+ dbR: DmOpenRef; // TouchDown database access pointer -- if null, no current db
+ cardNo: UInt16; // memory module number
+ dbCreator: UInt32; // creator id
+ dbName: array [0..dmDBNameLength-1] of Char; // DB name
+ dbOpenMode: UInt16; // database open mode
+ created: Boolean; // true if the current db was created
+ isResDB: Boolean; // set to true if resource database
+ ramBased: Boolean; // true if the db is in RAM storage
+ readOnly: Boolean; // true if the db is read-only
+ dbLocalID: LocalID; // TouchDown LocalID of the database
+ initialModNum: UInt32; // initial DB modification number
+ curRecIndex: UInt32; // current record index for enumeration functions
+ // (0=beginning)
+
+ // List of modified database creators maintained by DLP Server
+ creatorList: DlkDBCreatorList;
+
+ // Session status information
+ syncState: DlkSyncStateType; // current sync state;
+
+ complete: Boolean; // set to true when completion request
+ // has been received
+
+ conduitOpened: Boolean; // set to true after the first coduit
+ // is opened by remote
+
+ logCleared: Boolean; // 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)
+
+ resetPending: Boolean; // set to true if system reset is pending;
+ // the reset will be carried out at end
+ // of sync
+
+ // Current request information
+ gotCommand: Boolean; // set to true when got a request
+ cmdTID: UInt8; // current transaction ID
+ reserved2: UInt8;
+ cmdLen: UInt16; // size of data in request buffer
+ cmdP: Pointer; // pointer to command
+ cmdH: MemHandle; // MemHandle of command buffer
+
+ // Fields added in PalmOS v3.0
+ wStateFlags: UInt16; // bitfield of dlkStateFlag... bits
+ dbSearchState: DmSearchStateType; // database search state for iterative
+ // searches using DmGetNextDatabaseByTypeCreator
+
+ // Fields added in PalmOS v4.0
+ openFileRefsH: MemHandle ; // Table of open file refs
+ numOpenFileRefs: Int16; // Current size of the file ref table.
+ pre40Desktop: Boolean; // are we using a pre-4.0 desktop (DLP v1.2)
+ passwordSet: Boolean; // is a password set?
+ end;
+
+ DlkServerSessionPtr = ^DlkServerSessionType;
+
+(********************************************************************
+ * DLK Function Parameter Structures
+ ********************************************************************)
+
+//
+// Parameter passed to DlkControl()
+//
+
+type
+ DlkCtlEnum = Enum;
+
+const
+ dlkCtlFirst = 0; // reserve 0
+
+ //
+ // Pilot v2.0 control codes:
+ //
+ dlkCtlGetPCHostName = Succ(dlkCtlFirst); // 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 = Succ(dlkCtlGetPCHostName); // 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 = Succ(dlkCtlSetPCHostName); // 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 = Succ(dlkCtlGetCondFilterTable); // 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 = Succ(dlkCtlSetCondFilterTable); // param1P = ptr to store for the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlSetLANSync = Succ(dlkCtlGetLANSync); // param1P = ptr to the LANSync setting(UInt16): 0 = off, otherwise on
+ // param2P = not used, set to NULL
+
+ dlkCtlGetHSTCPPort = Succ(dlkCtlSetLANSync); // param1P = ptr to store for the Desktop HotSync TCP/IP port number(UInt32) -- zero if not set
+ // param2P = not used, set to NULL
+
+ dlkCtlSetHSTCPPort = Succ(dlkCtlGetHSTCPPort); // param1P = ptr to the Desktop HotSync TCP/IP port number(UInt32)
+ // param2P = not used, set to NULL
+
+ dlkCtlSendCallAppReply = Succ(dlkCtlSetHSTCPPort); // 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 = Succ(dlkCtlSendCallAppReply); // 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 = Succ(dlkCtlGetPCHostAddr); // 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 = Succ(dlkCtlSetPCHostAddr); // 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 = Succ(dlkCtlGetPCHostMask); // 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 = Succ(dlkCtlSetPCHostMask); // *KEEP THIS ENTRY LAST*
+
+//
+// Parameter passed to DlkStartServer()
+//
+
+type
+ DlkServerParamType = record
+ htalLibRefNum: UInt16; // HTAL library reference number - the library has a live connection
+ eventProcP: DlkEventProc; // ptr to DesktopLink event notification proc
+ eventRef: UInt32; // user reference value for event proc
+ reserved1: UInt32; // reserved - set to NULL
+ reserved2: UInt32; // reserved - set to NULL
+ condFilterH: MemHandle; // MemHandle of conduit filter table(DlkCondFilterTableHdrPtr) or 0 for none
+ end;
+
+ DlkServerParamPtr = ^DlkServerParamType;
+
+//
+// Parameter passed with DlkControl()'s dlkCtlSendCallAppReply code
+//
+
+type
+ DlkCallAppReplyParamType = record
+ pbSize: UInt16; // size of this parameter block (set to sizeof(DlkCallAppReplyParamType))
+ dwResultCode: UInt32; // result code to be returned to remote caller
+ {const} resultP: Pointer; // ptr to result data
+ dwResultSize: UInt32; // size of reply data in number of bytes
+ dlRefP: Pointer; // DesktopLink reference pointer from
+ // SysAppLaunchCmdHandleSyncCallAppType
+ dwReserved1: UInt32; // RESERVED -- set to null!!!
+ end;
+
+(********************************************************************
+ * DesktopLink Server Routines
+ ********************************************************************)
+
+//
+// SERVER API
+//
+
+// * RETURNED: 0 if session ended successfully; otherwise: dlkErrParam,
+// * dlkErrNoSession, dlkErrLostConnection, dlkErrMemory,
+// * dlkErrUserCan
+
+function DlkStartServer(paramP: DlkServerParamPtr): Err; syscall sysTrapDlkStartServer;
+
+function DlkGetSyncInfo(var succSyncDateP, lastSyncDateP: UInt32;
+ var syncStateP: DlkSyncStateType; nameBufP, logBufP: PChar;
+ var logLenP: Int32): Err; syscall sysTrapDlkGetSyncInfo;
+
+procedure DlkSetLogEntry(const textP: PChar; textLen: Int16; append: Boolean); syscall sysTrapDlkSetLogEntry;
+
+// Dispatch a DesktopLink request (exposed for patching)
+function DlkDispatchRequest(sessP: DlkServerSessionPtr): Err; syscall sysTrapDlkDispatchRequest;
+
+function DlkControl(op: DlkCtlEnum; param1P, param2P: Pointer): Err; syscall sysTrapDlkControl;
+
+(********************************************************************
+ * DLK Macros
+ ********************************************************************)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/encrypt.pp b/packages/palmunits/src/encrypt.pp
new file mode 100644
index 0000000000..162ed1c3e1
--- /dev/null
+++ b/packages/palmunits/src/encrypt.pp
@@ -0,0 +1,50 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Encrypt.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Equates for encryption/digestion routines in pilot
+ *
+ * History:
+ * 7/31/96 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit encrypt;
+
+interface
+
+uses palmos, coretraps;
+
+(************************************************************
+ * Function Prototypes
+ *************************************************************)
+
+// Perform reversible encryption or decryption of 8 byte string in
+// srcP using 8 byte key keyP. Place 8 byte result in dstP.
+
+function EncDES(srcP, keyP, dstP: UInt8Ptr; encrypt: Boolean): Err; syscall sysTrapEncDES;
+
+// Digest a string of bytes and produce a 128 bit result using
+// the MD4 algorithm.
+
+type
+ TDigestArray = array [0..15] of UInt8;
+
+function EncDigestMD4(strP: UInt8Ptr; strLen: UInt16; var digestP: TDigestArray): Err; syscall sysTrapEncDigestMD4;
+
+// Digest a string of bytes and produce a 128 bit result using
+// the MD5 algorithm.
+
+function EncDigestMD5(strP: UInt8Ptr; strLen: UInt16; var digestP: TDigestArray): Err; syscall sysTrapEncDigestMD5;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/errorbase.pp b/packages/palmunits/src/errorbase.pp
new file mode 100644
index 0000000000..cbfb4669ca
--- /dev/null
+++ b/packages/palmunits/src/errorbase.pp
@@ -0,0 +1,270 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ErrorBase.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ * 05/10/00 kwk Added intlErrorClass.
+ * 08/24/00 SCL Added hwrErrorClass.
+ *
+ *-----------------------------------------------------------------------
+ * 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
+ *
+ *****************************************************************************)
+
+unit errorbase;
+
+interface
+
+uses palmos, coretraps;
+
+// Max message length supported by ErrCustomAlert
+const
+ errMaxMsgLength = 511;
+
+(************************************************************
+ * Error Classes for each manager
+ *************************************************************)
+
+ errNone = $0000; // No error
+
+ memErrorClass = $0100; // Memory Manager
+ dmErrorClass = $0200; // Data Manager
+ serErrorClass = $0300; // Serial Manager
+ slkErrorClass = $0400; // Serial Link Manager
+ sysErrorClass = $0500; // System Manager
+ fplErrorClass = $0600; // Floating Point Library
+ flpErrorClass = $0680; // New Floating Point Library
+ evtErrorClass = $0700; // System Event Manager
+ sndErrorClass = $0800; // Sound Manager
+ almErrorClass = $0900; // Alarm Manager
+ timErrorClass = $0A00; // Time Manager
+ penErrorClass = $0B00; // Pen Manager
+ ftrErrorClass = $0C00; // Feature Manager
+ cmpErrorClass = $0D00; // Connection Manager (HotSync)
+ dlkErrorClass = $0E00; // Desktop Link Manager
+ padErrorClass = $0F00; // PAD Manager
+ grfErrorClass = $1000; // Graffiti Manager
+ mdmErrorClass = $1100; // Modem Manager
+ netErrorClass = $1200; // Net Library
+ htalErrorClass = $1300; // HTAL Library
+ inetErrorClass = $1400; // INet Library
+ exgErrorClass = $1500; // Exg Manager
+ fileErrorClass = $1600; // File Stream Manager
+ rfutErrorClass = $1700; // RFUT Library
+ txtErrorClass = $1800; // Text Manager
+ tsmErrorClass = $1900; // Text Services Library
+ webErrorClass = $1A00; // Web Library
+ secErrorClass = $1B00; // Security Library
+ emuErrorClass = $1C00; // Emulator Control Manager
+ flshErrorClass = $1D00; // Flash Manager
+ pwrErrorClass = $1E00; // Power Manager
+ cncErrorClass = $1F00; // Connection Manager (Serial Communication)
+ actvErrorClass = $2000; // Activation application
+ radioErrorClass = $2100; // Radio Manager (Library)
+ dispErrorClass = $2200; // Display Driver Errors.
+ bltErrorClass = $2300; // Blitter Driver Errors.
+ winErrorClass = $2400; // Window manager.
+ omErrorClass = $2500; // Overlay Manager
+ menuErrorClass = $2600; // Menu Manager
+
+ lz77ErrorClass = $2700; // Lz77 Library
+ smsErrorClass = $2800; // Sms Library
+ expErrorClass = $2900; // Expansion Manager and Slot Driver Library
+ vfsErrorClass = $2A00; // Virtual Filesystem Manager and Filesystem library
+ lmErrorClass = $2B00; // Locale Manager
+ intlErrorClass = $2C00; // International Manager
+ pdiErrorClass = $2D00; // PDI Library
+ attnErrorClass = $2E00; // Attention Manager
+ telErrorClass = $2F00; // Telephony Manager
+ hwrErrorClass = $3000; // Hardware Manager (HAL)
+ blthErrorClass = $3100; // Bluetooth Library Error Class
+ udaErrorClass = $3200; // UDA Manager Error Class
+
+ oemErrorClass = $7000; // OEM/Licensee errors (0x7000-0x7EFF shared among ALL partners)
+ errInfoClass = $7F00; // special class shows information w/o error code
+ appErrorClass = $8000; // 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
+ ********************************************************************)
+
+type
+ ErrJumpBuf = array [0..12-1] of ^Integer; // D3-D7,PC,A2-A7
+
+// Structure used to store Try state.
+type
+ ErrExceptionPtr = ^ErrExceptionType;
+ ErrExceptionType = record
+ nextP: ErrExceptionPtr; // next exception type
+ state: ErrJumpBuf; // setjmp/longjmp storage
+ err: Int32; // Error code
+ end;
+
+// 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
+ ********************************************************************)
+
+//function ErrSetJump(buf: ErrJumpBuf): Int16; syscall sysTrapErrSetJump;
+
+//procedure ErrLongJump(buf: ErrJumpBuf; result: Int16); syscall sysTrapErrLongJump;
+
+function ErrExceptionList: MemPtrPtr; syscall sysTrapErrExceptionList;
+
+procedure ErrThrow(err_: Int32); syscall sysTrapErrThrow;
+
+procedure ErrDisplayFileLineMsg(const filename: PChar; lineNo: UInt16; const msg: PChar); syscall 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'
+//---------------------------------------------------------------------
+
+function ErrAlertCustom(errCode: Err; errMsgP, preMsgP, postMsgP: PChar): UInt16; syscall sysTrapErrAlertCustom;
+
+function ErrAlert(err: Err): UInt16;
+
+implementation
+
+function ErrAlert(err: Err): UInt16;
+begin
+ ErrAlert := ErrAlertCustom(err, nil, nil, nil);
+end;
+
+end.
diff --git a/packages/palmunits/src/event_.pp b/packages/palmunits/src/event_.pp
new file mode 100644
index 0000000000..9cef52abcd
--- /dev/null
+++ b/packages/palmunits/src/event_.pp
@@ -0,0 +1,368 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Event.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines UI event structures and routines.
+ *
+ * History:
+ * September 26, 1994 Created by Art Lamb
+ * 07/14/99 jesse Separated from Event.h
+ * 09/12/99 gap Add for new multi-tap implementation
+ * 09/14/99 gap Removed EvtGetTrapState.
+ * 10/28/99 kwk Added EvtKeydownIsVirtual macro.
+ *
+ *****************************************************************************)
+unit event_;
+
+interface
+
+uses palmos, coretraps, sysevent, control, day, field, list, scrollbar, table;
+
+type
+ eventsEnum = WordEnum;
+
+const
+ nilEvent = 0; // system level
+ penDownEvent = Succ(nilEvent); // system level
+ penUpEvent = Succ(penDownEvent); // system level
+ penMoveEvent = Succ(penUpEvent); // system level
+ keyDownEvent = Succ(penMoveEvent); // system level
+ winEnterEvent = Succ(keyDownEvent); // system level
+ winExitEvent = Succ(winEnterEvent); // system level
+ ctlEnterEvent = Succ(winExitEvent);
+ ctlExitEvent = Succ(ctlEnterEvent);
+ ctlSelectEvent = Succ(ctlExitEvent);
+ ctlRepeatEvent = Succ(ctlSelectEvent);
+ lstEnterEvent = Succ(ctlRepeatEvent);
+ lstSelectEvent = Succ(lstEnterEvent);
+ lstExitEvent = Succ(lstSelectEvent);
+ popSelectEvent = Succ(lstExitEvent);
+ fldEnterEvent = Succ(popSelectEvent);
+ fldHeightChangedEvent = Succ(fldEnterEvent);
+ fldChangedEvent = Succ(fldHeightChangedEvent);
+ tblEnterEvent = Succ(fldChangedEvent);
+ tblSelectEvent = Succ(tblEnterEvent);
+ daySelectEvent = Succ(tblSelectEvent);
+ menuEvent = Succ(daySelectEvent);
+ appStopEvent = 22; // system level
+ frmLoadEvent = Succ(appStopEvent);
+ frmOpenEvent = Succ(frmLoadEvent);
+ frmGotoEvent = Succ(frmOpenEvent);
+ frmUpdateEvent = Succ(frmGotoEvent);
+ frmSaveEvent = Succ(frmUpdateEvent);
+ frmCloseEvent = Succ(frmSaveEvent);
+ frmTitleEnterEvent = Succ(frmCloseEvent);
+ frmTitleSelectEvent = Succ(frmTitleEnterEvent);
+ tblExitEvent = Succ(frmTitleSelectEvent);
+ sclEnterEvent = Succ(tblExitEvent);
+ sclExitEvent = Succ(sclEnterEvent);
+ sclRepeatEvent = Succ(sclExitEvent);
+ tsmConfirmEvent = 35; // system level
+ tsmFepButtonEvent = Succ(tsmConfirmEvent); // system level
+ tsmFepModeEvent = Succ(tsmFepButtonEvent); // system level
+
+//DOLATER - peter: remove this: frmTitleChangedEvent, // system level
+ attnIndicatorEnterEvent = Succ(tsmFepModeEvent); // for attention manager's indicator
+ attnIndicatorSelectEvent = Succ(attnIndicatorEnterEvent); // for attention manager's indicator
+
+ // add future UI level events in this numeric space
+ // to save room for new system level events
+ menuCmdBarOpenEvent = $0800;
+ menuOpenEvent = Succ(menuCmdBarOpenEvent);
+ menuCloseEvent = Succ(menuOpenEvent);
+ frmGadgetEnterEvent = Succ(menuCloseEvent);
+ frmGadgetMiscEvent = Succ(frmGadgetEnterEvent);
+
+ // <chg 2-25-98 RM> Equates added for library events
+ firstINetLibEvent = $1000;
+ firstWebLibEvent = $1100;
+
+ // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
+ // Enums are signed ints, so 32767 technically only allowed for ONE event.
+ firstUserEvent = $6000;
+ lastUserEvent = $7FFF;
+
+type
+ ctlEnter = record
+ controlID: UInt16;
+ pControl: ControlPtr;
+ end;
+
+ ctlExit = record
+ controlID: UInt16;
+ pControl: ControlPtr;
+ end;
+
+ ctlSelect = record
+ controlID: UInt16;
+ pControl: ControlPtr;
+ on: Boolean;
+ reserved1: UInt8;
+ value: UInt16; // used for slider controls only
+ end;
+
+ ctlRepeat = record
+ controlID: UInt16;
+ pControl: ControlPtr;
+ time: UInt32;
+ value: UInt16; // used for slider controls only
+ end;
+
+ fldEnter = record
+ fieldID: UInt16;
+ pField: FieldPtr;
+ end;
+
+ fldHeightChanged = record
+ fieldID: UInt16;
+ pField: FieldPtr;
+ newHeight: Int16;
+ currentPos: UInt16;
+ end;
+
+ fldChanged = record
+ fieldID: UInt16;
+ pField: ^FieldType;
+ end;
+
+ fldExit = record
+ fieldID: UInt16;
+ pField: ^FieldType;
+ end;
+
+ lstEnter = record
+ listID: UInt16;
+ pList: ^ListType;
+ selection: Int16;
+ end;
+
+ lstExit = record
+ listID: UInt16;
+ pList: ListPtr;
+ end;
+
+ lstSelect = record
+ listID: UInt16;
+ pList: ^ListType;
+ selection: Int16;
+ end;
+
+ tblEnter = record
+ tableID: UInt16;
+ pTable: TablePtr;
+ row: Int16;
+ column: Int16;
+ end;
+
+ tblExit = record
+ tableID: UInt16;
+ pTable: TablePtr;
+ row: Int16;
+ column: Int16;
+ end;
+
+ tblSelect = record
+ tableID: UInt16;
+ pTable: TablePtr;
+ row: Int16;
+ column: Int16;
+ end;
+
+ frmLoad = record
+ formID: UInt16;
+ end;
+
+ frmOpen = record
+ formID: UInt16;
+ end;
+
+ frmGoto = record
+ formID: UInt16;
+ recordNum: UInt16; // index of record that contain a match
+ matchPos: UInt16; // postion in record of the match.
+ matchLen: UInt16; // length of match.
+ matchFieldNum: UInt16; // field number string was found int
+ matchCustom: UInt32; // application specific info
+ end;
+
+ frmClose = record
+ formID: UInt16;
+ end;
+
+ frmUpdate = record
+ formID: UInt16;
+ updateCode: UInt16; // Application specific
+ end;
+
+ frmTitleEnter = record
+ formID: UInt16;
+ end;
+
+ frmTitleSelect = record
+ formID: UInt16;
+ end;
+
+ attnIndicatorEnter = record
+ formID: UInt16;
+ end;
+
+ attnIndicatorSelect = record
+ formID: UInt16;
+ end;
+
+ daySelect = record
+ pSelector: ^DaySelectorType;
+ selection: Int16;
+ useThisDate: Boolean;
+ reserved1: UInt8;
+ end;
+
+ menu = record
+ itemID: UInt16;
+ end;
+
+ popSelect = record
+ controlID: UInt16;
+ controlP: ^ControlType;
+ listID: UInt16;
+ listP: ^ListType;
+ selection: Int16;
+ priorSelection: Int16;
+ end;
+
+ sclEnter = record
+ scrollBarID: UInt16;
+ pScrollBar: ^ScrollBarType;
+ end;
+
+ sclExit = record
+ scrollBarID: UInt16;
+ pScrollBar: ^ScrollBarType;
+ value: Int16;
+ newValue: Int16;
+ end;
+
+ sclRepeat = record
+ scrollBarID: UInt16;
+ pScrollBar: ^ScrollBarType;
+ value: Int16;
+ newValue: Int16;
+ time: Int32;
+ end;
+
+ menuCmdBarOpen = record
+ preventFieldButtons: Boolean; // set to stop the field from automatically adding cut/copy/paste
+ reserved: UInt8; // alignment padding
+ end;
+
+ menuOpen = record
+ menuRscID: UInt16;
+ //struct MenuBarType *pMenu;
+ cause: Int16;
+ end;
+
+ gadgetEnter = record
+ gadgetID: UInt16; // must be same as gadgetMisc
+ gadgetP: Pointer{^FormGadgetType}; // must be same as gadgetMisc
+ end;
+
+ gadgetMisc = record
+ gadgetID: UInt16; // must be same as gadgetEnter
+ gadgetP: Pointer{^FormGadgetType}; // must be same as gadgetEnter
+ selector: UInt16;
+ dataP: Pointer;
+ end;
+
+// The event record.
+type
+ EventType = record
+ eType: eventsEnum;
+ penDown: Boolean;
+ tapCount: UInt8;
+ screenX: Int16;
+ screenY: Int16;
+ case Integer of
+ 1: (generic: _GenericEventType);
+ 2: (penUp: _PenUpEventType);
+ 3: (keyDown: _KeyDownEventType);
+ 4: (winEnter: _WinEnterEventType);
+ 5: (winExit: _WinExitEventType);
+ 6: (tsmConfirm: _TSMConfirmType);
+ 7: (tsmFepButton: _TSMFepButtonType);
+ 8: (tsmFepMode: _TSMFepModeEventType);
+ 9: (ctlEnter: ctlEnter);
+ 10: (ctlSelect: ctlSelect);
+ 11: (ctlRepeat: ctlRepeat);
+ 12: (ctlExit: ctlExit);
+ 13: (fldEnter: fldEnter);
+ 14: (fldHeightChanged: fldHeightChanged);
+ 15: (fldChanged: fldChanged);
+ 16: (fldExit: fldExit);
+ 17: (lstEnter: lstEnter);
+ 18: (lstExit: lstExit);
+ 19: (lstSelect: lstSelect);
+ 20: (tblEnter: tblEnter);
+ 21: (tblExit: tblExit);
+ 22: (tblSelect: tblSelect);
+ 23: (frmLoad: frmLoad);
+ 24: (frmOpen: frmOpen);
+ 25: (frmGoto: frmGoto);
+ 26: (frmClose: frmClose);
+ 27: (frmUpdate: frmUpdate);
+ 28: (frmTitleEnter: frmTitleEnter);
+ 29: (frmTitleSelect: frmTitleSelect);
+ 30: (attnIndicatorEnter: attnIndicatorEnter);
+ 31: (attnIndicatorSelect: attnIndicatorSelect);
+ 32: (daySelect: daySelect);
+ 33: (menu: menu);
+ 34: (popSelect: popSelect);
+ 35: (sclEnter: sclEnter);
+ 36: (sclExit: sclExit);
+ 37: (sclRepeat: sclRepeat);
+ 38: (menuCmdBarOpen: menuCmdBarOpen);
+ 39: (menuOpen: menuOpen);
+ 40: (gadgetEnter: gadgetEnter);
+ 41: (gadgetMisc: gadgetMisc);
+ end;
+
+ TEvent = EventType;
+ EventPtr = ^EventType;
+
+// Evaluate to true if <eventP> is a pointer to a virtual character key-
+// down event. We assume that the caller has already determined the event
+// is a keydown. 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
+
+function EvtKeydownIsVirtual(eventP: EventPtr): Boolean;
+
+//---------------------------------------------------------------------
+// Event Functions
+//---------------------------------------------------------------------
+
+procedure EvtAddEventToQueue(const event: EventPtr); syscall sysTrapEvtAddEventToQueue;
+
+procedure EvtAddUniqueEventToQueue(const eventP: EventPtr; id: UInt32; inPlace: Boolean); syscall sysTrapEvtAddUniqueEventToQueue;
+
+procedure EvtCopyEvent(const source: EventPtr; dest: EventPtr); syscall sysTrapEvtCopyEvent;
+
+procedure EvtGetEvent(var event: EventType; timeout: Int32); syscall sysTrapEvtGetEvent;
+
+function EvtEventAvail: Boolean; syscall sysTrapEvtEventAvail;
+
+procedure EvtGetPen(var pScreenX, pScreenY: Int16; var pPenDown: Boolean); syscall sysTrapEvtGetPen;
+
+implementation
+
+function EvtKeydownIsVirtual(eventP: EventPtr): Boolean;
+begin
+ EvtKeydownIsVirtual := (eventP^.keyDown.modifiers and virtualKeyMask) <> 0
+end;
+
+end.
diff --git a/packages/palmunits/src/exglib.pp b/packages/palmunits/src/exglib.pp
new file mode 100644
index 0000000000..aa90086322
--- /dev/null
+++ b/packages/palmunits/src/exglib.pp
@@ -0,0 +1,121 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ExgLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file the Exchange Library interface. The Exchange Library is a
+ * generic interface to any number of librarys. Any Exchange Library
+ * MUST have entrypoint traps in exactly the order listed here.
+ * The System Exchange manager functions call these functions when
+ * applications make calls to the Exchange manager. Applications will
+ * usually not make direct calls to this API.
+ *
+ * History:
+ * 5/23/97 Created by Gavin Peacock
+ *
+ *****************************************************************************)
+
+unit exglib;
+
+interface
+
+uses palmos, libtraps, exgmgr;
+
+// special exchange mgr event key
+const
+ exgIntDataChr = $01ff;
+
+//-----------------------------------------------------------------------------
+// Obx library call ID's. Each library call gets the trap number:
+// exgTrapXXXX 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 and Exchange library!!!
+//-----------------------------------------------------------------------------
+
+type
+ ExgLibTrapNumberEnum = Enum;
+
+const
+ exgLibTrapHandleEvent = sysLibTrapCustom;
+ exgLibTrapConnect = Succ(exgLibTrapHandleEvent);
+ exgLibTrapAccept = Succ(exgLibTrapConnect);
+ exgLibTrapDisconnect = Succ(exgLibTrapAccept);
+ exgLibTrapPut = Succ(exgLibTrapDisconnect);
+ exgLibTrapGet = Succ(exgLibTrapPut);
+ exgLibTrapSend = Succ(exgLibTrapGet);
+ exgLibTrapReceive = Succ(exgLibTrapSend);
+ exgLibTrapControl = Succ(exgLibTrapReceive);
+ exgLibTrapRequest = Succ(exgLibTrapControl);
+ exgLibTrapReserved1 = Succ(exgLibTrapRequest);
+ exgLibTrapReserved2 = Succ(exgLibTrapReserved1);
+ exgLibTrapReserved3 = Succ(exgLibTrapReserved2);
+ exgLibTrapReserved4 = Succ(exgLibTrapReserved3);
+ exgLibTrapReserved5 = Succ(exgLibTrapReserved4);
+ exgLibTrapReserved6 = Succ(exgLibTrapReserved5);
+ exgLibTrapReserved7 = Succ(exgLibTrapReserved6);
+ exgLibTrapReserved8 = Succ(exgLibTrapReserved7);
+ exgLibTrapReserved9 = Succ(exgLibTrapReserved8);
+ exgLibTrapReserved10 = Succ(exgLibTrapReserved9);
+ exgLibTrapLast = Succ(exgLibTrapReserved10);
+
+(************************************************************
+ * Net Library procedures.
+ *************************************************************)
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+// Open the library - enable server for receiving data.
+function ExgLibOpen(libRefnum: UInt16): Err; syscall sysLibTrapOpen;
+
+function ExgLibClose(libRefnum: UInt16): Err; syscall sysLibTrapClose;
+
+function ExgLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
+
+function ExgLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
+
+// MemHandle events that this library needs. This will be called by
+// sysHandle event when certain low level events are triggered.
+function ExgLibHandleEvent(libRefnum: UInt16; eventP: Pointer): Boolean; syscall exgLibTrapHandleEvent;
+
+// Establish a new connection
+function ExgLibConnect(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapConnect;
+
+// Accept a connection request from remote end
+function ExgLibAccept(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapAccept;
+
+// Disconnect
+function ExgLibDisconnect(libRefnum: UInt16; exgSocketP: ExgSocketPtr; error: Err): Err; syscall exgLibTrapDisconnect;
+
+// Initiate a Put command. This passes the name and other information about
+// an object to be sent
+function ExgLibPut(libRefnum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapPut;
+
+// Initiate a Get command. This requests an object from the remote end.
+function ExgLibGet(libRefNum: UInt16; exgSocketP: ExgSocketPtr): Err; syscall exgLibTrapGet;
+
+// Send data to remote end - called after a Put command
+function ExgLibSend(libRefNum: UInt16; exgSocketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var errP: Err): UInt32; syscall exgLibTrapSend;
+
+// Receive data from remote end -- called after Accept
+function ExgLibReceive(libRefNum: UInt16; exgSocketP: ExgSocketPtr; bufP: Pointer; const bufSize: UInt32; var errP: Err): UInt32; syscall exgLibTrapReceive;
+
+// Send various option commands to the Exg library
+function ExgLibControl(libRefNum: UInt16; op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall exgLibTrapControl;
+
+// Tell the Exg library to check for incoming data
+function ExgLibRequest(libRefNum: UInt16; socketP: ExgSocketPtr): Err; syscall exgLibTrapRequest;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/exgmgr.pp b/packages/palmunits/src/exgmgr.pp
new file mode 100644
index 0000000000..825f2d962e
--- /dev/null
+++ b/packages/palmunits/src/exgmgr.pp
@@ -0,0 +1,162 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ErrorMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Error Management that depend on ERROR_CHECK_LEVEL
+ * All the rest of the old ErrorMgr.h is in ErrorBase.h
+ *
+ * History:
+ * 10/25/94 RM - Created by Ron Marianetti
+ * 10/9/98 Bob - Fill in all macros, fix defns w/ do{}while(0)
+ * 7/21/99 Bob - split invariant stuff out into ErrorBase.h
+ * 12/23/99 jmp Fix <> vs. "" problem.
+ *
+ *****************************************************************************)
+
+unit exgmgr;
+
+interface
+
+uses palmos, coretraps, errorbase, datamgr;
+
+const
+ exgMemError = exgErrorClass or 1;
+ exgErrStackInit = exgErrorClass or 2; // stack could not initialize
+ exgErrUserCancel = exgErrorClass or 3;
+ exgErrNoReceiver = exgErrorClass or 4; // receiver device not found
+ exgErrNoKnownTarget = exgErrorClass or 5; // can't find a target app
+ exgErrTargetMissing = exgErrorClass or 6; // target app is known but missing
+ exgErrNotAllowed = exgErrorClass or 7; // operation not allowed
+ exgErrBadData = exgErrorClass or 8; // internal data was not valid
+ exgErrAppError = exgErrorClass or 9; // generic application error
+ exgErrUnknown = exgErrorClass or 10; // unknown general error
+ exgErrDeviceFull = exgErrorClass or 11; // device is full
+ exgErrDisconnected = exgErrorClass or 12; // link disconnected
+ exgErrNotFound = exgErrorClass or 13; // requested object not found
+ exgErrBadParam = exgErrorClass or 14; // bad parameter to call
+ exgErrNotSupported = exgErrorClass or 15; // operation not supported by this library
+ exgErrDeviceBusy = exgErrorClass or 16; // device is busy
+ exgErrBadLibrary = exgErrorClass or 17; // bad or missing ExgLibrary
+
+type
+ ExgGoToType = record
+ dbCardNo: UInt16; // card number of the database
+ dbID: LocalID; // LocalID of the database
+ recordNum: UInt16; // index of record that contain a match
+ uniqueID: UInt32; // postion in record of the match.
+ matchCustom: UInt32; // application specific info
+ end;
+
+ ExgGoToPtr = ^ExgGoToType;
+
+ ExgSocketType = record
+ libraryRef: UInt16; // identifies the Exg library in use
+ socketRef: UInt32; // used by Exg library to identify this connection
+ target: UInt32; // Creator ID of application this is sent to
+ count: UInt32; // # of objects in this connection (usually 1)
+ length: UInt32; // # total byte count for all objects being sent (optional)
+ time: UInt32; // last modified time of object (optional)
+ appData: UInt32; // application specific info
+ goToCreator: UInt32; // creator ID of app to launch with goto after receive
+ goToParams: ExgGoToType; // If launchCreator then this contains goto find info
+ bits: UInt16;
+{
+ UInt16 localMode:1; // Exchange with local machine only mode
+ UInt16 packetMode:1; // Use connectionless packet mode (Ultra)
+ UInt16 noGoTo:1; // Do not go to app (local mode only)
+ UInt16 noStatus:1; // Do not display status dialogs
+ UInt16 reserved:12; // reserved system flags
+}
+ description: PChar; // text description of object (for user)
+ type_: PChar; // Mime type of object (optional)
+ name: PChar; // name of object, generally a file name (optional)
+ end;
+
+ ExgSocketPtr = ^ExgSocketType;
+
+// structures used for sysAppLaunchCmdExgAskUser launch code parameter
+// default is exgAskDialog (ask user with dialog...
+type
+ ExgAskResultType = Enum;
+
+const
+ exgAskDialog = 0;
+ exgAskOk = Succ(exgAskDialog);
+ exgAskCancel = Succ(exgAskOk);
+
+type
+ ExgAskParamType = record
+ socketP: ExgSocketPtr;
+ result: ExgAskResultType; // what to do with dialog
+ reserved: UInt8;
+ end;
+
+ ExgAskParamPtr = ^ExgAskParamType;
+
+// Optional parameter structure used with ExgDoDialog for category control
+ ExgDialogInfoType = record
+ version: UInt16; // version of this structure (should be zero)
+ db: DmOpenRef; // open database ref (for category information)
+ categoryIndex: UInt16; // index of selected category
+ end;
+
+const
+ exgSeparatorChar = #9; // '\t' char used to separate multiple registry entries
+
+ exgRegLibraryID = $fffc; // library register thier presence
+ exgRegExtensionID = $fffd; // filename extenstion registry
+ exgRegTypeID = $fffe; // MIME type registry
+
+ exgDataPrefVersion = 0;
+ exgMaxTitleLen = 20; // max size for title from exgLibCtlGetTitle
+
+ exgLibCtlGetTitle = 1; // get title for Exg dialogs
+ exgLibCtlSpecificOp = $8000; // start of range for library specific control codes
+
+type
+ ExgDBReadProc = function(dataP: Pointer; var sizeP: UInt32; userDataP: Pointer): Err;
+ ExgDBDeleteProc = function(const nameP: PChar; version, cardNo: UInt16; dbID: LocalID; userDataP: Pointer): Boolean;
+ ExgDBWriteProc = function(const dataP: Pointer; var sizeP: UInt32; userDataP: Pointer): Err;
+
+function ExgInit: Err; syscall sysTrapExgInit;
+
+function ExgConnect(socketP: ExgSocketPtr): Err; syscall sysTrapExgConnect;
+
+function ExgPut(socketP: ExgSocketPtr): Err; syscall sysTrapExgPut;
+
+function ExgGet(socketP: ExgSocketPtr): Err; syscall sysTrapExgGet;
+
+function ExgAccept(socketP: ExgSocketPtr): Err; syscall sysTrapExgAccept;
+
+function ExgDisconnect(socketP: ExgSocketPtr; error: Err): Err; syscall sysTrapExgDisconnect;
+
+function ExgSend(socketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var err: Err): UInt32; syscall sysTrapExgSend;
+
+function ExgReceive(socketP: ExgSocketPtr; bufP: Pointer; const bufLen: UInt32; var err: Err): UInt32; syscall sysTrapExgReceive;
+
+function ExgRegisterData(const creatorID: UInt32; const id: UInt16; const dataTypesP: PChar): Err; syscall sysTrapExgRegisterData;
+
+function ExgNotifyReceive(socketP: ExgSocketPtr): Err; syscall sysTrapExgNotifyReceive;
+
+
+function ExgDBRead(readProcP: ExgDBReadProc; deleteProcP: ExgDBDeleteProc;
+ userDataP: Pointer; var dbIDP: LocalID; cardNo: UInt16;
+ var needResetP: Boolean; keepDates: Boolean): Err; syscall sysTrapExgDBRead;
+
+function ExgDBWrite(writeProcP: ExgDBWriteProc;
+ userDataP: Pointer; const nameP: PChar; dbID: LocalID; cardNo: UInt16): Err; syscall sysTrapExgDBWrite;
+
+
+function ExgDoDialog(socketP: ExgSocketPtr; var infoP: ExgDialogInfoType; var errP: Err): Boolean; syscall sysTrapExgDoDialog;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/expansionmgr.pp b/packages/palmunits/src/expansionmgr.pp
new file mode 100644
index 0000000000..dc850940ba
--- /dev/null
+++ b/packages/palmunits/src/expansionmgr.pp
@@ -0,0 +1,237 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ExpansionMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header file for Expansion Manager.
+ *
+ * History:
+ * 02/25/00 jed Created by Jesse Donaldson.
+ *
+ *****************************************************************************)
+unit expansionmgr;
+interface
+uses palmos, coretraps, errorbase;
+const
+ sysTrapExpansionMgr = sysTrapExpansionDispatch;
+ expFtrIDVersion = 0; // ID of feature containing version of ExpansionMgr.
+ // Check existence of this feature to see if ExpMgr is installed.
+ expMgrVersionNum = UInt16(200); // version of the ExpansionMgr, obtained from the feature
+ expInvalidSlotRefNum = 0;
+type
+ ExpPollingProcPtr = function(slotLibRefNum: UInt16; slotPollRefConP: Pointer): Err;
+(************************************************************
+ * Capabilities of the hardware device for ExpCardInfoType.capabilityFlags
+ *************************************************************)
+const
+ expCapabilityHasStorage = $00000001; // card supports reading (& maybe writing) sectors
+ expCapabilityReadOnly = $00000002; // card is read only
+ expCapabilitySerial = $00000004; // card supports dumb serial interface
+ expCardInfoStringMaxLen = 31;
+type
+ ExpCardInfoTag = record
+ capabilityFlags: UInt32; // bits for different stuff the card supports
+ manufacturerStr: array [0..expCardInfoStringMaxLen] of Char; // Manufacturer, e.g., "Palm", "Motorola", etc...
+ productStr: array [0..expCardInfoStringMaxLen] of Char; // Name of product, e.g., "SafeBackup 32MB"
+ deviceClassStr: array [0..expCardInfoStringMaxLen] of Char; // Type of product, e.g., "Backup", "Ethernet", etc.
+ deviceUniqueIDStr: array [0..expCardInfoStringMaxLen] of Char; // Unique identifier for product, e.g., a serial number. Set to "" if no such identifier exists.
+ end;
+ ExpCardInfoType = ExpCardInfoTag;
+ ExpCardInfoPtr = ^ExpCardInfoType;
+(************************************************************
+ * Iterator start and stop constants.
+ * Used by ExpSlotEnumerate
+ *************************************************************)
+const
+ expIteratorStart = 0;
+ expIteratorStop = $ffffffff;
+(************************************************************
+ * Bits in the 'handled' field used in Card Inserted and Removed notifications
+ *************************************************************)
+ expHandledVolume = $01; // any volumes associated with the card have been dealt with... the ExpansionMgr will not mount or unmount as appropriate.
+ expHandledSound = $02; // Any pleasing sounds have already been played... the ExpansionMgr will not play a pleasing sound on this insertion/removal.
+(************************************************************
+ * Error codes
+ *************************************************************)
+ expErrUnsupportedOperation = expErrorClass or 1; // unsupported or undefined opcode and/or creator
+ expErrNotEnoughPower = expErrorClass or 2; // the required power is not available
+ expErrCardNotPresent = expErrorClass or 3; // no card is present
+ expErrInvalidSlotRefNum = expErrorClass or 4; // slot reference number is bad
+ expErrSlotDeallocated = expErrorClass or 5; // slot reference number is within valid range, but has been deallocated.
+ expErrCardNoSectorReadWrite = expErrorClass or 6; // the card does not support the
+ // SlotDriver block read/write API
+ expErrCardReadOnly = expErrorClass or 7; // the card does support R/W API
+ // but the card is read only
+ expErrCardBadSector = expErrorClass or 8; // the card does support R/W API
+ // but the sector is bad
+ expErrCardProtectedSector = expErrorClass or 9; // The card does support R/W API
+ // but the sector is protected
+ expErrNotOpen = expErrorClass or 10; // slot driver library has not been opened
+ expErrStillOpen = expErrorClass or 11; // slot driver library is still open - maybe it was opened > once
+ expErrUnimplemented = expErrorClass or 12; // Call is unimplemented
+ expErrEnumerationEmpty = expErrorClass or 13; // No values remaining to enumerate
+ expErrIncompatibleAPIVer = expErrorClass or 14; // The API version of this slot driver is not supported by this version of ExpansionMgr.
+(************************************************************
+ * Common media types. Used by SlotCardMediaType and SlotMediaType.
+ *************************************************************)
+ expMediaType_Any = Rsc('wild'); // matches all media types when looking up a default directory
+ expMediaType_MemoryStick = Rsc('mstk');
+ expMediaType_CompactFlash = Rsc('cfsh');
+ expMediaType_SecureDigital = Rsc('sdig');
+ expMediaType_MultiMediaCard = Rsc('mmcd');
+ expMediaType_SmartMedia = Rsc('smed');
+ expMediaType_RAMDisk = Rsc('ramd'); // a RAM disk based media
+ expMediaType_PoserHost = Rsc('pose'); // Host filesystem emulated by Poser
+ expMediaType_MacSim = Rsc('PSim'); // Host filesystem emulated by Poser
+(************************************************************
+ * Selectors for routines found in the Expansion manager. The order
+ * of these selectors MUST match the jump table in ExpansionMgr.c.
+ *************************************************************)
+ expInit_ = 0;
+ expSlotDriverInstall_ = 1;
+ expSlotDriverRemove_ = 2;
+ expSlotLibFind_ = 3;
+ expSlotRegister_ = 4;
+ expSlotUnregister_ = 5;
+ expCardInserted_ = 6;
+ expCardRemoved_ = 7;
+ expCardPresent_ = 8;
+ expCardInfo_ = 9;
+ expSlotEnumerate_ = 10;
+ expCardGetSerialPort_ = 11;
+ expMaxSelector = expCardGetSerialPort_;
+function ExpInit: Err;
+function ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err;
+function ExpSlotDriverRemove(slotLibRefNum: UInt16): Err;
+function ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err;
+function ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err;
+function ExpSlotUnregister(slotRefNum: UInt16): Err;
+function ExpCardInserted(slotRefNum: UInt16): Err;
+function ExpCardRemoved(slotRefNum: UInt16): Err;
+function ExpCardPresent(slotRefNum: UInt16): Err;
+function ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err;
+function ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err;
+function ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err;
+
+implementation
+(**)
+function __ExpInit: Err; syscall sysTrapExpansionMgr;
+function __ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpSlotDriverRemove(slotLibRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpSlotUnregister(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpCardInserted(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpCardRemoved(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpCardPresent(slotRefNum: UInt16): Err; syscall sysTrapExpansionMgr;
+function __ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err; syscall sysTrapExpansionMgr;
+function __ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err; syscall sysTrapExpansionMgr;
+function __ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err; syscall sysTrapExpansionMgr;
+(**)
+
+function ExpInit: Err;
+begin
+ asm
+ move.l #expInit_,D2;
+ end;
+ ExpInit := __ExpInit;
+end;
+
+function ExpSlotDriverInstall(dbCreator: UInt32; var slotLibRefNumP: UInt16): Err;
+begin
+ asm
+ move.l #expSlotDriverInstall_,D2;
+ end;
+ ExpSlotDriverInstall := __ExpSlotDriverInstall(dbCreator, slotLibRefNumP);
+end;
+
+function ExpSlotDriverRemove(slotLibRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expSlotDriverRemove_,D2;
+ end;
+ ExpSlotDriverRemove := __ExpSlotDriverRemove(slotLibRefNum);
+end;
+
+function ExpSlotLibFind(slotRefNum: UInt16; var slotLibRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expSlotLibFind_,D2;
+ end;
+ ExpSlotLibFind := __ExpSlotLibFind(slotRefNum, slotLibRefNum);
+end;
+
+function ExpSlotRegister(slotLibRefNum: UInt16; var slotRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expSlotRegister_,D2;
+ end;
+ ExpSlotRegister := __ExpSlotRegister(slotLibRefNum, slotRefNum);
+end;
+
+function ExpSlotUnregister(slotRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expSlotUnregister_,D2;
+ end;
+ ExpSlotUnregister := __ExpSlotUnregister(slotRefNum);
+end;
+
+function ExpCardInserted(slotRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expCardInserted_,D2;
+ end;
+ ExpCardInserted := __ExpCardInserted(slotRefNum);
+end;
+
+function ExpCardRemoved(slotRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expCardRemoved_,D2;
+ end;
+ ExpCardRemoved := __ExpCardRemoved(slotRefNum);
+end;
+
+function ExpCardPresent(slotRefNum: UInt16): Err;
+begin
+ asm
+ move.l #expCardPresent_,D2;
+ end;
+ ExpCardPresent := __ExpCardPresent(slotRefNum);
+end;
+
+function ExpCardInfo(slotRefNum: UInt16; var infoP: ExpCardInfoType): Err;
+begin
+ asm
+ move.l #expCardInfo_,D2;
+ end;
+ ExpCardInfo := __ExpCardInfo(slotRefNum, infoP);
+end;
+
+function ExpSlotEnumerate(var slotRefNumP: UInt16; var slotIteratorP: UInt32): Err;
+begin
+ asm
+ move.l #expSlotEnumerate_,D2;
+ end;
+ ExpSlotEnumerate := __ExpSlotEnumerate(slotRefNumP, slotIteratorP);
+end;
+
+function ExpCardGetSerialPort(slotRefNum: UInt16; var portP: UInt32): Err;
+begin
+ asm
+ move.l #expCardGetSerialPort_,D2;
+ end;
+ ExpCardGetSerialPort := __ExpCardGetSerialPort(slotRefNum, portP);
+end;
+
+
+end.
diff --git a/packages/palmunits/src/fatalalert.pp b/packages/palmunits/src/fatalalert.pp
new file mode 100644
index 0000000000..8d3459887a
--- /dev/null
+++ b/packages/palmunits/src/fatalalert.pp
@@ -0,0 +1,38 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FatalAlert.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the system Fatal Alert support.
+ *
+ * History:
+ * September 12, 1994 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit fatalalert;
+
+interface
+
+uses palmos, coretraps;
+
+// Value returned by SysFatalAlert
+const
+ fatalReset = 0;
+ fatalEnterDebugger = 1;
+ fatalDoNothing = $FFFF;
+
+function SysFatalAlert(const msg: PChar): UInt16; syscall sysTrapSysFatalAlert;
+
+procedure SysFatalAlertInit; syscall sysTrapSysFatalAlertInit;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/featuremgr.pp b/packages/palmunits/src/featuremgr.pp
new file mode 100644
index 0000000000..327f1e8cf8
--- /dev/null
+++ b/packages/palmunits/src/featuremgr.pp
@@ -0,0 +1,66 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FeatureMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header for the Feature Manager
+ *
+ * History:
+ * 11/14/94 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit featuremgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * Feature manager error codes
+ * the constant ftrErrorClass is defined in ErrorBase.h
+ *************************************************************)
+
+const
+ ftrErrInvalidParam = ftrErrorClass or 1;
+ ftrErrNoSuchFeature = ftrErrorClass or 2;
+ ftrErrAlreadyExists = ftrErrorClass or 3;
+ ftrErrROMBased = ftrErrorClass or 4;
+ ftrErrInternalErr = ftrErrorClass or 5;
+
+(************************************************************
+ * Feature Manager procedures
+ *************************************************************)
+
+// Init the feature Manager
+function FtrInit: Err; syscall sysTrapFtrInit;
+
+// Get a feature
+function FtrGet(creator: UInt32; featureNum: UInt16; var valueP: UInt32): Err; syscall sysTrapFtrGet;
+
+// Set/Create a feature.
+function FtrSet(creator: UInt32; featureNum: UInt16; newValue: UInt32): Err; syscall sysTrapFtrSet;
+
+// Unregister a feature
+function FtrUnregister(creator: UInt32; featureNum: UInt16): Err; syscall sysTrapFtrUnregister;
+
+// Get a feature by index
+function FtrGetByIndex(index: UInt16; romTable: Boolean; var creatorP: UInt32; var numP: UInt16; var valueP: UInt32): Err; syscall sysTrapFtrGetByIndex;
+
+// Get temporary space from storage heap
+function FtrPtrNew(creator: UInt32; featureNum: UInt16; size: UInt32; var newPtrP: Pointer): Err; syscall sysTrapFtrPtrNew;
+
+// Release temporary space to storage heap
+function FtrPtrFree(creator: UInt32; featureNum: UInt16): Err; syscall sysTrapFtrPtrFree;
+
+// Resize block of temporary storage
+function FtrPtrResize(creator: UInt32; featureNum: UInt16; newSize: UInt32; var newPtrP: Pointer): Err; syscall sysTrapFtrPtrResize;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/field.pp b/packages/palmunits/src/field.pp
new file mode 100644
index 0000000000..7258c42178
--- /dev/null
+++ b/packages/palmunits/src/field.pp
@@ -0,0 +1,239 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Field.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines field structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ *
+ *****************************************************************************)
+unit field;
+
+interface
+
+uses palmos, coretraps, rect, font, window, control;
+
+const
+ maxFieldTextLen = $7fff;
+
+// default maximun number of line the a dynamicly sizing field will expand to.
+// Can be changed with FldSetMaxVisibleLines
+
+ maxFieldLines = 11;
+
+// kind alignment values
+type
+ justifications = Enum;
+
+const
+ leftAlign = 0;
+ centerAlign = Succ(leftAlign);
+ rightAlign = Succ(centerAlign);
+
+type
+ JustificationType = justifications;
+
+const
+ undoBufferSize = 100;
+
+type
+ UndoMode = enum;
+
+const
+ undoNone = 0;
+ undoTyping = Succ(undoNone);
+ undoBackspace = Succ(undoTyping);
+ undoDelete = Succ(undoBackspace);
+ undoPaste = Succ(undoDelete);
+ undoCut = Succ(undoPaste);
+ undoInput = Succ(undoCut);
+
+type
+ FieldUndoType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
+ mode: UndoMode;
+ reserved: UInt8;
+ start: UInt16;
+ end_: UInt16;
+ bufferLen: UInt16;
+ buffer: PChar;
+ {$endif}
+ end;
+ FieldUndoTag = FieldUndoType;
+
+ FieldAttrType = record
+ Bits: UInt16;
+{
+ UInt16 usable :1; // Set if part of ui
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 editable :1; // Set if editable
+ UInt16 singleLine :1; // Set if only a single line is displayed
+ UInt16 hasFocus :1; // Set if the field has the focus
+ UInt16 dynamicSize :1; // Set if height expands as text is entered
+ UInt16 insPtVisible :1; // Set if the ins pt is scolled into view
+ UInt16 dirty :1; // Set if user modified
+ UInt16 underlined :2; // text underlined mode
+ UInt16 justification :2; // text alignment
+ UInt16 autoShift :1; // Set if auto case shift
+ UInt16 hasScrollBar :1; // Set if the field has a scroll bar
+ UInt16 numeric :1; // Set if numeric, digits and secimal separator only
+ UInt16 reserved :1; // Reserved for future use
+}
+ end;
+ FieldAttrTag = FieldAttrType;
+ FieldAttrPtr = ^FieldAttrType;
+
+ LineInfoType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
+ start: UInt16; // position in text string of first char.
+ length: UInt16; // number of character in the line
+ {$endif}
+ end;
+ LineInfoTag = LineInfoType;
+ LineInfoPtr = ^LineInfoType;
+
+ FieldType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FIELDS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ rect: RectangleType;
+ attr: FieldAttrType;
+ text: PChar; // pointer to the start of text string
+ textHandle: MemHandle; // block the contains the text string
+ lines: LineInfoPtr;
+ textLen: UInt16;
+ textBlockSize: UInt16;
+ maxChars: UInt16;
+ selFirstPos: UInt16;
+ selLastPos: UInt16;
+ insPtXPos: UInt16;
+ insPtYPos: UInt16;
+ fontID: FontID;
+ maxVisibleLines: UInt8; // added in 4.0 to support FldSetMaxVisibleLines
+ {$endif}
+ end;
+
+ FieldPtr = ^FieldType; // deprecated, use FieldType *
+
+//---------------------------------------------------------------------
+// Field Functions
+//---------------------------------------------------------------------
+
+procedure FldCopy(const fldP: FieldPtr); syscall sysTrapFldCopy;
+
+procedure FldCut(fldP: FieldPtr); syscall sysTrapFldCut;
+
+procedure FldDrawField(fldP: FieldPtr); syscall sysTrapFldDrawField;
+
+procedure FldEraseField(fldP: FieldPtr); syscall sysTrapFldEraseField;
+
+procedure FldFreeMemory(fldP: FieldPtr); syscall sysTrapFldFreeMemory;
+
+procedure FldGetBounds(const fldP: FieldPtr; rect: RectanglePtr); syscall sysTrapFldGetBounds;
+
+function FldGetFont(const fldP: FieldPtr): FontID; syscall sysTrapFldGetFont;
+
+procedure FldGetSelection(const fldP: FieldPtr; var startPosition, endPosition: UInt16); syscall sysTrapFldGetSelection;
+
+function FldGetTextHandle(const fldP: FieldPtr): MemHandle; syscall sysTrapFldGetTextHandle;
+
+function FldGetTextPtr(const fldP: FieldPtr): PChar; syscall sysTrapFldGetTextPtr;
+
+function FldHandleEvent(fldP: FieldPtr; eventP: EventPtr): Boolean; syscall sysTrapFldHandleEvent;
+
+procedure FldPaste(fldP: FieldPtr); syscall sysTrapFldPaste;
+
+procedure FldRecalculateField(fldP: FieldPtr; redraw: Boolean); syscall sysTrapFldRecalculateField;
+
+procedure FldSetBounds(fldP: FieldPtr; const rP: RectanglePtr); syscall sysTrapFldSetBounds;
+
+procedure FldSetFont(fldP: FieldPtr; fontID: FontID); syscall sysTrapFldSetFont;
+
+procedure FldSetText(fldP: FieldPtr; textHandle: MemHandle; offset, size: UInt16); syscall sysTrapFldSetText;
+
+procedure FldSetTextHandle(fldP: FieldPtr; textHandle: MemHandle); syscall sysTrapFldSetTextHandle;
+
+procedure FldSetTextPtr(fldP: FieldPtr; textP: PChar); syscall sysTrapFldSetTextPtr;
+
+procedure FldSetUsable(fldP: FieldPtr; usable: Boolean); syscall sysTrapFldSetUsable;
+
+procedure FldSetSelection(fldP: FieldPtr; startPosition, endPosition: UInt16); syscall sysTrapFldSetSelection;
+
+procedure FldGrabFocus(fldP: FieldPtr); syscall sysTrapFldGrabFocus;
+
+procedure FldReleaseFocus(fldP: FieldPtr); syscall sysTrapFldReleaseFocus;
+
+function FldGetInsPtPosition(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetInsPtPosition;
+
+procedure FldSetInsPtPosition(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetInsPtPosition;
+
+procedure FldSetInsertionPoint(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetInsertionPoint;
+
+function FldGetScrollPosition(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetScrollPosition;
+
+procedure FldSetScrollPosition(fldP: FieldPtr; pos: UInt16); syscall sysTrapFldSetScrollPosition;
+
+procedure FldGetScrollValues(const fldP: FieldPtr; var scrollPosP, textHeightP, fieldHeightP: UInt16); syscall sysTrapFldGetScrollValues;
+
+function FldGetTextLength(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextLength;
+
+procedure FldScrollField(fldP: FieldPtr; linesToScroll: UInt16; direction: WinDirectionType); syscall sysTrapFldScrollField;
+
+function FldScrollable(const fldP: FieldPtr; direction: WinDirectionType): Boolean; syscall sysTrapFldScrollable;
+
+function FldGetVisibleLines(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetVisibleLines;
+
+function FldGetTextHeight(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextHeight;
+
+function FldCalcFieldHeight(const chars: PChar; maxWidth: UInt16): UInt16; syscall sysTrapFldCalcFieldHeight;
+
+function FldWordWrap(const chars: PChar; maxWidth: Int16): UInt16; syscall sysTrapFldWordWrap;
+
+procedure FldCompactText(fldP: FieldPtr); syscall sysTrapFldCompactText;
+
+function FldDirty(const fldP: FieldPtr): Boolean; syscall sysTrapFldDirty;
+
+procedure FldSetDirty(fldP: FieldPtr; dirty: Boolean); syscall sysTrapFldSetDirty;
+
+function FldGetMaxChars(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetMaxChars;
+
+procedure FldSetMaxChars(fldP: FieldPtr; maxChars: UInt16); syscall sysTrapFldSetMaxChars;
+
+function FldInsert(fldP: FieldPtr; const insertChars: PChar; insertLen: UInt16): Boolean; syscall sysTrapFldInsert;
+
+procedure FldDelete(fldP: FieldPtr; start, end_: UInt16); syscall sysTrapFldDelete;
+
+procedure FldUndo(fldP: FieldPtr); syscall sysTrapFldUndo;
+
+function FldGetTextAllocatedSize(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetTextAllocatedSize;
+
+procedure FldSetTextAllocatedSize(fldP: FieldPtr; allocatedSize: UInt16); syscall sysTrapFldSetTextAllocatedSize;
+
+procedure FldGetAttributes(const fldP: FieldPtr; attrP: FieldAttrPtr); syscall sysTrapFldGetAttributes;
+
+procedure FldSetAttributes(fldP: FieldPtr; const attrP: FieldAttrPtr); syscall sysTrapFldSetAttributes;
+
+procedure FldSendChangeNotification(const fldP: FieldPtr); syscall sysTrapFldSendChangeNotification;
+
+procedure FldSendHeightChangeNotification(const fldP: FieldPtr; pos: UInt16; numLines: Int16); syscall sysTrapFldSendHeightChangeNotification;
+
+function FldMakeFullyVisible(fldP: FieldPtr): Boolean; syscall sysTrapFldMakeFullyVisible;
+
+function FldGetNumberOfBlankLines(const fldP: FieldPtr): UInt16; syscall sysTrapFldGetNumberOfBlankLines;
+
+function FldNewField(formPP: PointerPtr; id: UInt16; x, y, width, height: Coord;
+ font: FontID; maxChars: UInt32; editable, underlined, singleLine, dynamicSize: Boolean;
+ justification: JustificationType; autoShift, hasScrollBar, numeric: Boolean): FieldPtr; syscall sysTrapFldNewField;
+
+// added in 4.0
+procedure FldSetMaxVisibleLines(fldP: FieldPtr; maxLines: UInt8); syscall sysTrapFldSetMaxVisibleLines;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/filestream.pp b/packages/palmunits/src/filestream.pp
new file mode 100644
index 0000000000..91622d804a
--- /dev/null
+++ b/packages/palmunits/src/filestream.pp
@@ -0,0 +1,348 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FileStream.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Pilot File Stream equates -- File Streams were initially implemented
+ * in PalmOS v3.0 (not available in earlier versions)
+ *
+ * History:
+ * 11/24/97 vmk - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************)
+
+unit filestream;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * File Stream error codes
+ * the constant dmErrorClass is defined in ErrorBase.h
+ *************************************************************)
+
+const
+ fileErrMemError = fileErrorClass or 1; // out of memory error
+ fileErrInvalidParam = fileErrorClass or 2; // invalid parameter value passed
+ fileErrCorruptFile = fileErrorClass or 3; // the file is corrupted/invalid/not a stream file
+ fileErrNotFound = fileErrorClass or 4; // couldn't find the file
+ fileErrTypeCreatorMismatch = fileErrorClass or 5; // file's type and creator didn't match those expected
+ fileErrReplaceError = fileErrorClass or 6; // couldn't replace an existing file
+ fileErrCreateError = fileErrorClass or 7; // couldn't create a new file
+ fileErrOpenError = fileErrorClass or 8; // generic open error
+ fileErrInUse = fileErrorClass or 9; // file couldn't be opened or deleted because it is in use
+ fileErrReadOnly = fileErrorClass or 10; // couldn't open in write mode because db is read-only
+ fileErrInvalidDescriptor = fileErrorClass or 11; // invalid file descriptor (FileHandle)
+ fileErrCloseError = fileErrorClass or 12; // error closing the database
+ fileErrOutOfBounds = fileErrorClass or 13; // attempted operation went out of bounds of the file
+ fileErrPermissionDenied = fileErrorClass or 14; // couldn't write to a file open for read-only access
+ fileErrIOError = fileErrorClass or 15; // general I/O error
+ fileErrEOF = fileErrorClass or 16; // end-of-file error
+ fileErrNotStream = fileErrorClass or 17; // attempted to open a file that is not a stream
+
+(************************************************************
+ * File Stream handle type
+ *************************************************************)
+
+type
+ FileHand = MemHandle;
+
+const
+ fileNullHandle = FileHand(0);
+
+(************************************************************
+ * Mode flags passed to FileOpen
+ *************************************************************)
+
+// fileModeReadOnly, fileModeReadWrite, fileModeUpdate, and fileModeAppend are mutually exclusive - only
+// pass one of them to FileOpen!
+const
+ fileModeReadOnly = $80000000; // open for read access
+ fileModeReadWrite = $40000000; // create for read/write access, discarding previous if any */
+ fileModeUpdate = $20000000; // open/create for read/write, preserving previous if any
+ fileModeAppend = $10000000; // open/create for read/write, always writing at the end
+
+ fileModeLeaveOpen = $08000000; // leave open when app quits
+ fileModeExclusive = $04000000; // don't let anyone else open it
+ fileModeAnyTypeCreator = $02000000; // if set, skip type/creator validation when
+ // opening or replacing an existing file
+
+ fileModeTemporary = $01000000; // will automatically delete the file when it is closed;
+ // if this bit is set and the file type passed to FileOpen is zero,
+ // FileOpen will use sysFileTTemp (defined in SystemResources.h for the file
+ // type (recommended) - this will enable automatic cleanup of undeleted
+ // temp files following a system crash in future PalmOS versions
+ // (post-crash cleanup will likely come after 3.0)
+
+ fileModeDontOverwrite = $00800000; // if set, will prevent fileModeReadWrite from discarding an existing file
+ // with the same name; may only be specified together with fileModeReadWrite
+
+// For debugging/validation
+const
+ fileModeAllFlags = fileModeReadOnly or fileModeReadWrite or fileModeUpdate or
+ fileModeAppend or fileModeLeaveOpen or fileModeExclusive or
+ fileModeAnyTypeCreator or fileModeTemporary or fileModeDontOverwrite;
+
+(************************************************************
+ * Origin passed to FileSetPos
+ *************************************************************)
+
+type
+ FileOriginEnum = Enum;
+
+const
+ fileOriginBeginning = 1; // from the beginning (first data byte of file)
+ fileOriginCurrent = Succ(fileOriginBeginning); // from the current position
+ fileOriginEnd = Succ(fileOriginCurrent); // from the end of file (one position beyond last data byte)
+
+(************************************************************
+ * Operation passed to FileControl
+ *************************************************************)
+
+type
+ FileOpEnum = Enum;
+
+const
+ fileOpNone = 0; // no-op
+
+ fileOpDestructiveReadMode = Succ(fileOpNone); // switch to destructive read mode (there is no turning back);
+ // implicitly rewinds the file to the beginning;
+ // destructive read mode deletes file stream data blocks as
+ // data is being read, thus freeing up storage automatically;
+ // once in destructive read mode, FileWrite, FileSeek and FileTruncate
+ // are not allowed; stream's contents after closing (or crash)
+ // are undefined.
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // zero on success; fileErr... on error
+
+ fileOpGetEOFStatus = Succ(fileOpDestructiveReadMode); // get end-of-file status (err = fileErrEOF indicates end of file condition);
+ // use FileClearerr to clear this error status
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // zero if _not_ end of file; non-zero if end of file
+
+ fileOpGetLastError = Succ(fileOpGetEOFStatus); // get error code from last operation on file stream, and
+ // clear the last error code value (will not change end of file
+ // or I/O error status -- use FileClearerr to reset all error codes)
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // Error code from last file stream operation
+
+ fileOpClearError = Succ(fileOpGetLastError); // clear I/O and end of file error status, and last error
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // zero on success; fileErr... on error
+
+ fileOpGetIOErrorStatus = Succ(fileOpClearError); // get I/O error status (like C runtime's ferror); use FileClearerr
+ // to clear this error status
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // zero if _not_ I/O error; non-zero if I/O error is pending
+
+ fileOpGetCreatedStatus = Succ(fileOpGetIOErrorStatus); // find out whether the FileOpen call caused the file to
+ // be created
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = ptr to Boolean type variable
+ // valueLenP = ptr to Int32 variable set to sizeof(Boolean)
+ // RETURNS:
+ // zero on success; fileErr... on error;
+ // the Boolean variable will be set to non zero if the file was created.
+
+ fileOpGetOpenDbRef = Succ(fileOpGetCreatedStatus); // get the open database reference (handle) of the underlying
+ // database that implements the stream (NULL if none);
+ // this is needed for performing PalmOS-specific operations on
+ // the underlying database, such as changing or getting creator/type,
+ // version, backup/reset bits, etc.
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = ptr to DmOpenRef type variable
+ // valueLenP = ptr to Int32 variable set to sizeof(DmOpenRef)
+ // RETURNS:
+ // zero on success; fileErr... on error;
+ // the DmOpenRef variable will be set to the file's open db reference
+ // that may be passed to Data Manager calls;
+ // WARNING:
+ // Do not make any changes to the data of the underlying database --
+ // this will cause the file stream to become corrupted.
+
+ fileOpFlush = Succ(fileOpGetOpenDbRef); // flush any cached data to storage
+ // ARGUMENTS:
+ // stream = open stream handle
+ // valueP = NULL
+ // valueLenP = NULL
+ // RETURNS:
+ // zero on success; fileErr... on error;
+
+ fileOpLAST = Succ(fileOpFlush); // ***ADD NEW OPERATIONS BEFORE THIS ENTRY***
+ // *** AND ALWAYS AFTER EXISTING ENTRIES ***
+ // *** FOR BACKWARD COMPATIBILITY ***
+
+(************************************************************
+ * File Stream procedures
+ *************************************************************)
+
+// Open/create a file stream (name must all be valid -- non-null, non-empty)
+// (errP is optional - set to NULL to ignore)
+function FileOpen(cardNo: UInt16; const nameP: PChar; type_, creator, openMode: UInt32; var errP: Err): FileHand; syscall sysTrapFileOpen;
+
+// Close the file stream
+function FileClose(stream: FileHand): Err; syscall sysTrapFileClose;
+
+// Delete a file
+function FileDelete(cardNo: UInt16; const nameP: PChar): Err; syscall sysTrapFileDelete;
+
+(***********************************************************************
+ *
+ * MACRO: FileRead
+ *
+ * DESCRIPTION: Read data from a file into a buffer. If you need to read into a data storage
+ * heap-based chunk, record or resource, you _must_ use FileDmRead instead.
+ *
+ * PROTOTYPE: Int32 FileRead(FileHand stream, void *bufP, Int32 objSize, Int32 numObj, Err *errP)
+ *
+ * PARAMETERS: stream -- handle of open file
+ * bufP -- buffer for reading data
+ * objSize -- size of each object to read
+ * numObj -- number of objects to read
+ * errP -- ptr to variable for returning the error code (fileErr...)
+ * (OPTIONAL -- pass NULL to ignore)
+ *
+ * RETURNED: the number of objects that were read - this may be less than
+ * the number of objects requested
+ *
+ ***********************************************************************)
+
+function FileRead(stream: FileHand; bufP: Pointer; objSize, numObj: Int32; var errP: Err): Int32;
+
+(***********************************************************************
+ *
+ * MACRO: FileDmRead
+ *
+ * DESCRIPTION: Read data from a file into a data storage heap-based chunk, record
+ * or resource.
+ *
+ * PROTOTYPE: Int32 FileDmRead(FileHand stream, void *startOfDmChunkP, Int32 destOffset,
+ * Int32 objSize, Int32 numObj, Err *errP)
+ *
+ * PARAMETERS: stream -- handle of open file
+ * startOfDmChunkP
+ * -- ptr to beginning of data storage heap-based chunk, record or resource
+ * destOffset -- offset from base ptr to the destination area (must be >= 0)
+ * objSize -- size of each object to read
+ * numObj -- number of objects to read
+ * errP -- ptr to variable for returning the error code (fileErr...)
+ * (OPTIONAL -- pass NULL to ignore)
+ *
+ * RETURNED: the number of objects that were read - this may be less than
+ * the number of objects requested
+ *
+ ***********************************************************************)
+
+function FileDmRead(stream: FileHand; startOfDmChunkP: Pointer; destOffset: Int32; objSize, numObj: Int32; var errP: Err): Int32;
+
+// Low-level routine for reading data from a file stream -- use helper macros FileRead and FileDmRead
+// instead of calling this function directly;
+// (errP is optional - set to NULL to ignore)
+function FileReadLow(stream: FileHand; baseP: Pointer; offset: Int32; dataStoreBased: Boolean;
+ objSize, numObj: Int32; var errP: Err): Int32; syscall sysTrapFileReadLow;
+
+// Write data to a file stream
+// (errP is optional - set to NULL to ignore)
+function FileWrite(stream: FileHand; const dataP: Pointer; objSize, numObj: Int32; var errP: Err): Int32; syscall sysTrapFileWrite;
+
+// Set position within a file stream
+function FileSeek(stream: FileHand; offset: Int32; origin: FileOriginEnum): Err; syscall sysTrapFileSeek;
+
+function FileRewind(stream: FileHand): Err;
+
+// Get current position and filesize
+// (fileSizeP and errP are optional - set to NULL to ignore)
+function FileTell(stream: FileHand; var fileSizeP: Int32; var errP: Err): Int32; syscall sysTrapFileTell;
+
+// Truncate a file
+function FileTruncate(stream: FileHand; newSize: Int32): Err; syscall sysTrapFileTruncate;
+
+// Returns the error code from the last operation on this file stream;
+// if resetLastError is non-zero, resets the error status
+// function FileControl(op: FileOpEnum; stream: FileHand; valueP: Pointer; var valueLenP: Int32): Err; syscall sysTrapFileControl;
+function FileControl(op: FileOpEnum; stream: FileHand; valueP: Pointer; valueLenP: Pointer): Err; syscall sysTrapFileControl;
+
+function FileEOF(stream: FileHand): Boolean;
+
+function FileError(stream: FileHand): Err;
+
+function FileClearerr(stream: FileHand): Err;
+
+function FileGetLastError(stream: FileHand): Err;
+
+function FileFlush(stream: FileHand): Err;
+
+implementation
+
+function FileRead(stream: FileHand; bufP: Pointer; objSize, numObj: Int32; var errP: Err): Int32;
+begin
+ FileRead := FileReadLow(stream, bufP, 0{offset}, False{dataStoreBased}, objSize, numObj, errP);
+end;
+
+function FileDmRead(stream: FileHand; startOfDmChunkP: Pointer; destOffset: Int32; objSize, numObj: Int32; var errP: Err): Int32;
+begin
+ FileDmRead := FileReadLow(stream, startOfDmChunkP, destOffset, True{dataStoreBased}, objSize, numObj, errP);
+end;
+
+function FileRewind(stream: FileHand): Err;
+begin
+ FileClearerr(stream);
+ FileRewind := FileSeek(stream, 0, fileOriginBeginning);
+end;
+
+function FileEOF(stream: FileHand): Boolean;
+begin
+ FileEOF := FileControl(fileOpGetEOFStatus, stream, nil, Longint(nil)) = fileErrEOF;
+end;
+
+function FileError(stream: FileHand): Err;
+begin
+ FileError := FileControl(fileOpGetIOErrorStatus, stream, nil, Longint(nil));
+end;
+
+function FileClearerr(stream: FileHand): Err;
+begin
+ FileClearerr := FileControl(fileOpClearError, stream, nil, Longint(nil));
+end;
+
+function FileGetLastError(stream: FileHand): Err;
+begin
+ FileGetLastError := FileControl(fileOpGetLastError, stream, nil, Longint(nil));
+end;
+
+function FileFlush(stream: FileHand): Err;
+begin
+ FileFlush := FileControl(fileOpFlush, stream, nil, Longint(nil));
+end;
+
+end.
diff --git a/packages/palmunits/src/find_.pp b/packages/palmunits/src/find_.pp
new file mode 100644
index 0000000000..33d6e8bada
--- /dev/null
+++ b/packages/palmunits/src/find_.pp
@@ -0,0 +1,115 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Find.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines field structures and routines.
+ *
+ * History:
+ * August 29, 1994 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit find_;
+
+interface
+
+uses palmos, coretraps, rect;
+
+const
+ maxFinds = 9;
+ maxFindStrLen = 16;
+
+type
+ FindMatchType = record
+ appCardNo: UInt16; // card number of the application
+ appDbID: LocalID; // LocalID of the application
+ foundInCaller: Boolean; // true if found in app that called Find
+ reserved: UInt8;
+
+ dbCardNo: UInt16; // card number of the database record was found in
+ dbID: LocalID; // LocalID of the database record was found in
+ recordNum: UInt16; // index of record that contain a match
+ matchPos: UInt16; // postion in record of the match.
+ matchFieldNum: UInt16; // field number
+ matchCustom: UInt32; // app specific data
+ end;
+
+ FindMatchPtr = ^FindMatchType;
+
+ FindParamsType = record
+ // These fields are used by the applications.
+ dbAccesMode: UInt16; // read mode and maybe show secret
+ recordNum: UInt16; // index of last record that contained a match
+ more: Boolean; // true of more matches to display
+ strAsTyped: array [0..maxFindStrLen] of Char; // search string as entered
+ strToFind: array [0..maxFindStrLen] of Char; // search string is lower case
+ reserved1: UInt8;
+
+ // The lineNumber field can be modified by the app. The continuation field can
+ // be tested by the app. All other fields are private to the Find routine and
+ // should NOT be accessed by applications.
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FINDPARAMS} // These fields will not be available in the next OS release!
+ numMatches: UInt16; // # of matches
+ lineNumber: UInt16; // next line in the results tabel
+ continuation: Boolean; // true if contining search of same app
+ searchedCaller: Boolean; // true after we've searched app that initiated the find
+
+ callerAppDbID: LocalID; // dbID of app that initiated search
+ callerAppCardNo: UInt16; // cardNo of app that initiated search
+
+ appDbID: LocalID; // dbID of app that we're currently searching
+ appCardNo: UInt16; // card number of app that we're currently searching
+
+ newSearch: Boolean; // true for first search
+ reserved2: UInt8;
+ searchState: DmSearchStateType; // search state
+ match: array [0..maxFinds-1] of FindMatchType;
+ {$else}
+ noAccessAllowed1: UInt16; // # of matches
+ lineNumber: UInt16; // next line in the results tabel
+ continuation: Boolean; // true if contining search of same app
+ noAccessAllowed2: Boolean; // padding
+ {$endif}
+ end;
+
+ FindParamsPtr = ^FindParamsType;
+
+// Param Block passsed with the sysAppLaunchCmdGoto Command
+ GoToParamsType = record
+ searchStrLen: Int16; // length of search string.
+ dbCardNo: UInt16; // card number of the database
+ dbID: LocalID; // LocalID of the database
+ recordNum: UInt16; // index of record that contain a match
+ matchPos: UInt16; // postion in record of the match.
+ matchFieldNum: UInt16; // field number string was found int
+ matchCustom: UInt32; // application specific info
+ end;
+
+ GoToParamsPtr = ^GoToParamsType;
+
+//----------------------------------------------------------
+// Find Functions
+//----------------------------------------------------------
+
+procedure Find(goToP: GoToParamsPtr); syscall sysTrapFind;
+
+function FindStrInStr(strToSearch, strToFind: PChar; var posP: UInt16): Boolean; syscall sysTrapFindStrInStr;
+
+function FindSaveMatch(findParams: FindParamsPtr; recordNum, pos, fieldNum: UInt16;
+ appCustom: UInt32; cardNo: UInt16; dbID: LocalID): Boolean; syscall sysTrapFindSaveMatch;
+
+procedure FindGetLineBounds(const findParams: FindParamsPtr; r: RectanglePtr); syscall sysTrapFindGetLineBounds;
+
+function FindDrawHeader(findParams: FindParamsPtr; title: PChar): Boolean; syscall sysTrapFindDrawHeader;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/floatmgr.pp b/packages/palmunits/src/floatmgr.pp
new file mode 100644
index 0000000000..2099567e4a
--- /dev/null
+++ b/packages/palmunits/src/floatmgr.pp
@@ -0,0 +1,940 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FloatMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * New Floating point routines, provided by new IEEE arithmetic
+ * 68K software floating point emulator (sfpe) code.
+ *
+ * History:
+ * 9/23/96 - Created by SCL
+ * 11/15/96 - First build of NewFloatMgr.lib
+ * 11/26/96 - Added FlpCorrectedAdd and FlpCorrectedSub routines
+ * 12/30/96 - Added FlpVersion routine
+ * 2/ 4/97 - Fixed FlpDoubleBits definition - sign & exp now Int32s
+ * so total size of FlpCompDouble is 64 bits, not 96.
+ * 2/ 5/97 - Added note about FlpBase10Info reporting "negative" zero.
+ * 7/21/99 - Renamed NewFloatMgr.h to FloatMgr.h.
+ *
+ *****************************************************************************)
+
+unit floatmgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************************
+ * Differences between FloatMgr (PalmOS v1.0) and (this) NewFloatMgr
+ ***********************************************************************)
+//
+// FloatMgr (PalmOS v1.0) NewFloatMgr
+// ---------------------- ---------------------------------------------
+// FloatType (64-bits) use FlpFloat (32-bits) or FlpDouble (64-bits)
+//
+// fplErrOutOfRange use _fp_get_fpscr() to retrieve errors
+//
+// FplInit() not necessary
+// FplFree() not necessary
+//
+// FplFToA() use FlpFToA()
+// FplAToF() use FlpAToF()
+// FplBase10Info() use FlpBase10Info() [*signP returns sign BIT: 1 if negative]
+//
+// FplLongToFloat() use _f_itof() or _d_itod()
+// FplFloatToLong() use _f_ftoi() or _d_dtoi()
+// FplFloatToULong() use _f_ftou() or _d_dtou()
+//
+// FplMul() use _f_mul() or _d_mul()
+// FplAdd() use _f_add() or _d_add()
+// FplSub() use _f_sub() or _d_sub()
+// FplDiv() use _f_div() or _d_div()
+
+(************************************************************************
+ * New Floating point manager constants
+ ***********************************************************************)
+
+const
+ flpVersion_ = $02008000; // first version of NewFloatMgr (PalmOS 2.0)
+
+(*
+ * These constants are passed to and received from the _fp_round routine.
+ *)
+
+ flpToNearest = 0;
+ flpTowardZero = 1;
+ flpUpward = 3;
+ flpDownward = 2;
+ flpModeMask = $00000030;
+ flpModeShift = 4;
+
+(*
+ * These masks define the fpscr bits supported by the sfpe (software floating point emulator).
+ * These constants are used with the _fp_get_fpscr and _fp_set_fpscr routines.
+ *)
+
+ flpInvalid = $00008000;
+ flpOverflow = $00004000;
+ flpUnderflow = $00002000;
+ flpDivByZero = $00001000;
+ flpInexact = $00000800;
+
+(*
+ * These constants are returned by _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe:
+ *)
+
+ flpEqual = 0;
+ flpLess = 1;
+ flpGreater = 2;
+ flpUnordered = 3;
+
+(************************************************************************
+ * New Floating point manager types (private)
+ ***********************************************************************)
+
+type
+ _sfpe_64_bits = record // for internal use only
+ high: Int32;
+ low: Int32;
+ end;
+
+ sfpe_long_long = _sfpe_64_bits; // for internal use only
+ sfpe_unsigned_long_long = _sfpe_64_bits; // for internal use only
+
+(************************************************************************
+ * New Floating point manager types (public)
+ ***********************************************************************)
+
+ FlpFloat = Single; //Int32;
+ FlpDouble = Double; //_sfpe_64_bits;
+ FlpLongDouble = _sfpe_64_bits;
+
+(*
+* A double value comprises the fields:
+* 0x80000000 0x00000000 -- sign bit (1 for negative)
+* 0x7ff00000 0x00000000 -- exponent, biased by 0x3ff == 1023
+* 0x000fffff 0xffffffff -- significand == the fraction after an implicit "1."
+* So a double has the mathematical form:
+* (-1)^sign_bit * 2^(exponent - bias) * 1.significand
+* What follows are some structures (and macros) useful for decomposing numbers.
+*)
+
+ FlpDoubleBits = record // for accessing specific fields
+ Bits1: UInt32;
+{
+ UInt32 sign: 1;
+ Int32 exp : 11;
+ UInt32 manH: 20;
+}
+ ManL: UInt32;
+ end;
+
+(*!!!
+typedef union {
+ double d; // for easy assignment of values
+ FlpDouble fd; // for calling New Floating point manager routines
+ UInt32 ul[2]; // for accessing upper and lower longs
+ FlpDoubleBits fdb; // for accessing specific fields
+} FlpCompDouble;
+
+typedef union {
+ float f; // for easy assignment of values
+ FlpFloat ff; // for calling New Floating point manager routines
+ UInt32 ul; // for accessing bits of the float
+} FlpCompFloat;
+!!!*)
+
+(************************************************************************
+ * Useful macros...
+ ***********************************************************************)
+
+{
+#define BIG_ENDIAN 1
+#define __FIRST32(x) *((UInt32 *) &x)
+#define __SECOND32(x) *((UInt32 *) &x + 1)
+#define __ALL32(x) *((UInt32 *) &x)
+
+#ifdef LITTLE_ENDIAN
+#define __LO32(x) *((UInt32 *) &x)
+#define __HI32(x) *((UInt32 *) &x + 1)
+#define __HIX 1
+#define __LOX 0
+#else
+#define __HI32(x) *((UInt32 *) &x)
+#define __LO32(x) *((UInt32 *) &x + 1)
+#define __HIX 0
+#define __LOX 1
+#endif
+
+#define FlpGetSign(x) ((__HI32(x) & 0x80000000) != 0)
+#define FlpIsZero(x) ( ((__HI32(x) & 0x7fffffff) | (__LO32(x))) == 0)
+
+#define FlpGetExponent(x) (((__HI32(x) & 0x7ff00000) >> 20) - 1023)
+
+
+#define FlpNegate(x) (((FlpCompDouble *)&x)->ul[__HIX] ^= 0x80000000)
+#define FlpSetNegative(x) (((FlpCompDouble *)&x)->ul[__HIX] |= 0x80000000)
+#define FlpSetPositive(x) (((FlpCompDouble *)&x)->ul[__HIX] &= ~0x80000000)
+}
+
+(*******************************************************************
+ * New Floating point manager errors
+ * The constant fplErrorClass is defined in SystemMgr.h
+ *******************************************************************)
+
+const
+ flpErrOutOfRange = flpErrorClass or 1;
+
+(************************************************************
+ * New Floating point manager trap macros
+ *************************************************************)
+
+(************************************************************
+ * New Floating point manager selectors
+ *************************************************************)
+
+type
+ sysFloatSelector = Enum; // The order of this enum *MUST* match the
+ // corresponding table in NewFloatDispatch.c
+
+const
+ sysFloatBase10Info = 0; // 0
+ sysFloatFToA = Succ(sysFloatBase10Info); // 1
+ sysFloatAToF = Succ(sysFloatFToA); // 2
+ sysFloatCorrectedAdd = Succ(sysFloatAToF); // 3
+ sysFloatCorrectedSub = Succ(sysFloatCorrectedAdd); // 4
+ sysFloatVersion = Succ(sysFloatCorrectedSub); // 5
+
+ flpMaxFloatSelector = sysFloatVersion; // used by NewFloatDispatch.c
+
+type
+ sysFloatEmSelector = Enum; // The order of this enum *MUST* match the
+ // sysFloatSelector table in NewFloatDispatch.c
+const
+ sysFloatEm_fp_round = 0; // 0
+ sysFloatEm_fp_get_fpscr = Succ(sysFloatEm_fp_round); // 1
+ sysFloatEm_fp_set_fpscr = Succ(sysFloatEm_fp_get_fpscr); // 2
+
+ sysFloatEm_f_utof = Succ(sysFloatEm_fp_set_fpscr); // 3
+ sysFloatEm_f_itof = Succ(sysFloatEm_f_utof); // 4
+ sysFloatEm_f_ulltof = Succ(sysFloatEm_f_itof); // 5
+ sysFloatEm_f_lltof = Succ(sysFloatEm_f_ulltof); // 6
+
+ sysFloatEm_d_utod = Succ(sysFloatEm_f_lltof); // 7
+ sysFloatEm_d_itod = Succ(sysFloatEm_d_utod); // 8
+ sysFloatEm_d_ulltod = Succ(sysFloatEm_d_itod); // 9
+ sysFloatEm_d_lltod = Succ(sysFloatEm_d_ulltod); // 10
+
+ sysFloatEm_f_ftod = Succ(sysFloatEm_d_lltod); // 11
+ sysFloatEm_d_dtof = Succ(sysFloatEm_f_ftod); // 12
+ sysFloatEm_f_ftoq = Succ(sysFloatEm_d_dtof); // 13
+ sysFloatEm_f_qtof = Succ(sysFloatEm_f_ftoq); // 14
+ sysFloatEm_d_dtoq = Succ(sysFloatEm_f_qtof); // 15
+ sysFloatEm_d_qtod = Succ(sysFloatEm_d_dtoq); // 16
+
+ sysFloatEm_f_ftou = Succ(sysFloatEm_d_qtod); // 17
+ sysFloatEm_f_ftoi = Succ(sysFloatEm_f_ftou); // 18
+ sysFloatEm_f_ftoull = Succ(sysFloatEm_f_ftoi); // 19
+ sysFloatEm_f_ftoll = Succ(sysFloatEm_f_ftoull); // 20
+
+ sysFloatEm_d_dtou = Succ(sysFloatEm_f_ftoll); // 21
+ sysFloatEm_d_dtoi = Succ(sysFloatEm_d_dtou); // 22
+ sysFloatEm_d_dtoull = Succ(sysFloatEm_d_dtoi); // 23
+ sysFloatEm_d_dtoll = Succ(sysFloatEm_d_dtoull); // 24
+
+ sysFloatEm_f_cmp = Succ(sysFloatEm_d_dtoll); // 25
+ sysFloatEm_f_cmpe = Succ(sysFloatEm_f_cmp); // 26
+ sysFloatEm_f_feq = Succ(sysFloatEm_f_cmpe); // 27
+ sysFloatEm_f_fne = Succ(sysFloatEm_f_feq); // 28
+ sysFloatEm_f_flt = Succ(sysFloatEm_f_fne); // 29
+ sysFloatEm_f_fle = Succ(sysFloatEm_f_flt); // 30
+ sysFloatEm_f_fgt = Succ(sysFloatEm_f_fle); // 31
+ sysFloatEm_f_fge = Succ(sysFloatEm_f_fgt); // 32
+ sysFloatEm_f_fun = Succ(sysFloatEm_f_fge); // 33
+ sysFloatEm_f_for = Succ(sysFloatEm_f_fun); // 34
+
+ sysFloatEm_d_cmp = Succ(sysFloatEm_f_for); // 35
+ sysFloatEm_d_cmpe = Succ(sysFloatEm_d_cmp); // 36
+ sysFloatEm_d_feq = Succ(sysFloatEm_d_cmpe); // 37
+ sysFloatEm_d_fne = Succ(sysFloatEm_d_feq); // 38
+ sysFloatEm_d_flt = Succ(sysFloatEm_d_fne); // 39
+ sysFloatEm_d_fle = Succ(sysFloatEm_d_flt); // 40
+ sysFloatEm_d_fgt = Succ(sysFloatEm_d_fle); // 41
+ sysFloatEm_d_fge = Succ(sysFloatEm_d_fgt); // 42
+ sysFloatEm_d_fun = Succ(sysFloatEm_d_fge); // 43
+ sysFloatEm_d_for = Succ(sysFloatEm_d_fun); // 44
+
+ sysFloatEm_f_neg = Succ(sysFloatEm_d_for); // 45
+ sysFloatEm_f_add = Succ(sysFloatEm_f_neg); // 46
+ sysFloatEm_f_mul = Succ(sysFloatEm_f_add); // 47
+ sysFloatEm_f_sub = Succ(sysFloatEm_f_mul); // 48
+ sysFloatEm_f_div = Succ(sysFloatEm_f_sub); // 49
+
+ sysFloatEm_d_neg = Succ(sysFloatEm_f_div); // 50
+ sysFloatEm_d_add = Succ(sysFloatEm_d_neg); // 51
+ sysFloatEm_d_mul = Succ(sysFloatEm_d_add); // 52
+ sysFloatEm_d_sub = Succ(sysFloatEm_d_mul); // 53
+ sysFloatEm_d_div = Succ(sysFloatEm_d_sub); // 54
+
+(************************************************************
+ * New Floating point manager routines
+ *************************************************************)
+
+ // Note: FlpBase10Info returns the actual sign bit in *signP (1 if negative)
+ // Note: FlpBase10Info reports that zero is "negative".
+ // A workaround is to check (*signP && *mantissaP) instead of just *signP.
+function FlpBase10Info(a: FlpDouble; var mantissaP: UInt32; var exponentP, signP: Int16): Err;
+
+function FlpFToA(a: FlpDouble; s: PChar): Err;
+
+function FlpAToF(const s: PChar): FlpDouble;
+
+function FlpCorrectedAdd(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble;
+
+function FlpCorrectedSub(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble;
+
+// These next three functions correspond to the previous three above.
+// The signatures are different, but in fact with CodeWarrior for Palm OS
+// the structure return values above are implemented via a hidden pointer
+// parameter, so corresponding functions are binary compatible. Programs
+// using CodeWarrior to target m68k Palm OS can use either function
+// interchangeably.
+//
+// However, a description of the handling of structure return values is
+// missing from the defined Palm OS ABI, and m68k-palmos-gcc does it
+// differently. So programs compiled with GCC using the standard functions
+// above are likely to crash: GCC users must use the FlpBuffer* forms of
+// these functions.
+//
+// The FlpBuffer* functions are not available on the Simulator, so you need
+// to use the standard versions above if you want Simulator compatibility.
+//
+// Many of the _d_* functions further below suffer from the same problem.
+// This is not an issue, because programs targeting Palm OS devices can use
+// operators (+ - * / etc) instead of calling these functions directly.
+// (GCC users may wish to use -lnfm -- see the documentation for details.)
+//
+// See the SDK's SampleCalc example for further discussion.
+
+procedure FlpBufferAToF(var result: FlpDouble; const s: PChar);
+
+procedure FlpBufferCorrectedAdd(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16);
+
+procedure FlpBufferCorrectedSub(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16);
+
+function FlpVersion: UInt32;
+
+//procedure FlpSelectorErrPrv(flpSelector: UInt16); // used only by NewFloatDispatch.c
+
+// The following macros could be useful but are left undefined due to the
+// confusion they might cause. What was called a "float" in PalmOS v1.0 was
+// really a 64-bit; in v2.0 "float" is only 32-bits and "double" is 64-bits.
+// However, if a v1.0 program is converted to use the NewFloatMgr, these
+// macros could be re-defined, or the native _d_ routines could be called.
+
+//#define FlpLongToFloat(x) _d_itod(x) // similar to 1.0 call, but returns double
+//#define FlpFloatToLong(f) _d_dtoi(f) // similar to 1.0 call, but takes a double
+//#define FlpFloatToULong(f) _d_dtou(f) // similar to 1.0 call, but takes a double
+
+(************************************************************
+ * New Floating point emulator functions
+ *************************************************************)
+
+(*
+ * These three functions define the interface to the (software) fpscr
+ * of the sfpe. _fp_round not only sets the rounding mode according
+ * the low two bits of its argument, but it also returns those masked
+ * two bits. This provides some hope of compatibility with less capable
+ * emulators, which support only rounding to nearest. A programmer
+ * concerned about getting the rounding mode requested can test the
+ * return value from _fp_round; it will indicate what the current mode is.
+ *
+ * Constants passed to and received from _fp_round are:
+ * flpToNearest, flpTowardZero, flpUpward, or flpDownward
+ *)
+
+function _fp_round(Value: Int32): Int32;
+
+(*
+ * Constants passed to _fp_set_fpscr and received from _fp_get_fpscr are:
+ * flpInvalid, flpOverflow, flpUnderflow, flpDivByZero, or flpInexact
+ *)
+
+function _fp_get_fpscr: Int32;
+procedure _fp_set_fpscr(Value: Int32);
+
+(*
+ * The shorthand here can be determined from the context:
+ * i --> long (Int32)
+ * u --> UInt32 (UInt32)
+ * ll --> long long int
+ * ull --> UInt32 long int
+ * f --> float
+ * d --> double
+ * q --> long double (defaults to double in this implementaton)
+ * XtoY--> map of type X to a value of type Y
+ *)
+
+function _f_utof(Value: UInt32): FlpFloat;
+function _f_itof(Value: Int32): FlpFloat;
+//!!!function _f_ulltof(Value: sfpe_unsigned_long_long): FlpFloat; syscall sysTrapFlpEmDispatch, sysFloatEm_f_ulltof;
+//!!!function _f_lltof(Value: sfpe_long_long): FlpFloat; syscall sysTrapFlpEmDispatch, sysFloatEm_f_lltof;
+
+function _d_utod(Value: UInt32): FlpDouble;
+function _d_itod(Value: Int32): FlpDouble;
+//!!!function _d_ulltod(Value: sfpe_unsigned_long_long): FlpDouble; syscall sysTrapFlpEmDispatch, sysFloatEm_d_ulltod;
+//!!!function _d_lltod(Value: sfpe_long_long): FlpDouble; syscall sysTrapFlpEmDispatch, sysFloatEm_d_lltod;
+
+function _f_ftod(Value: FlpFloat): FlpDouble;
+function _d_dtof(Value: FlpDouble): FlpFloat;
+
+//!!!function _f_ftoq(Value: FlpFloat): FlpLongDouble; syscall sysTrapFlpEmDispatch, sysFloatEm_f_ftoq;
+function _f_qtof(var Value: FlpLongDouble): FlpFloat;
+
+//!!!function _d_dtoq(Value: FlpDouble): FlpLongDouble; syscall sysTrapFlpEmDispatch, sysFloatEm_d_dtoq;
+//!!!function _d_qtod(var Value: FlpLongDouble): FlpDouble; syscall sysTrapFlpEmDispatch, sysFloatEm_d_qtod;
+
+function _f_ftou(Value: FlpFloat): UInt32;
+function _f_ftoi(Value: FlpFloat): Int32;
+
+//!!!function _f_ftoull(Value: FlpFloat): sfpe_unsigned_long_long; syscall sysTrapFlpEmDispatch, sysFloatEm_f_ftoull;
+//!!!function _f_ftoll(Value: FlpFloat): sfpe_long_long; syscall sysTrapFlpEmDispatch, sysFloatEm_f_ftoll;
+
+function _d_dtou(Value: FlpDouble): UInt32;
+function _d_dtoi(Value: FlpDouble): Int32;
+
+//!!!function _d_dtoull(Value: FlpDouble): sfpe_unsigned_long_long; syscall sysTrapFlpEmDispatch, sysFloatEm_d_dtoull;
+//!!!function _d_dtoll(Value: FlpDouble): sfpe_long_long; syscall sysTrapFlpEmDispatch, sysFloatEm_d_dtoll;
+
+(*
+ * The comparison functions _T_Tcmp[e] compare their two arguments,
+ * of type T, and return one of the four values defined below.
+ * The functions _d_dcmpe and _f_fcmpe, in addition to returning
+ * the comparison code, also set the invalid flag in the fpscr if
+ * the operands are unordered. Two floating point values are unordered
+ * when they enjoy no numerical relationship, as is the case when one
+ * or both are NaNs.
+ *
+ * Return values for _d_cmp, _d_cmpe, _f_cmp, and _f_cmpe are:
+ * flpEqual, flpLess, flpGreater, or flpUnordered
+ *
+ * The function shorthand is:
+ * eq --> equal
+ * ne --> not equal
+ * lt --> less than
+ * le --> less than or equal to
+ * gt --> greater than
+ * ge --> greater than or equal to
+ * un --> unordered with
+ * or --> ordered with (i.e. less than, equal to, or greater than)
+ *)
+
+function _f_cmp(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_cmpe(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_feq(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_fne(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_flt(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_fle(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_fgt(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_fge(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_fun(Left: FlpFloat; Right: FlpFloat): Int32;
+function _f_for(Left: FlpFloat; Right: FlpFloat): Int32;
+
+function _d_cmp(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_cmpe(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_feq(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_fne(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_flt(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_fle(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_fgt(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_fge(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_fun(Left: FlpDouble; Right: FlpDouble): Int32;
+function _d_for(Left: FlpDouble; Right: FlpDouble): Int32;
+
+function _f_neg(Value: FlpFloat): FlpFloat;
+function _f_add(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+function _f_mul(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+function _f_sub(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+function _f_div(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+
+function _d_neg(Value: FlpDouble): FlpDouble;
+function _d_add(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+function _d_mul(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+function _d_sub(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+function _d_div(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+
+implementation
+
+function __FlpBase10Info(a: FlpDouble; var mantissaP: UInt32; var exponentP, signP: Int16): Err; syscall sysTrapFlpDispatch;
+function __FlpFToA(a: FlpDouble; s: PChar): Err; syscall sysTrapFlpDispatch;
+function __FlpAToF(const s: PChar): FlpDouble; syscall sysTrapFlpDispatch;
+function __FlpCorrectedAdd(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble; syscall sysTrapFlpDispatch;
+function __FlpCorrectedSub(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble; syscall sysTrapFlpDispatch;
+
+procedure __FlpBufferAToF(var result: FlpDouble; const s: PChar); syscall sysTrapFlpDispatch;
+procedure __FlpBufferCorrectedAdd(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16); syscall sysTrapFlpDispatch;
+procedure __FlpBufferCorrectedSub(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16); syscall sysTrapFlpDispatch;
+function __FlpVersion: UInt32; syscall sysTrapFlpDispatch;
+
+function ___fp_round(Value: Int32): Int32; syscall sysTrapFlpEmDispatch;
+function ___fp_get_fpscr: Int32; syscall sysTrapFlpEmDispatch;
+procedure ___fp_set_fpscr(Value: Int32); syscall sysTrapFlpEmDispatch;
+function ___f_utof(Value: UInt32): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_itof(Value: Int32): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___d_utod(Value: UInt32): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_itod(Value: Int32): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___f_ftod(Value: FlpFloat): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_dtof(Value: FlpDouble): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_qtof(var Value: FlpLongDouble): FlpFloat; syscall sysTrapFlpEmDispatch;
+
+function ___f_ftou(Value: FlpFloat): UInt32; syscall sysTrapFlpEmDispatch;
+function ___f_ftoi(Value: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+
+function ___d_dtou(Value: FlpDouble): UInt32; syscall sysTrapFlpEmDispatch;
+function ___d_dtoi(Value: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+
+
+function FlpBase10Info(a: FlpDouble; var mantissaP: UInt32; var exponentP, signP: Int16): Err;
+begin
+ asm
+ move.l #$sysFloatBase10Info, D2;
+ end;
+ FlpBase10Info := __FlpBase10Info(a, mantissaP, exponentP, signP);
+end;
+
+function FlpFToA(a: FlpDouble; s: PChar): Err;
+begin
+ asm
+ move.l #$sysFloatFToA, D2;
+ end;
+ FlpFToA := __FlpFToA(a, s);
+end;
+
+function FlpAToF(const s: PChar): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatAToF, D2
+ end;
+ FlpAToF := __FlpAToF(s);
+end;
+
+function FlpCorrectedAdd(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatCorrectedAdd, D2
+ end;
+ FlpCorrectedAdd := __FlpCorrectedAdd(firstOperand, secondOperand, howAccurate);
+end;
+
+function FlpCorrectedSub(firstOperand, secondOperand: FlpDouble; howAccurate: Int16): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatCorrectedSub, D2;
+ end;
+ FlpCorrectedSub := __FlpCorrectedSub(firstOperand, secondOperand, howAccurate);
+end;
+
+procedure FlpBufferAToF(var result: FlpDouble; const s: PChar);
+begin
+ asm
+ move.l #$sysFloatAToF, D2;
+ end;
+ __FlpBufferAToF(result, s);
+end;
+
+procedure FlpBufferCorrectedAdd(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16);
+begin
+ asm
+ move.l #$sysFloatCorrectedAdd, D2;
+ end;
+ __FlpBufferCorrectedAdd(result, firstOperand, secondOperand, howAccurate);
+end;
+
+procedure FlpBufferCorrectedSub(var result: FlpDouble; firstOperand, secondOperand: FlpDouble; howAccurate: Int16);
+begin
+ asm
+ move.l #$sysFloatCorrectedSub, D2
+ end;
+ __FlpBufferCorrectedSub(result, firstOperand, secondOperand, howAccurate);
+end;
+
+function FlpVersion: UInt32;
+begin
+ asm
+ move.l #$sysFloatVersion, D2;
+ end;
+ FlpVersion := __FlpVersion;
+end;
+
+function _fp_round(Value: Int32): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_fp_round, D2;
+ end;
+ _fp_round := ___fp_round(Value);
+end;
+
+function _fp_get_fpscr: Int32;
+begin
+ asm
+ move.l #$sysFloatEm_fp_get_fpscr, D2;
+ end;
+ _fp_get_fpscr := ___fp_get_fpscr;
+end;
+
+procedure _fp_set_fpscr(Value: Int32);
+begin
+ asm
+ move.l #$sysFloatEm_fp_set_fpscr, D2;
+ end;
+ ___fp_set_fpscr(Value);
+end;
+
+function _f_utof(Value: UInt32): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_utof, D2;
+ end;
+ _f_utof := ___f_utof(Value);
+end;
+
+function _f_itof(Value: Int32): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_itof, D2;
+ end;
+ _f_itof := ___f_itof(Value);
+end;
+
+function _d_utod(Value: UInt32): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_utod, D2;
+ end;
+ _d_utod := ___d_utod(Value);
+end;
+
+function _d_itod(Value: Int32): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_itod, D2;
+ end;
+ _d_itod := ___d_itod(Value);
+end;
+
+function _f_ftod(Value: FlpFloat): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_f_ftod, D2;
+ end;
+ _f_ftod := ___f_ftod(Value);
+end;
+
+function _d_dtof(Value: FlpDouble): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_d_dtof, D2;
+ end;
+ _d_dtof := ___d_dtof(Value);
+end;
+
+function _f_qtof(var Value: FlpLongDouble): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_qtof, D2;
+ end;
+ _f_qtof := ___f_qtof(Value);
+end;
+
+function _f_ftou(Value: FlpFloat): UInt32;
+begin
+ asm
+ move.l #$sysFloatEm_f_ftou, D2;
+ end;
+ _f_ftou := ___f_ftou(Value);
+end;
+
+function _f_ftoi(Value: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_ftoi, D2;
+ end;
+ _f_ftoi := ___f_ftoi(Value);
+end;
+
+function _d_dtou(Value: FlpDouble): UInt32;
+begin
+ asm
+ move.l #$sysFloatEm_d_dtou, D2;
+ end;
+ _d_dtou := ___d_dtou(Value);
+end;
+
+function _d_dtoi(Value: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_dtoi, D2;
+ end;
+ _d_dtoi := ___d_dtoi(Value);
+end;
+
+function ___f_cmp(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_cmpe(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_feq(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_fne(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_flt(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_fle(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_fgt(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_fge(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_fun(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+function ___f_for(Left: FlpFloat; Right: FlpFloat): Int32; syscall sysTrapFlpEmDispatch;
+
+function ___d_cmp(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_cmpe(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_feq(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_fne(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_flt(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_fle(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_fgt(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_fge(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_fun(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+function ___d_for(Left: FlpDouble; Right: FlpDouble): Int32; syscall sysTrapFlpEmDispatch;
+
+function ___f_neg(Value: FlpFloat): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_add(Left: FlpFloat; Right: FlpFloat): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_mul(Left: FlpFloat; Right: FlpFloat): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_sub(Left: FlpFloat; Right: FlpFloat): FlpFloat; syscall sysTrapFlpEmDispatch;
+function ___f_div(Left: FlpFloat; Right: FlpFloat): FlpFloat; syscall sysTrapFlpEmDispatch;
+
+function ___d_neg(Value: FlpDouble): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_add(Left: FlpDouble; Right: FlpDouble): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_mul(Left: FlpDouble; Right: FlpDouble): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_sub(Left: FlpDouble; Right: FlpDouble): FlpDouble; syscall sysTrapFlpEmDispatch;
+function ___d_div(Left: FlpDouble; Right: FlpDouble): FlpDouble; syscall sysTrapFlpEmDispatch;
+
+
+function _f_cmp(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_cmp , D2
+ end;
+ _f_cmp := ___f_cmp(Left, Right);
+end;
+function _f_cmpe(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_cmpe , D2
+ end;
+ _f_cmpe := ___f_cmpe(Left, Right);
+end;
+function _f_feq(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_feq , D2
+ end;
+ _f_feq := ___f_feq(Left, Right);
+end;
+function _f_fne(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_fne , D2
+ end;
+ _f_fne := ___f_fne(Left, Right);
+end;
+function _f_flt(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_flt, D2;
+ end;
+ _f_flt := ___f_flt(Left, Right);
+end;
+function _f_fle(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_fle, D2;
+ end;
+ _f_fle := ___f_fle(Left, Right);
+end;
+function _f_fgt(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_fgt, D2;
+ end;
+ _f_fgt := ___f_fgt(Left, Right);
+end;
+function _f_fge(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_fge, D2;
+ end;
+ _f_fge := ___f_fge(Left, Right);
+end;
+function _f_fun(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_fun, D2;
+ end;
+ _f_fun := ___f_fun(Left, Right);
+end;
+function _f_for(Left: FlpFloat; Right: FlpFloat): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_f_for, D2
+ end;
+ _f_for := ___f_for(Left, Right);
+end;
+function _d_cmp(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_cmp, D2
+ end;
+ _d_cmp := ___d_cmp(Left, Right);
+end;
+function _d_cmpe(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_cmpe, D2;
+ end;
+ _d_cmpe := ___d_cmpe(Left, Right);
+end;
+function _d_feq(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_feq, D2;
+ end;
+ _d_feq := ___d_feq(Left, Right);
+end;
+function _d_fne(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_fne, D2;
+ end;
+ _d_fne := ___d_fne(Left, Right);
+end;
+function _d_flt(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_flt, D2;
+ end;
+ _d_flt := ___d_flt(Left, Right);
+end;
+function _d_fle(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_fle, D2
+ end;
+ _d_fle := ___d_fle(Left, Right);
+end;
+function _d_fgt(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_fgt, D2;
+ end;
+ _d_fgt := ___d_fgt(Left, Right);
+end;
+function _d_fge(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_fge, D2;
+ end;
+ _d_fge := ___d_fge(Left, Right);
+end;
+
+function _d_fun(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_fun, D2
+ end;
+ _d_fun := ___d_fun(Left, Right);
+end;
+
+function _d_for(Left: FlpDouble; Right: FlpDouble): Int32;
+begin
+ asm
+ move.l #$sysFloatEm_d_for, D2
+ end;
+ _d_for := ___d_for(Left, Right);
+end;
+function _f_neg(Value: FlpFloat): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_neg, D2;
+ end;
+ _f_neg := ___f_neg(Value);
+end;
+function _f_add(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_add, D2;
+ end;
+ _f_add := ___f_add(Left, Right);
+end;
+function _f_mul(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_mul, D2;
+ end;
+ _f_mul := ___f_mul(Left, Right);
+end;
+function _f_sub(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_sub, D2;
+ end;
+ _f_sub := ___f_sub(Left, Right);
+end;
+function _f_div(Left: FlpFloat; Right: FlpFloat): FlpFloat;
+begin
+ asm
+ move.l #$sysFloatEm_f_div, D2
+ end;
+ _f_div := ___f_div(Left, Right);
+end;
+function _d_neg(Value: FlpDouble): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_neg, D2;
+ end;
+ _d_neg := ___d_neg(Value);
+end;
+
+function _d_add(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_add, D2;
+ end;
+ _d_add := ___d_add(Left, Right);
+end;
+
+function _d_mul(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_mul, D2;
+ end;
+ _d_mul := ___d_mul(Left, Right);
+end;
+
+function _d_sub(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_sub, D2;
+ end;
+ _d_sub := ___d_sub(Left, Right);
+end;
+
+function _d_div(Left: FlpDouble; Right: FlpDouble): FlpDouble;
+begin
+ asm
+ move.l #$sysFloatEm_d_div, D2;
+ end;
+ _d_div := ___d_div(Left, Right);
+end;
+
+end.
diff --git a/packages/palmunits/src/font.pp b/packages/palmunits/src/font.pp
new file mode 100644
index 0000000000..a9a11bdcea
--- /dev/null
+++ b/packages/palmunits/src/font.pp
@@ -0,0 +1,138 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Font.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines font structures and routines.
+ *
+ * History:
+ * 09/13/94 art 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
+ * 05/12/00 kwk Added FntWCharWidth.
+ *
+ *****************************************************************************)
+{$MACRO ON}
+unit font;
+
+interface
+
+uses palmos, coretraps;
+
+// Pixel width of tab stops in fields
+const
+ fntTabChrWidth = 20;
+
+// Width of character missing from font.
+const
+ fntMissingChar = -1;
+
+type
+ FontCharInfoType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FONTS} // These fields will not be available in the next OS release!
+ offset: Int8;
+ width: Int8;
+ {$endif}
+ end;
+ FontCharInfoTag = FontCharInfoType;
+ FontCharInfoPtr = ^FontCharInfoType;
+
+type
+ FontType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FONTS} // These fields will not be available in the next OS release!
+ fontType: Int16; // font type
+ firstChar: Int16; // ASCII code of first character
+ lastChar: Int16; // ASCII code of last character
+ maxWidth: Int16; // maximum character width
+ kernMax: Int16; // negative of maximum character kern
+ nDescent: Int16; // negative of descent
+ fRectWidth: Int16; // width of font rectangle
+ fRectHeight: Int16; // height of font rectangle
+ owTLoc: Int16; // offset to offset/width table
+ ascent: Int16; // ascent
+ descent: Int16; // descent
+ leading: Int16; // leading
+ rowWords: Int16; // row width of bit image / 2
+ {$endif}
+ end;
+ FontTag = FontType;
+ FontPtr = ^FontType;
+ FontTablePtr = ^FontPtr;
+
+type
+ FontID = Enum;
+
+const
+ stdFont = $00; // Small font used for the user's writing. Shows a good amount
+ boldFont = Succ(stdFont); // Small font. Bold for easier reading. Used often for ui.
+ largeFont = Succ(boldFont); // Larger font for easier reading. Shows a lot less.
+ symbolFont = Succ(largeFont); // Various ui images like check boxes and arrows
+ symbol11Font = Succ(symbolFont); // Larger various ui images
+ symbol7Font = Succ(symbol11Font); // Smaller various ui images
+ ledFont = Succ(symbol7Font); // Calculator specific font
+ largeBoldFont = Succ(ledFont); // A thicker version of the large font. More readable.
+ fntAppFontCustomBase = $80; // First available application-defined font ID
+
+const
+ checkboxFont = symbol11Font;
+
+function FntIsAppDefined(fnt: FontID): Boolean;
+
+//--------------------------------------------------------------------
+//
+// Font Function
+//
+//--------------------------------------------------------------------
+
+function FntGetFont: FontID; syscall sysTrapFntGetFont;
+
+function FntSetFont(font: FontID): FontID; syscall sysTrapFntSetFont;
+
+function FntGetFontPtr: FontPtr; syscall sysTrapFntGetFontPtr;
+
+function FntBaseLine: Int16; syscall sysTrapFntBaseLine;
+
+function FntCharHeight: Int16; syscall sysTrapFntCharHeight;
+
+function FntLineHeight: Int16; syscall sysTrapFntLineHeight;
+
+function FntAverageCharWidth: Int16; syscall sysTrapFntAverageCharWidth;
+
+function FntCharWidth(ch: Char): Int16; syscall sysTrapFntCharWidth;
+
+function FntWCharWidth(iChar: WChar): Int16; syscall sysTrapFntWCharWidth;
+
+function FntCharsWidth(const chars: PChar; len: Int16): Int16; syscall sysTrapFntCharsWidth;
+
+function FntWidthToOffset(const pChars: PChar; length: UInt16; pixelWidth: Int16; var leadingEdge: Boolean; var truncWidth: Int16): Int16; syscall sysTrapFntWidthToOffset;
+
+procedure FntCharsInWidth(const AString: PChar; var stringWidthP, stringLengthP: Int16;
+ var fitWithinWidth: Boolean); syscall sysTrapFntCharsInWidth;
+
+function FntDescenderHeight: Int16; syscall sysTrapFntDescenderHeight;
+
+function FntLineWidth(const pChars: PChar; length: UInt16): Int16; syscall sysTrapFntLineWidth;
+
+function FntWordWrap(const chars: PChar; maxWidth: UInt16): UInt16; syscall sysTrapFntWordWrap;
+
+procedure FntWordWrapReverseNLines(const chars: PChar; maxWidth: UInt16; var linesToScrollP, scrollPosP: UInt16); syscall sysTrapFntWordWrapReverseNLines;
+
+procedure FntGetScrollValues(const chars: PChar; width, scrollPos: UInt16; var linesP, topLine: UInt16); syscall sysTrapFntGetScrollValues;
+
+function FntDefineFont(font: FontID; fontP: FontPtr): Err; syscall sysTrapFntDefineFont;
+
+implementation
+
+function FntIsAppDefined(fnt: FontID): Boolean;
+begin
+ FntIsAppDefined := fnt >= fntAppFontCustomBase;
+end;
+
+end.
diff --git a/packages/palmunits/src/fontselect_.pp b/packages/palmunits/src/fontselect_.pp
new file mode 100644
index 0000000000..1f14bda3f5
--- /dev/null
+++ b/packages/palmunits/src/fontselect_.pp
@@ -0,0 +1,30 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FontSelect.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the font selector routine.
+ *
+ * History:
+ * September 10, 1997 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit fontselect_;
+
+interface
+
+uses coretraps, font;
+
+function FontSelect(fontID: FontID): FontID; syscall sysTrapFontSelect;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/form.pp b/packages/palmunits/src/form.pp
new file mode 100644
index 0000000000..018a947e42
--- /dev/null
+++ b/packages/palmunits/src/form.pp
@@ -0,0 +1,455 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Form.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines form structures and routines.
+ *
+ * History:
+ * 09/06/94 art Created by Art Lamb.
+ * 08/28/00 kwk Added FrmGetActiveField (4.0)
+ *
+ *****************************************************************************)
+
+unit form;
+
+interface
+
+uses palmos, coretraps, rect, font, window, control, field, list, scrollbar, table, event_;
+
+const
+ noFocus = $ffff;
+
+ frmInvalidObjectId = $ffff;
+ frmNoSelectedControl = $ff;
+
+// Update code send as part of a frmUpdate event.
+ frmRedrawUpdateCode = $8000;
+
+// Magic button IDs used by FrmCustomResponseAlert callbacks
+ frmResponseCreate = 1974;
+ frmResponseQuit = $BEEF;
+
+// Alert constants and structures
+type
+ alertTypes = Enum;
+
+const
+ informationAlert = 0;
+ confirmationAlert = Succ(informationAlert);
+ warningAlert = Succ(confirmationAlert);
+ errorAlert = Succ(warningAlert);
+
+type
+ AlertType = alertTypes;
+
+ AlertTemplateType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ alertType: UInt16;
+ helpRscID: UInt16;
+ numButtons: UInt16;
+ defaultButton: UInt16;
+ {$endif}
+ end;
+ AlertTemplateTag = AlertTemplateType;
+// Types of object in a dialog box
+ formObjects = Enum;
+
+const
+ frmFieldObj = 0;
+ frmControlObj = Succ(frmFieldObj);
+ frmListObj = Succ(frmControlObj);
+ frmTableObj = Succ(frmListObj);
+ frmBitmapObj = Succ(frmTableObj);
+ frmLineObj = Succ(frmBitmapObj);
+ frmFrameObj = Succ(frmLineObj);
+ frmRectangleObj = Succ(frmFrameObj);
+ frmLabelObj = Succ(frmRectangleObj);
+ frmTitleObj = Succ(frmLabelObj);
+ frmPopupObj = Succ(frmTitleObj);
+ frmGraffitiStateObj = Succ(frmPopupObj);
+ frmGadgetObj = Succ(frmGraffitiStateObj);
+ frmScrollBarObj = Succ(frmGadgetObj);
+
+type
+ FormObjectKind = formObjects;
+
+ FormObjAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 usable :1; // Set if part of ui
+ UInt16 reserved :15; // pad it out
+}
+ {$endif}
+ end;
+
+ FormObjAttrTag = FormObjAttrType;
+
+// Gadget support:
+const
+ formGadgetDrawCmd = 0; // paramP is unspecified
+ formGadgetEraseCmd = 1; // paramP is unspecified
+ formGadgetHandleEventCmd = 2; // paramP is an EventType *for the relevant event.
+ formGadgetDeleteCmd = 3; // paramP is unspecified.
+
+type
+ FormGadgetAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 usable :1; // Set if part of ui - "should be drawn"
+ UInt16 extended :1; // Set if the structure is an "Extended" gadget (i.e., the 'handler' field is present)
+ UInt16 visible :1; // Set if drawn - "has been drawn" or "must do work to erase"
+ UInt16 reserved :13; // pad it out
+}
+ {$endif}
+ end;
+ FormGadgetAttrTag = FormGadgetAttrType;
+
+ FormGadgetPtr = ^FormGadgetType;
+
+ FormGadgetHandlerType = function(gadgetP: FormGadgetPtr; cmd: UInt16; paramP: Pointer): Boolean;
+
+ FormGadgetType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ attr: FormGadgetAttrType;
+ rect: RectangleType;
+ data: Pointer;
+ handler: FormGadgetHandlerType;
+ {$endif}
+ end;
+
+// All of the smaller form objects:
+
+ FormBitmapType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ attr: FormObjAttrType;
+ pos: PointType;
+ rscID: UInt16;
+ {$endif}
+ end;
+ FormBitmapTag = FormBitmapType;
+ FormBitmapPtr = ^FormBitmapType;
+
+ FormLineType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ attr: FormObjAttrType;
+ point1: PointType;
+ point2: PointType;
+ {$endif}
+ end;
+ FormLineTag = FormLineType;
+
+ FormFrameType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ attr: FormObjAttrType;
+ rect: RectangleType;
+ frameType: UInt16;
+ {$endif}
+ end;
+ FormFrameTag = FormFrameType;
+
+ FormRectangleType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ attr: FormObjAttrType;
+ rect: RectangleType;
+ {$endif}
+ end;
+ FormRectangleTag = FormRectangleType;
+
+ FormLabelType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ pos: PointType;
+ attr: FormObjAttrType;
+ fontID: FontID;
+ reserved: UInt8;
+ text: PChar;
+ {$endif}
+ end;
+ FormLabelTag = FormLabelType;
+ FormLabelPtr = ^FormLabelType;
+
+ FormTitleType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ rect: RectangleType;
+ text: PChar;
+ {$endif}
+ end;
+ FormTitleTag = FormTitleType;
+
+ FormPopupType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ controlID: UInt16;
+ listID: UInt16;
+ {$endif}
+ end;
+ FormPopupTag = FormPopupType;
+
+ FrmGraffitiStateType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ pos: PointType;
+ {$endif}
+ end;
+ FormGraffitiStateTag = FrmGraffitiStateType;
+ FrmGraffitiStatePtr = ^FrmGraffitiStateType;
+
+ FormObjectType = record
+ case Integer of
+ 1: (ptr: Pointer);
+ 2: (field: ^FieldType);
+ 3: (control: ^ControlType);
+ 4: (graphicControl: ^GraphicControlType);
+ 5: (sliderControl: ^SliderControlType);
+ 6: (list: ^ListType);
+ 7: (table: ^TableType);
+ 8: (bitmap: ^FormBitmapType);
+ // FormLineType * line;
+ // FormFrameType * frame;
+ // FormRectangleType * rectangle;
+ 9: (label_: ^FormLabelType);
+ 10: (title: ^FormTitleType);
+ 11: (popup: ^FormPopupType);
+ 12: (grfState: ^FrmGraffitiStateType);
+ 13: (gadget: ^FormGadgetType);
+ 14: (scrollBar: ^ScrollBarType);
+ end;
+ FormObjectTag = FormObjectType;
+
+// typedef FormObjectType *FormObjectPtr;
+
+ FormObjListType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ objectType: FormObjectKind;
+ reserved: UInt8;
+ object_: FormObjectType;
+ {$endif}
+ end;
+ FormObjListTag = FormObjListType;
+
+ FormAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 usable :1; // Set if part of ui
+ UInt16 enabled :1; // Set if interactable (not grayed out)
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 dirty :1; // Set if dialog has been modified
+ UInt16 saveBehind :1; // Set if bits behind form are save when form ids drawn
+ UInt16 graffitiShift :1; // Set if graffiti shift indicator is supported
+ UInt16 globalsAvailable:1; // Set by Palm OS if globals are available for the
+ // form event handler
+ UInt16 doingDialog :1; // FrmDoDialog is using for nested event loop
+ UInt16 exitDialog :1; // tells FrmDoDialog to bail out and stop using this form
+ UInt16 attnIndicator :1; // Set if attention indicator is supported
+ UInt16 reserved :6; // pad to 16
+}
+ reserved2: UInt16; // FormAttrType now explicitly 32-bits wide.
+ {$endif}
+ end;
+ FormAttrTag = FormAttrType;
+
+ FormEventHandlerType = function(var eventP: EventType): Boolean;
+ FormEventHandlerPtr = FormEventHandlerType;
+
+ FormType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FORMS} // These fields will not be available in the next OS release!
+ window: WindowType;
+ formId: UInt16;
+ attr: FormAttrType;
+ bitsBehindForm: WinHandle;
+ handler: FormEventHandlerType;
+ focus: UInt16;
+ defaultButton: UInt16;
+ helpRscId: UInt16;
+ menuRscId: UInt16;
+ numObjects: UInt16;
+ objects: ^FormObjListType;
+ {$endif}
+ end;
+
+ FormPtr = ^FormType;
+ FieldPtr = ^FieldType;
+// FormActiveStateType: this structure is passed to FrmActiveState for
+// saving and restoring active form/window state; this structure's
+// contents are abstracted because the contents will differ significantly
+// as PalmOS evolves
+// Added for PalmOS 3.0
+ FormActiveStateType = record
+ data: array [0..10] of UInt16;
+ end;
+
+// FrmCustomResponseAlert callback routine prototype
+ FormCheckResponseFuncType = function(button: Int16; attempt: PChar): Boolean;
+ FormCheckResponseFuncPtr = FormCheckResponseFuncType;
+
+//--------------------------------------------------------------------
+//
+// Form Function
+//
+//--------------------------------------------------------------------
+
+function FrmInitForm(rscID: UInt16): FormPtr; syscall sysTrapFrmInitForm;
+
+procedure FrmDeleteForm(formP: FormPtr); syscall sysTrapFrmDeleteForm;
+
+procedure FrmDrawForm(formP: FormPtr); syscall sysTrapFrmDrawForm;
+
+procedure FrmEraseForm(formP: FormPtr); syscall sysTrapFrmEraseForm;
+
+function FrmGetActiveForm: FormPtr; syscall sysTrapFrmGetActiveForm;
+
+procedure FrmSetActiveForm(formP: FormPtr); syscall sysTrapFrmSetActiveForm;
+
+function FrmGetActiveFormID: UInt16; syscall sysTrapFrmGetActiveFormID;
+
+function FrmGetActiveField(const formP: FormPtr): FieldPtr; syscall sysTrapFrmGetActiveField;
+
+function FrmGetUserModifiedState(const formP: FormPtr): Boolean; syscall sysTrapFrmGetUserModifiedState;
+
+procedure FrmSetNotUserModified(formP: FormPtr); syscall sysTrapFrmSetNotUserModified;
+
+function FrmGetFocus(const formP: FormPtr): UInt16; syscall sysTrapFrmGetFocus;
+
+procedure FrmSetFocus(formP: FormPtr; fieldIndex: UInt16); syscall sysTrapFrmSetFocus;
+
+function FrmHandleEvent(formP: FormPtr; eventP: EventPtr): Boolean; syscall sysTrapFrmHandleEvent;
+
+procedure FrmGetFormBounds(const formP: FormPtr; var rP: RectangleType); syscall sysTrapFrmGetFormBounds;
+
+function FrmGetWindowHandle(const formP: FormPtr): WinHandle; syscall sysTrapFrmGetWindowHandle;
+
+function FrmGetFormId(const formP: FormPtr): UInt16; syscall sysTrapFrmGetFormId;
+
+function FrmGetFormPtr(formId: UInt16): FormPtr; syscall sysTrapFrmGetFormPtr;
+
+function FrmGetFirstForm: FormPtr; syscall sysTrapFrmGetFirstForm;
+
+function FrmGetNumberOfObjects(const formP: FormPtr): UInt16; syscall sysTrapFrmGetNumberOfObjects;
+
+function FrmGetObjectIndex(const formP: FormPtr; objID: UInt16): UInt16; syscall sysTrapFrmGetObjectIndex;
+
+function FrmGetObjectIndexFromPtr(const formP: FormPtr; objP: Pointer): UInt16; syscall sysTrapFrmGetObjectIndexFromPtr;
+
+function FrmGetObjectId(const formP: FormPtr; objIndex: UInt16): UInt16; syscall sysTrapFrmGetObjectId;
+
+function FrmGetObjectType(const formP: FormPtr; objIndex: UInt16): FormObjectKind; syscall sysTrapFrmGetObjectType;
+
+function FrmGetObjectPtr(const formP: FormPtr; objIndex: UInt16): Pointer; syscall sysTrapFrmGetObjectPtr;
+
+procedure FrmGetObjectBounds(const formP: FormPtr; objIndex: UInt16; var rP: RectangleType); syscall sysTrapFrmGetObjectBounds;
+
+procedure FrmHideObject(formP: FormPtr; objIndex: UInt16); syscall sysTrapFrmHideObject;
+
+procedure FrmShowObject(formP: FormPtr; objIndex: UInt16); syscall sysTrapFrmShowObject;
+
+procedure FrmGetObjectPosition(const formP: FormPtr; objIndex: UInt16; var x, y: Coord); syscall sysTrapFrmGetObjectPosition;
+
+procedure FrmSetObjectPosition(formP: FormPtr; objIndex: UInt16; x, y: Coord); syscall sysTrapFrmSetObjectPosition;
+
+procedure FrmSetObjectBounds(formP: FormPtr; objIndex: UInt16; {const} var bounds: RectangleType); syscall sysTrapFrmSetObjectBounds;
+
+function FrmGetControlValue(const formP: FormPtr; objIndex: UInt16): Int16; syscall sysTrapFrmGetControlValue;
+
+procedure FrmSetControlValue(const formP: FormPtr; objIndex, newValue: Int16); syscall sysTrapFrmSetControlValue;
+
+function FrmGetControlGroupSelection(const formP: FormPtr; groupNum: UInt8): UInt16; syscall sysTrapFrmGetControlGroupSelection;
+
+procedure FrmSetControlGroupSelection(const formP: FormPtr; groupNum: UInt8; controlID: UInt16); syscall sysTrapFrmSetControlGroupSelection;
+
+procedure FrmCopyLabel(formP: FormPtr; labelID: UInt16; const newLabel: PChar); syscall sysTrapFrmCopyLabel;
+
+function FrmGetLabel(const formP: FormPtr; labelID: UInt16): {const} PChar; syscall sysTrapFrmGetLabel;
+
+procedure FrmSetCategoryLabel(const formP: FormPtr; objIndex: UInt16; newLabel: PChar); syscall sysTrapFrmSetCategoryLabel;
+
+function FrmGetTitle(const formP: FormPtr): {const} PChar; syscall sysTrapFrmGetTitle;
+
+procedure FrmSetTitle(formP: FormPtr; newTitle: PChar); syscall sysTrapFrmSetTitle;
+
+procedure FrmCopyTitle(formP: FormPtr; const newTitle: PChar); syscall sysTrapFrmCopyTitle;
+
+function FrmGetGadgetData(const formP: FormPtr; objIndex: UInt16): Pointer; syscall sysTrapFrmGetGadgetData;
+
+procedure FrmSetGadgetData(formP: FormPtr; objIndex: UInt16; const data: Pointer); syscall sysTrapFrmSetGadgetData;
+
+procedure FrmSetGadgetHandler(formP: FormPtr; objIndex: UInt16; attrP: FormGadgetHandlerType); syscall sysTrapFrmSetGadgetHandler;
+
+function FrmDoDialog(formP: FormPtr): UInt16; syscall sysTrapFrmDoDialog;
+
+function FrmAlert(alertId: UInt16): UInt16; syscall sysTrapFrmAlert;
+
+function FrmCustomAlert(alertId: UInt16; const s1, s2, s3: PChar): UInt16; syscall sysTrapFrmCustomAlert;
+
+procedure FrmHelp(helpMsgId: UInt16); syscall sysTrapFrmHelp;
+
+procedure FrmUpdateScrollers(formP: FormPtr; upIndex, downIndex: UInt16; scrollableUp, scrollableDown: Boolean); syscall sysTrapFrmUpdateScrollers;
+
+function FrmVisible(const formP: FormPtr): Boolean; syscall sysTrapFrmVisible;
+
+procedure FrmSetEventHandler(formP: FormPtr; handler: FormEventHandlerType); syscall sysTrapFrmSetEventHandler;
+
+function FrmDispatchEvent(var eventP: EventType): Boolean; syscall sysTrapFrmDispatchEvent;
+
+procedure FrmPopupForm(formId: UInt16); syscall sysTrapFrmPopupForm;
+
+procedure FrmGotoForm(formId: UInt16); syscall sysTrapFrmGotoForm;
+
+procedure FrmUpdateForm(formId, updateCode: UInt16); syscall sysTrapFrmUpdateForm;
+
+procedure FrmReturnToForm(formId: UInt16); syscall sysTrapFrmReturnToForm;
+
+procedure FrmCloseAllForms; syscall sysTrapFrmCloseAllForms;
+
+procedure FrmSaveAllForms; syscall sysTrapFrmSaveAllForms;
+
+function FrmPointInTitle(const formP: FormPtr; x, y: Coord): Boolean; syscall sysTrapFrmPointInTitle;
+
+procedure FrmSetMenu(formP: FormPtr; menuRscID: UInt16); syscall sysTrapFrmSetMenu;
+
+function FrmValidatePtr(const formP: FormPtr): Boolean; syscall sysTrapFrmValidatePtr;
+
+function FrmAddSpaceForObject(var formPP: FormPtr; var objectPP: MemPtr; objectKind: FormObjectKind; objectSize: UInt16): Err; syscall sysTrapFrmAddSpaceForObject;
+
+function FrmRemoveObject(var formPP: FormPtr; objIndex: UInt16): Err; syscall sysTrapFrmRemoveObject;
+
+function FrmNewForm(formID: UInt16; const titleStrP: PChar; x, y, width, height: Coord; modal: Boolean;
+ defaultButton, helpRscID, menuRscID: UInt16): FormPtr; syscall sysTrapFrmNewForm;
+
+function FrmNewLabel(var formPP: FormPtr; ID: UInt16; const textP: PChar; x, y: Coord; font: FontID): FormLabelPtr; syscall sysTrapFrmNewLabel;
+
+function FrmNewBitmap(var formPP: FormPtr; ID, rscID: UInt16; x, y: Coord): FormBitmapPtr; syscall sysTrapFrmNewBitmap;
+
+function FrmNewGadget(var formPP: FormPtr; id: UInt16; x, y, width, height: Coord): FormGadgetPtr; syscall sysTrapFrmNewGadget;
+
+function FrmActiveState(var stateP: FormActiveStateType; save: Boolean): Err; syscall sysTrapFrmActiveState;
+
+function FrmCustomResponseAlert(alertId: UInt16; const s1, s2, s3: PChar; entryStringBuf: PChar;
+ entryStringBufLength: Int16; callback: FormCheckResponseFuncType): UInt16; syscall sysTrapFrmCustomResponseAlert;
+
+function FrmNewGsi(var formPP: FormPtr; x, y: Coord): FrmGraffitiStatePtr; syscall sysTrapFrmNewGsi;
+
+function FrmSaveActiveState(var stateP: FormActiveStateType): Err;
+function FrmRestoreActiveState(var stateP: FormActiveStateType): Err;
+
+implementation
+
+function FrmSaveActiveState(var stateP: FormActiveStateType): Err;
+begin
+ FrmSaveActiveState := FrmActiveState(stateP, True);
+end;
+
+function FrmRestoreActiveState(var stateP: FormActiveStateType): Err;
+begin
+ FrmRestoreActiveState := FrmActiveState(stateP, False);
+end;
+
+end.
diff --git a/packages/palmunits/src/fslib.pp b/packages/palmunits/src/fslib.pp
new file mode 100644
index 0000000000..3ebb41eb07
--- /dev/null
+++ b/packages/palmunits/src/fslib.pp
@@ -0,0 +1,224 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: FSLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Sample file system library implementation.
+ *
+ * History:
+ * 02/29/00 Created by Steve Minns
+ * 10/27/00 CS Include VFSMgr.h, since we depend on it.
+ *
+ *****************************************************************************)
+
+(********************************************************************
+ * Filename and Label conventions:
+ *
+ * All path names are absolute
+ *
+ * All filesystems must support filenames and labels that are up to 255 characters long,
+ * using any normal character including spaces and lower case characters in any
+ * character set and the following special characters:
+ * $ % ' - _ @ ~ ` ! ( ) ^ # & + , ; = [ ]
+ ********************************************************************
+ * When creating the 8.3 name or label from a long filename or label:
+ * a) Create the name from the first 1-6 valid, non-space characters, before the last period.
+ * The only valid characters are:
+ * A-Z 0-9 $ % ' - _ @ ~ ` ! ( ) ^ # &
+ * b) the extension is the first three valid characters after the last period '.'
+ * c) the end of the 6 byte name is appended with ~1, or the next unique number.
+ *
+ * A label is created from the first 11 valid non-space characters.
+ ********************************************************************)
+
+unit fslib;
+
+interface
+
+uses palmos, libtraps, vfsmgr;
+
+// When building the PalmOS 3.5 version of ExpansionMgr,
+// since this constant was not in the 3.5 SystemResources.h...
+const
+ sysFileTFileSystem = RSC('libf'); // File type for file system libraries
+
+ fsLibAPIVersion_ = $00000002;
+
+(********************************************************************
+ * Type of FS Library database
+ ********************************************************************)
+
+(********************************************************************
+ * FS library function trap ID's. Each library call gets a trap number:
+ * FSTrapXXXX 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!!! The order of these traps MUST match the order of the dispatch
+ * table in FSLibDispatch.c!!!
+ ********************************************************************)
+
+const
+ FSTrapLibAPIVersion = sysLibTrapCustom;
+ FSTrapCustomControl = sysLibTrapCustom + 1;
+ FSTrapFilesystemType = sysLibTrapCustom + 2;
+
+ FSTrapFileCreate = sysLibTrapCustom + 3;
+ FSTrapFileOpen = sysLibTrapCustom + 4;
+ FSTrapFileClose = sysLibTrapCustom + 5;
+ FSTrapFileRead = sysLibTrapCustom + 6;
+ FSTrapFileWrite = sysLibTrapCustom + 7;
+ FSTrapFileDelete = sysLibTrapCustom + 8;
+ FSTrapFileRename = sysLibTrapCustom + 9;
+ FSTrapFileSeek = sysLibTrapCustom + 10;
+ FSTrapFileEOF = sysLibTrapCustom + 11;
+ FSTrapFileTell = sysLibTrapCustom + 12;
+ FSTrapFileResize = sysLibTrapCustom + 13;
+ FSTrapFileGetAttributes = sysLibTrapCustom + 14;
+ FSTrapFileSetAttributes = sysLibTrapCustom + 15;
+ FSTrapFileGetDate = sysLibTrapCustom + 16;
+ FSTrapFileSetDate = sysLibTrapCustom + 17;
+ FSTrapFileSize = sysLibTrapCustom + 18;
+
+ FSTrapDirCreate = sysLibTrapCustom + 19;
+ FSTrapDirEntryEnumerate = sysLibTrapCustom + 20;
+
+ FSTrapVolumeFormat = sysLibTrapCustom + 21;
+ FSTrapVolumeMount = sysLibTrapCustom + 22;
+ FSTrapVolumeUnmount = sysLibTrapCustom + 23;
+ FSTrapVolumeInfo = sysLibTrapCustom + 24;
+ FSTrapVolumeGetLabel = sysLibTrapCustom + 25;
+ FSTrapVolumeSetLabel = sysLibTrapCustom + 26;
+ FSTrapVolumeSize = sysLibTrapCustom + 27;
+
+ FSMaxSelector = FSTrapVolumeSize;
+
+(********************************************************************
+ * API Prototypes
+ ********************************************************************)
+
+(********************************************************************
+ * Standard library open, close, sleep and wake APIs:
+ ********************************************************************)
+
+function FSLibOpen(fsLibRefNum: UInt16): Err; syscall sysLibTrapOpen;
+
+function FSLibClose(fsLibRefNum: UInt16): Err; syscall sysLibTrapClose;
+
+function FSLibSleep(fsLibRefNum: UInt16): Err; syscall sysLibTrapSleep;
+
+function FSLibWake(fsLibRefNum: UInt16): Err; syscall sysLibTrapWake;
+
+(********************************************************************
+ * Custom library APIs:
+ ********************************************************************)
+
+function FSLibAPIVersion(fsLibRefNum: UInt16): UInt32; syscall FSTrapLibAPIVersion;
+
+function FSCustomControl(fsLibRefNum: UInt16; apiCreator: UInt32; apiSelector: UInt16;
+ valueP: Pointer; var valueLenP: UInt16): Err; syscall FSTrapCustomControl;
+
+function FSFilesystemType(fsLibRefNum: UInt16; var filesystemTypeP: UInt32): Err; syscall FSTrapFilesystemType;
+
+(********************************************************************
+ * File Stream APIs:
+ ********************************************************************)
+
+function FSFileCreate(fsLibRefNum: UInt16; volRefNum: UInt16; const pathNameP: PChar): Err; syscall FSTrapFileCreate;
+
+function FSFileOpen(fsLibRefNum: UInt16; volRefNum: UInt16; const pathNameP: PChar;
+ openMode: UInt16; var fileRefP: FileRef): Err; syscall FSTrapFileOpen;
+
+function FSFileClose(fsLibRefNum: UInt16; fileRef: FileRef): Err; syscall FSTrapFileClose;
+
+function FSFileRead(fsLibRefNumUInt16: UInt16; fileRef: FileRef; numBytes: UInt32;
+ bufBaseP: Pointer; offset: UInt32; dataStoreBased: Boolean;
+ var numBytesReadP: UInt32): Err; syscall FSTrapFileRead;
+
+function FSFileWrite(fsLibRefNum: UInt16; fileRef: FileRef; numBytes: UInt32;
+ const dataP: Pointer; var numBytesWrittenP: UInt32): Err; syscall FSTrapFileWrite;
+
+function FSFileDelete(fsLibRefNum: UInt16; volRefNum: UInt16; const pathNameP: PChar): Err; syscall FSTrapFileDelete;
+
+function FSFileRename(fsLibRefNum: UInt16; volRefNum: UInt16; const pathNameP: PChar; const newNameP: PChar): Err; syscall FSTrapFileRename;
+
+function FSFileSeek(fsLibRefNum: UInt16; fileRef: FileRef; origin: FileOrigin; offset: Int32): Err; syscall FSTrapFileSeek;
+
+function FSFileEOF(fsLibRefNum: UInt16; fileRef: FileRef): Err; syscall FSTrapFileEOF;
+
+function FSFileTell(fsLibRefNum: UInt16; fileRef: FileRef; var filePosP: UInt32): Err; syscall FSTrapFileTell;
+
+function FSFileResize(fsLibRefNum: UInt16; fileRef: FileRef; newSize: UInt32): Err; syscall FSTrapFileResize;
+
+function FSFileGetAttributes(fsLibRefNum: UInt16; fileRef: FileRef; var attributesP: UInt32): Err; syscall FSTrapFileGetAttributes;
+
+function FSFileSetAttributes(fsLibRefNum: UInt16; fileRef: FileRef; attributes: UInt32): Err; syscall FSTrapFileSetAttributes;
+
+function FSFileGetDate(fsLibRefNum: UInt16; fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err; syscall FSTrapFileGetDate;
+
+function FSFileSetDate(fsLibRefNum: UInt16; fileRef: FileRef; whichDate: UInt16; date: UInt32): Err; syscall FSTrapFileSetDate;
+
+function FSFileSize(fsLibRefNum: UInt16; fileRef: FileRef; var fileSizeP: UInt32): Err; syscall FSTrapFileSize;
+
+(********************************************************************
+ * Directory APIs:
+ ********************************************************************)
+
+function FSDirCreate(fsLibRefNum: UInt16; volRefNum: UInt16; const dirNameP: PChar): Err; syscall FSTrapDirCreate;
+
+(************************************************************
+ *
+ * MACRO: FSDirDelete
+ *
+ * DESCRIPTION: Delete a closed directory.
+ *
+ * PARAMETERS: fsLibRefNum -- FS library reference number
+ * volRefNum -- Volume reference number returned by FSVolumeMount
+ * pathNameP -- Full path of the directory to be deleted
+ *
+ * RETURNS: errNone -- no error
+ * expErrNotOpen -- FS driver library has not been opened
+ * vfsErrFileStillOpen -- Directory is still open
+ * vfsErrFileNotFound -- the file could not be found
+ * vfsErrVolumeBadRef -- the volume has not been mounted with FSVolumeMount
+ *
+ *************************************************************)
+
+function FSDirDelete(fsLibRefNum: UInt16; volRefNum: UInt16; const dirNameP: PChar): Err;
+
+function FSDirEntryEnumerate(fsLibRefNum: UInt16; dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err; syscall FSTrapDirEntryEnumerate;
+
+(********************************************************************
+ * Volume APIs:
+ ********************************************************************)
+
+function FSVolumeFormat(fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall FSTrapVolumeFormat;
+
+function FSVolumeMount(fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall FSTrapVolumeMount;
+
+function FSVolumeUnmount(fsLibRefNum: UInt16; volRefNum: UInt16): Err; syscall FSTrapVolumeUnmount;
+
+function FSVolumeInfo(fsLibRefNum: UInt16; volRefNum: UInt16; var volInfoP: VolumeInfoType): Err; syscall FSTrapVolumeInfo;
+
+function FSVolumeGetLabel(fsLibRefNum: UInt16; volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err; syscall FSTrapVolumeGetLabel;
+
+function FSVolumeSetLabel(fsLibRefNum: UInt16; volRefNum: UInt16; const labelP: PChar): Err; syscall FSTrapVolumeSetLabel;
+
+function FSVolumeSize(fsLibRefNum: UInt16; volRefNum: UInt16; var volumeUsedP: UInt32; var volumeTotalP: UInt32): Err; syscall FSTrapVolumeSize;
+
+implementation
+
+function FSDirDelete(fsLibRefNum: UInt16; volRefNum: UInt16; const dirNameP: PChar): Err;
+begin
+ FSDirDelete := FSFileDelete(fsLibRefNum, volRefNum, dirNameP);
+end;
+
+end.
diff --git a/packages/palmunits/src/graffiti.pp b/packages/palmunits/src/graffiti.pp
new file mode 100644
index 0000000000..265daa45dd
--- /dev/null
+++ b/packages/palmunits/src/graffiti.pp
@@ -0,0 +1,183 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Graffiti.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header for the Graffiti interface
+ *
+ * History:
+ * 6/30 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit graffiti;
+
+interface
+
+uses palmos, coretraps, rect, errorbase;
+
+(*------------------------------------------------------------------------------
+ * Match info structure. Returned by GrfMatch and GrfMatchGlyph
+ *-----------------------------------------------------------------------------*)
+
+type
+ GrfMatchType = record
+ glyphID: UInt8; // glyph ID of this match
+ unCertainty: UInt8; // unCertainty of this match (0 most certain)
+ end;
+
+const
+ grfMaxMatches = 4;
+
+type
+ GrfMatchInfoType = record
+ numMatches: UInt16; // number of matches returned in this structure
+ match: array [0..grfMaxMatches-1] of GrfMatchType;
+ end;
+
+ GrfMatchInfoPtr = ^GrfMatchInfoType;
+
+//----------------------------------------------------------------------------
+// Escape codes preceding special sequences in the dictionary or macros
+//----------------------------------------------------------------------------
+// In dictionary or macros preceding virtual key event sequences. These are always
+// 13 byte sequences that have ASCII encoded values for the ascii code, keyCode,
+// and modifiers:
+// grfVirtualSequence, ascii, keyCode, modifiers.
+// 1 byte 4 bytes 4 bytes 4 bytes
+
+const
+ grfVirtualSequence = $01;
+
+// In dictionary to tell us about temp shift state changes.
+ grfShiftSequence = $02;
+
+// In dictionary/macros to hide special features
+ grfSpecialSequence = $03;
+
+
+// Determine if a string has a sequence
+{
+ HasVirtualSequence(s) (s[0] == grfVirtualSequence)
+ HasSpecialSequence(s) (s[0] == grfSpecialSequence)
+}
+
+(*------------------------------------------------------------------------------
+ * Temp shift states, returned by GrfGetState
+ *-----------------------------------------------------------------------------*)
+
+ grfTempShiftPunctuation = 1;
+ grfTempShiftExtended = 2;
+ grfTempShiftUpper = 3;
+ grfTempShiftLower = 4;
+
+(*------------------------------------------------------------------------------
+ * Macro (aka Shortcut) related constants/macros
+ * Use the definitions in ShortcutLib.h instead!
+ *-----------------------------------------------------------------------------*)
+
+ // Char indicating a seqeunce of characters to expand.
+ grfExpansionSequence = '@';
+
+ // Chars indicating what to expand into
+ expandDateChar = 'D';
+ expandTimeChar = 'T';
+ expandStampChar = 'S'; // This follows 'D' or 'T' for the sake
+ // of the mnemonic name.
+ // max shortcut name length
+ grfNameLength = 8; // eight letters possible (don't forget CR)
+
+ // index which is not a shortcut
+ grfNoShortCut = $ffff;
+
+(************************************************************
+ * Graffiti result codes
+ *************************************************************)
+
+ grfErrBadParam = grfErrorClass or 1;
+ grfErrPointBufferFull = grfErrorClass or 2;
+ grfErrNoGlyphTable = grfErrorClass or 3;
+ grfErrNoDictionary = grfErrorClass or 4;
+ grfErrNoMapping = grfErrorClass or 5;
+ grfErrMacroNotFound = grfErrorClass or 6;
+ grfErrDepthTooDeep = grfErrorClass or 7;
+ grfErrMacroPtrTooSmall = grfErrorClass or 8;
+ grfErrNoMacros = grfErrorClass or 9;
+
+ grfErrMacroIncomplete = grfErrorClass or 129; // (grfWarningOffset+1)
+ grfErrBranchNotFound = grfErrorClass or 130; // (grfWarningOffset+2)
+ grfErrGenericHWRErrBase = grfErrorClass or 16;
+ grfErrNoHWRInstalled = grfErrGenericHWRErrBase;
+
+(************************************************************
+ * Graffiti interface procedures
+ *************************************************************)
+
+//-----------------------------------------------------------------
+// High Level Calls
+//------------------------------------------------------------------
+
+function GrfInit: Err; syscall sysTrapGrfInit;
+
+function GrfFree: Err; syscall sysTrapGrfFree;
+
+function GrfProcessStroke(var startPtP, endPtP: PointType; upShift: Boolean): Err; syscall sysTrapGrfProcessStroke;
+
+function GrfFieldChange(resetState: Boolean; var characterToDelete: UInt16): Err; syscall sysTrapGrfFieldChange;
+
+function GrfGetState(var capsLockP, numLockP: Boolean; var tempShiftP: UInt16; var autoShiftedP: Boolean): Err; syscall sysTrapGrfGetState;
+
+function GrfSetState(capsLock, numLock, upperShift: Boolean): Err; syscall sysTrapGrfSetState;
+
+//-----------------------------------------------------------------
+// Mid Level Calls
+//------------------------------------------------------------------
+
+function GrfFlushPoints: Err; syscall sysTrapGrfFlushPoints;
+
+function GrfAddPoint(var pt: PointType): Err; syscall sysTrapGrfAddPoint;
+
+function GrfInitState: Err; syscall sysTrapGrfInitState;
+
+function GrfCleanState: Err; syscall sysTrapGrfCleanState;
+
+function GrfMatch(var flagsP: UInt16; dataPtrP: Pointer; var dataLenP, uncertainLenP: UInt16;
+ matchInfoP: GrfMatchInfoPtr): Err; syscall sysTrapGrfMatch;
+
+function GrfGetMacro(nameP: PChar; var macroDataP: UInt8; var dataLenP: UInt16): Err; syscall sysTrapGrfGetMacro;
+
+function GrfGetAndExpandMacro(nameP: PChar; var macroDataP: UInt8; var dataLenP: UInt16): Err; syscall sysTrapGrfGetAndExpandMacro;
+
+//-----------------------------------------------------------------
+// Low Level Calls
+//------------------------------------------------------------------
+
+function GrfFilterPoints: Err; syscall sysTrapGrfFilterPoints;
+
+function GrfGetNumPoints(var numPtsP: UInt16): Err; syscall sysTrapGrfGetNumPoints;
+
+function GrfGetPoint(index: UInt16; var pointP: PointType): Err; syscall sysTrapGrfGetPoint;
+
+function GrfFindBranch(flags: UInt16): Err; syscall sysTrapGrfFindBranch;
+
+function GrfMatchGlyph(matchInfoP: GrfMatchInfoPtr; maxUnCertainty: Int16; maxMatches: UInt16): Err; syscall sysTrapGrfMatchGlyph;
+
+function GrfGetGlyphMapping(glyphID: UInt16; var flagsP: UInt16; dataPtrP: Pointer;
+ var dataLenP, uncertainLenP: UInt16): Err; syscall sysTrapGrfGetGlyphMapping;
+
+function GrfGetMacroName(index: UInt16; nameP: PChar): Err; syscall sysTrapGrfGetMacroName;
+
+function GrfDeleteMacro(index: UInt16): Err; syscall sysTrapGrfDeleteMacro;
+
+function GrfAddMacro(const nameP: PChar; var macroDataP: UInt8; dataLen: UInt16): Err; syscall sysTrapGrfAddMacro;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/graffitireference.pp b/packages/palmunits/src/graffitireference.pp
new file mode 100644
index 0000000000..8329d84106
--- /dev/null
+++ b/packages/palmunits/src/graffitireference.pp
@@ -0,0 +1,43 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: GraffitiReference.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the Graffiti Reference routines.
+ *
+ * History:
+ * June 25, 1996 Created by Roger Flores
+ * 06/25/96 rsf Created by Roger Flores
+ * 07/30/99 kwk Moved all reference types other than referenceDefault
+ * into GraffitiReference.c
+ *
+ *****************************************************************************)
+
+unit graffitireference;
+
+interface
+
+uses palmos, coretraps;
+
+type
+ ReferenceType = Enum;
+
+const
+ referenceDefault = $ff; // based on graffiti mode
+
+(************************************************************
+ * Graffiti Reference procedures
+ *************************************************************)
+
+procedure SysGraffitiReferenceDialog(referenceType: ReferenceType); syscall sysTrapSysGraffitiReferenceDialog;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/graffitishift.pp b/packages/palmunits/src/graffitishift.pp
new file mode 100644
index 0000000000..8667b37d3e
--- /dev/null
+++ b/packages/palmunits/src/graffitishift.pp
@@ -0,0 +1,56 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: GraffitiShift.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines Griffiti shift state indicator routines.
+ *
+ * History:
+ * Aug 24, 1995 Created by Art Lamb
+ * mm/dd/yy initials - brief revision comment
+ *
+ *****************************************************************************)
+
+unit graffitishift;
+
+interface
+
+uses palmos, coretraps;
+
+// Graffiti lock flags
+const
+ glfCapsLock = $01;
+ glfNumLock = $02;
+
+type
+ GsiShiftState = Enum;
+
+const
+ gsiShiftNone = 0; // no indicator
+ gsiNumLock = Succ(gsiShiftNone); // numeric lock
+ gsiCapsLock = Succ(gsiNumLock); // capital lock
+ gsiShiftPunctuation = Succ(gsiCapsLock); // punctuation shift
+ gsiShiftExtended = Succ(gsiShiftPunctuation); // extented punctuation shift
+ gsiShiftUpper = Succ(gsiShiftExtended); // alpha upper case shift
+ gsiShiftLower = Succ(gsiShiftUpper); // alpha lower case
+
+procedure GsiInitialize; syscall sysTrapGsiInitialize;
+
+procedure GsiSetLocation(const x, y: Int16); syscall sysTrapGsiSetLocation;
+
+procedure GsiEnable(const enableIt: Boolean); syscall sysTrapGsiEnable;
+
+function GsiEnabled: Boolean; syscall sysTrapGsiEnabled;
+
+procedure GsiSetShiftState(const lockFlags, tempShift: UInt16); syscall sysTrapGsiSetShiftState;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/hal.pp b/packages/palmunits/src/hal.pp
new file mode 100644
index 0000000000..e2ea6e19e3
--- /dev/null
+++ b/packages/palmunits/src/hal.pp
@@ -0,0 +1,54 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HAL.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * General HAL Equates. This header file contains function prototypes for
+ * HAL routines, and is used by both Palm OS and the HAL module.
+ *
+ * History:
+ * 5/31/99 SCL Created by Steve Lemke
+ * 8/24/00 SCL Cleanup; moved boot-related prototypes (HwrInitProcPtr,
+ * HwrPreRAMInit, and HwrInit) to "HwrBoot.h"
+ *
+ *****************************************************************************)
+
+unit hal;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(***********************************************************************
+ * Hardware Manager (HAL) constants
+ **********************************************************************)
+
+// Error codes related to HwrCustom() API
+const
+ hwrErrHwrCustomNotImplemented = hwrErrorClass or 1;
+ hwrErrCreatorNotSupported = hwrErrorClass or 2;
+ hwrErrSelectorNotSupported = hwrErrorClass or 3;
+ hwrErrParamTooSmall = hwrErrorClass or 4;
+
+(**************************************************************************
+ * Prototypes of functions used only when running on the real hardware
+ ***************************************************************************)
+
+// HwrCustom call is new in Palm OS 4.0, and many HALs may not support it.
+// This won't cause problems though, since the OS installs a default handler
+// (in case the HAL doesn't install its own). The default OS handler simply
+// always returns hwrErrHwrCustomNotImplemented.
+
+function HwrCustom(creator: UInt32; opCode: UInt32; paramP: Pointer;
+ var paramSizeP: UInt16): Err; syscall sysTrapHwrCustom;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/helper.pp b/packages/palmunits/src/helper.pp
new file mode 100644
index 0000000000..5268b89492
--- /dev/null
+++ b/packages/palmunits/src/helper.pp
@@ -0,0 +1,171 @@
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Helper.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Public header file for the Helper API.
+ *
+ *****************************************************************************)
+
+unit helper;
+
+interface
+
+uses palmos;
+
+//------------------------------------------------------------------------
+// HelperNotifyEventType structure
+// This structure is passed as the notifyDetailsP field of SysNotifyParamType with
+// a sysNotifyHelperEvent notificatiom.
+//------------------------------------------------------------------------
+
+const
+ kHelperNotifyCurrentVersion = 1;
+
+// Action codes for the sysNotifyHelperEvent broadcast (used in HelperNotifyEventType)
+type
+ HelperNotifyActionCodeType = UInt16;
+
+const
+ kHelperNotifyActionCodeEnumerate = HelperNotifyActionCodeType(1);
+ kHelperNotifyActionCodeValidate = HelperNotifyActionCodeType(2);
+ kHelperNotifyActionCodeExecute = HelperNotifyActionCodeType(3);
+
+type
+ HelperNotifyEventTypeTag = record
+ // Version - this definition is version 1
+ // Later versions should include all the same fields as version 1
+ // of HelperNotifyEventType plus additional fields
+ version: UInt16;
+
+ // what to do: enumerate, validate, or do it.
+ actionCode: HelperNotifyActionCodeType;
+
+ // data specific to the action code - valid if version = 1 for now
+ case Integer of
+ 1: (enumerateP: Pointer {^HelperNotifyEnumerateListTypeTag});
+ 2: (validateP: Pointer {^HelperNotifyValidateTypeTag});
+ 3: (executeP: Pointer {^HelperNotifyExecuteTypeTag});
+ end;
+ HelperNotifyEventType = HelperNotifyEventTypeTag;
+
+//------------------------------------------------------------------------
+// HelperNotifyEnumerateListType structure
+// An element in a linked list of helpers (used below)...
+//------------------------------------------------------------------------
+// In an helperNotifyActionCodeEnumerate response, this should be allocated
+// by the helper in the heap with MemPtrNew() and changed to be owned by the
+// system. It will be freed by the broadcaster. If a helper supports multiple
+// service classes, it should create multiple entries.
+//
+
+const
+ kHelperAppMaxNameSize = 48; // max. helper name length, including zero-
+ // terminator, expressed in # of bytes
+
+ kHelperAppMaxActionNameSize = 32; // max. helper action name length, including
+ // zero-terminator, expressed in # of
+ // bytes
+
+type
+ HelperNotifyEnumerateListTypeTag = record
+ // Pointer to the next element in the list, or NULL to signal end of list.
+ nextP: ^HelperNotifyEnumerateListType;
+
+ // The name of the helper to show to the user (for example, when choosing
+ // a default/preferred helper for a given class of service; zero-terminated
+ // string).
+ helperAppName: array [0..kHelperAppMaxNameSize-1] of Char;
+
+ // Custom text that represents the action to be taken, such as "Dial",
+ // "Send fax", etc. (for display in an action pop-up, or button, for example);
+ // zero-terminated string.
+ actionName: array [0..kHelperAppMaxActionNameSize-1] of Char;
+
+ // The registered, unique ID of the helper (typically the helper app's
+ // creator ID).
+ helperAppID: UInt32;
+
+ // Services class ID supported by the helper; for example:
+ // helperServiceClassIDEMail (see HelperServiceClass.h)
+ serviceClassID: UInt32;
+ end;
+ HelperNotifyEnumerateListType = HelperNotifyEnumerateListTypeTag;
+
+//------------------------------------------------------------------------
+// HelperNotifyValidateType structure
+// Data type for the helperNotifyActionCodeValidate event.
+//------------------------------------------------------------------------
+// The matching helper(s) must set the "handled" field of SysNotifyParamType
+// to true.
+
+ HelperNotifyValidateTypeTag = record
+ // IN: Service Class ID of requested service (required); for example:
+ // helperServiceClassIDEMail (see HelperServiceClass.h)
+ serviceClassID: UInt32;
+
+ // IN: The unique ID of the Helper; may be 0 (zero) to indicate any
+ // available helper of the specified service class;
+ helperAppID: UInt32;
+ end;
+ HelperNotifyValidateType = HelperNotifyValidateTypeTag;
+
+//------------------------------------------------------------------------
+// Data type for the helperNotifyActionCodeExecute event
+//------------------------------------------------------------------------
+//
+// The target helper that processes the request must set the "handled" field
+// of SysNotifyParamType to true, even if a failure occurred during processing.
+// The 'err' field of the HelperNotifyExecuteType structure is used to indicate
+// success or failure.
+//
+// Helpers must check if the "handled" field in HelperNotifyEventType structure is
+// already set, and *not* process the "execute" request if so.
+//
+// The helper is responsible for informing user of any errors.
+//
+
+ HelperNotifyExecuteTypeTag = record
+ // IN: Service Class ID of requested service (required); for example:
+ // helperServiceClassIDEMail (see HelperServiceClass.h)
+ serviceClassID: UInt32;
+
+ // IN: The unique ID of the Helper; may be 0 (zero) to indicate any
+ // available helper of the specified service class;
+ helperAppID: UInt32;
+
+ // IN: Service-dependent data string, such as a phone number or email
+ // address (see HelperServiceClass.h for data that is appropriate for
+ // each of the "common" service classes); zero-terminated; will be
+ // duplicated by helper if necessary (ex. "1-650-123-4567",
+ // "john@host.com", etc.). Multiple fields may be separated by
+ // semicolons (';').
+ dataP: PChar;
+
+ // IN: Description of data; zero-terminated; will be duplicated by helper
+ // if necessary (ex. "John Doe"); this field is optional -- may be NULL.
+ displayedName: PChar;
+
+ // IN: Pointer to a service-specific extended details data structure or NULL.
+ // This optional field is used for supplying additional arguments to the
+ // helper. The type of each of these data structures is well-defined
+ // and associated with a specific helper service class; will be duplicated
+ // by helper if necessary; may be ignored by helper.
+ detailsP: Pointer;
+
+ // OUT: service-specific error code; must be initialize to 0 (zero) by host
+ // before broadcasting this request. 0 is used to signal success (although
+ // this may only be an indication that a request was scheduled and may
+ // not be performed until an app switch takes place).
+ err: Err;
+ end;
+ HelperNotifyExecuteType = HelperNotifyExecuteTypeTag;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/helperserviceclass.pp b/packages/palmunits/src/helperserviceclass.pp
new file mode 100644
index 0000000000..aededd384d
--- /dev/null
+++ b/packages/palmunits/src/helperserviceclass.pp
@@ -0,0 +1,127 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HelperServiceClass.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Public header file for the service class ID's and extended details
+ * data structures used with the "address book helper" API.
+ *
+ * For each Service Class ID, this header file also defines the
+ * corresponding extended details data structures that may
+ * optionally be passed as the 'pDetails' element in the
+ * HelperNotifyExecuteType structure. We strongly recommend that
+ * every extra details data structure include a version number,
+ * which will alow the structure to be extended by adding new structure
+ * elements later.
+ *
+ * The Service Class ID is a 32-bit value that uniquely identifies the
+ * class of service performed by the Helper -- for example, making a
+ * voice telephone call, sending an internet e-mail, sending an SMS
+ * message, sending a fax, etc. Palm defines some common Service Class
+ * ID's and the corresponding extra details structures in this header file.
+ *
+ * 3rd party developers:
+ * If none of these service class ID's match the service performed by your
+ * helper, you must register a unique service class ID using the Creator ID
+ * registry on Palm's web site (or use a creator ID that you already own).
+ * A group of developers may elect to support the same service class ID for
+ * interoperability.
+ *
+ *****************************************************************************)
+
+unit helperserviceclass;
+
+interface
+
+uses palmos;
+
+//------------------------------------------------------------------------
+// Current Helper Service Class ID's
+//------------------------------------------------------------------------
+
+//
+// Helpers of this Service Class make a voice telephone call.
+//
+// The telephone number to dial is passed in the 'pData' element of the main
+// structure (HelperNotifyExecuteType)
+//
+// The 'pDetails' struct member is NULL for this service class.
+//
+
+const
+ kHelperServiceClassIDVoiceDial = Rsc('voic');
+
+//
+// Helpers of this Service Class send an Internet mail message.
+//
+// "To" address(es) are passed in the 'pData' element of the main structure
+// (HelperNotifyExecuteType)
+//
+// The 'pDetails' struct member may optionally point to
+// HelperServiceEMailDetailsType for this service class.
+//
+
+ kHelperServiceClassIDEMail = Rsc('mail');
+
+type
+ _HelperServiceEMailDetailsType = record
+ version: UInt16; // this is version 1
+
+ cc: PChar; // IN: carbon copy address string or NULL -- will
+ // be duplicated by helper if necessary;
+ // multiple addresses are separated by
+ // semicolon (ex. "john@host.com; jane@host.com")
+ subject: PChar; // IN: subject string or NULL -- will be duplicated
+ // by helper if necessary (ex. "helper API")
+ message: PChar; // IN: initial message body string or NULL -- will be
+ // duplicated by helper if necessary (ex.
+ // "Lets discuss the helper API tomorrow.")
+ end;
+ HelperServiceEMailDetailsType = _HelperServiceEMailDetailsType;
+
+//
+// Helpers of this Service Class send an SMS message.
+//
+// SMS mailbox number is passed in the 'pData' element of the main structure
+// (HelperNotifyExecuteType).
+//
+// The 'pDetails' struct member may optionally point to
+// HelperServiceSMSDetailsType for this service class.
+//
+
+const
+ kHelperServiceClassIDSMS = Rsc('sms_');
+
+type
+ _HelperServiceSMSDetailsType = record
+ version: UInt16; // this is version 1
+
+ message: PChar; // IN: initial message body string or NULL -- will be
+ // duplicated by helper if necessary (ex.
+ // "Lets discuss the helper API tomorrow.")
+ end;
+ HelperServiceSMSDetailsType = _HelperServiceSMSDetailsType;
+
+//
+// Helpers of this Service Class send a fax.
+//
+// The fax number is passed in the 'pData' element of the main structure
+// (HelperNotifyExecuteType).
+//
+// The 'pDetails' struct member is NULL for this service class.
+//
+
+const
+ kHelperServiceClassIDFax = Rsc('fax_');
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/hwrmiscflags.pp b/packages/palmunits/src/hwrmiscflags.pp
new file mode 100644
index 0000000000..55eb0fdb86
--- /dev/null
+++ b/packages/palmunits/src/hwrmiscflags.pp
@@ -0,0 +1,229 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: HwrMiscFlags.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Bit constants for the hardware MiscFlags
+ *
+ * History:
+ * 10/26/99 JED Created by Jesse Donaldson, extracted from <HwrGlobals.h>
+ *
+ *****************************************************************************)
+
+unit hwrmiscflags;
+
+interface
+
+(**************************************************************************
+ * General Equates
+ ***************************************************************************)
+
+// ----------------------------------------------------------------------
+// NOTE: In some ROMs between 3.0 and 3.3 (inclusive), OEMs may have
+// ROM tokens present in the ROM that were detected by the boot code
+// in order to set the various HwrMiscFlags and GHwrMiscFlagsExt
+// settings. That scheme is no longer relevant, since starting with
+// version 3.5 and later, it is now the responsibility of the HAL
+// to set these flags, using whatever means necessary to determine
+// what "features" the device has that the higher level OS may want
+// to know about.
+//
+// These flags are defined in this public header file since both
+// of these low memory globals are published as system features
+// (sysFtrNumHwrMiscFlags and sysFtrNumHwrMiscFlagsExt) in <SystemMgr.h>.
+// These features are for third party software that may (for whatever
+// reason) want to know about certain hardware differences without
+// having to read the low memory globals directly.
+//
+// Palm OS v3.1 was the first OS to publish sysFtrNumHwrMiscFlags as a feature.
+// Call FtrGet first; if the feature doesn't exist, check the OS version:
+// Palm OS v2.0 and 3.0 have GHwrMiscFlags defined as a low memory global.
+// Palm OS v1.0 did not have GHwrMiscFlags, so its contents are unpredictable.
+// Any devices running Palm OS v1.0 devices should assume zero for all flags.
+// ----------------------------------------------------------------------
+
+// Bits in the low memory global GHwrMiscFlags (UInt16)
+
+const
+ hwrMiscFlagHasBacklight = $0001; // set if backlight is present
+ hwrMiscFlagHasMbdIrDA = $0002; // set if IrDA is present (on main board)
+ hwrMiscFlagHasCardIrDA = $0004; // set if IrDA is present (on memory card)
+ hwrMiscFlagHasBurrBrown = $0008; // set if BurrBrown A/D is present
+ hwrMiscFlagHasJerryHW = $0010; // set if Jerry Hardware is present
+ hwrMiscFlagNoRTCBug = $0020; // set if using rev of DragonBall (3G or later)
+ // that doesn't require the RealTimeClock
+ // bug work-around (see TimeMgr68328.c).
+ // <chg 3-27-98 RM>
+ hwrMiscFlagHas3vRef = $0040; // set if switchable 3v reference is present
+ hwrMiscFlagHasAntennaSw = $0080; // set if viewer has an antenna raised switch
+ hwrMiscFlagHasCradleDetect = $0100; // set if we have an A/D converter on hotsync port used for ID'ing the attached device
+ hwrMiscFlagHasSWContrast = $0200; // set if UI should support software contrast
+ hwrMiscFlagInvertLCDForBL = $0400; // set if we need to invert LCD w/Backlight
+ hwrMiscFlagHasMiscFlagExt = $0800; // set if we have new hwrMiscFlagsExt
+
+ // The following bit flags are set by HwrIdentifyFeatures.
+ // They allow software to read the hardware ID without poking at hardware.
+ // They also provide some isolation from different ID detection schemes
+ // such as if the ID detection mechanism should change with EZ...
+
+ hwrMiscFlagID1 = $1000; // set if ID bit keyBitHard1 was set
+ hwrMiscFlagID2 = $2000; // set if ID bit keyBitHard2 was set
+ hwrMiscFlagID3 = $4000; // set if ID bit keyBitHard3 was set
+ hwrMiscFlagID4 = $8000; // set if ID bit keyBitHard4 was set
+ hwrMiscFlagIDMask = $F000;
+ hwrMiscFlagIDOffset = 12; // Bits to shift to get a numeric ID
+
+// NOTE: Currently, the '328 IDs don't overlap with the 'EZ IDs. This is NOT a requirement,
+// but is convenient for the time being as it makes it one step easier to identify a device.
+// If the spaces are forced to overlap, it will be necessary to first check the processor
+// type (328 or EZ) and then parse the product ID code. Fortunately, this scheme is rapidly
+// becoming obsolete since it was based on reading the keyboard I/O pins, and new products
+// are starting to move their keyboard I/O bits to new places. With the introduction of
+// different HAL modules, identifying the actual hardware is now something the HAL code
+// will do when the device boots. The HAL need only do whatever it needs to do to uniquely
+// tell the difference between those devices on which it is capable of operating. Once
+// the hardware is identified, the appropriate hwrMiscFlag and hwrMiscFlagExt bits can be
+// set to tell the OS what features are present, and the appropriate hardware ID information
+// can also be set so higher level software can uniquely identify the OEM/Device/HAL info.
+//
+// Changes
+// 3/16/99 SCL: Documented '328 and 'EZ IDs and how the space could overlap if necessary
+// 3/31/99 SRJ: hwrMiscFlagIDUndetermined created, used specifically during the boot sequence
+// before we have done HwrIdentifyFeatures().
+// 10/29/99 SCL: Renamed hwrMiscFlagIDOther to hwrMiscFlagIDCheckROMToken
+// 10/29/99 SCL: Assigned hwrMiscFlagIDUnused1 to hwrMiscFlagIDUndetermined for Palm OS 3.5
+// 10/29/99 SCL: Assigned hwrMiscFlagIDUnused2 to hwrMiscFlagIDCheckOEMFtrs for Palm OS 3.5
+// 11/ 2/99 SCL: Assigned hwrMiscFlagIDUnused3 to hwrMiscFlagIDCobra2 for Palm OS 3.5
+
+// hwrMiscFlagIDCheckROMToken indicates that the actual device ID information
+// should be read from hwrROMTokenHardwareID using SysGetROMToken or HwrGetROMToken.
+// Attached to this token is the OEM ID and the OEM-specific Product ID.
+// This scheme was used in Palm OS releases prior to 3.5. See <HwrROMToken.h> for details.
+// This ID is also reported when booting on PalmPilot devices (aka 2.0 hardware).
+
+ hwrMiscFlagIDCheckROMToken = 0; // used to be hwrMiscFlagIDOther
+ hwrMiscFlagIDPalmPilot = 0; // since it was never explicitly set
+
+// hwrMiscFlagIDUndetermined is what the OS initializes the ID to when booting.
+// The HAL is responsible for setting the ID to something valid (and meaningful).
+
+ hwrMiscFlagIDUndetermined = hwrMiscFlagID1; // used to be hwrMiscFlagIDUnused1
+
+// hwrMiscFlagIDCheckOEMFtrs indicates that the OEM/Device/HAL identification
+// information should be read from the new Palm OS 3.5 System Features
+// (sysFtrNumOEMCompanyID, sysFtrNumOEMDeviceID, and sysFtrNumOEMHALID)
+// or system globals (hwrOEMCompanyID, hwrOEMDeviceID, and hwrOEMHALID).
+// This method of hardware device ID is for HAL-based devices starting with Palm OS
+// 3.5, but some devices may continue to report valid old-style hwrMiscFlagIDxxx tags.
+
+ hwrMiscFlagIDCheckOEMFtrs = hwrMiscFlagID2; // used to be hwrMiscFlagIDUnused2
+
+// Old-style Hardware IDs for DragonBall '328 based products
+
+ hwrMiscFlagIDThumper = hwrMiscFlagID4 or hwrMiscFlagID2;
+ hwrMiscFlagIDJerry = hwrMiscFlagID4 or hwrMiscFlagID3;
+ hwrMiscFlagIDRocky = hwrMiscFlagID4 or hwrMiscFlagID3 or hwrMiscFlagID2;
+ hwrMiscFlagIDTouchdown = hwrMiscFlagID4 or hwrMiscFlagID3 or hwrMiscFlagID2 or hwrMiscFlagID1;
+
+// Old-style Hardware IDs for DragonBall 'EZ based products
+
+ hwrMiscFlagIDJerryEZ = hwrMiscFlagID3 or hwrMiscFlagID2;
+ hwrMiscFlagIDSumo = hwrMiscFlagID4 or hwrMiscFlagID2 or hwrMiscFlagID1;
+ hwrMiscFlagIDBrad = hwrMiscFlagID4 or hwrMiscFlagID3 or hwrMiscFlagID1;
+ hwrMiscFlagIDAustin = hwrMiscFlagID4 or hwrMiscFlagID1;
+ hwrMiscFlagIDCobra2 = hwrMiscFlagID2 or hwrMiscFlagID1;
+ hwrMiscFlagIDCalvin = hwrMiscFlagID3 or hwrMiscFlagID1;
+
+// Hardware SubIDs used to detect hardware type early in boot process
+
+ hwrMiscFlagExtSubIDBrad = $0;
+ hwrMiscFlagExtSubIDSumo = $2;
+ hwrMiscFlagExtSubIDCobra = $4;
+ hwrMiscFlagExtSubIDCobra2_16 = $6;
+ hwrMiscFlagExtSubIDCobra2_20 = $7;
+
+// Old-style Hardware IDs still unused
+
+ hwrMiscFlagIDUnused4 = hwrMiscFlagID3;
+ hwrMiscFlagIDUnused5 = hwrMiscFlagID3 or hwrMiscFlagID1;
+ hwrMiscFlagIDUnused7 = hwrMiscFlagID3 or hwrMiscFlagID2 or hwrMiscFlagID1;
+ hwrMiscFlagIDUnused8 = hwrMiscFlagID4;
+
+// Bits in the low memory global GHwrMiscFlagsExt (UInt32)
+
+ hwrMiscFlagExtSubID1 = $00000001; // subtype ID (for feature select in device)
+ hwrMiscFlagExtSubID2 = $00000002; // subtype ID (for feature select in device)
+ hwrMiscFlagExtSubID3 = $00000004; // subtype ID (for feature select in device)
+ hwrMiscFlagExtSubIDMask = $00000007; // sybtype ID Mask
+
+ hwrMiscFlagExtHasLiIon = $00000010; // set if we have Lithium Ion battery rechargable in the cradle
+ hwrMiscFlagExtHasRailIO = $00000020; // set if we have Rail I/O hardware
+ hwrMiscFlagExtHasFlash = $00000040; // set (by OS or HAL) if we have Flash ROM
+ hwrMiscFlagExtHasFParms = $00000080; // set (by OS or HAL) if we have Flash parms area
+
+ hwrMiscFlagExt115KIrOK = $00000100; // device supports 115K IR transfers
+ hwrMiscFlagExtHasExtLCD = $00000200; // device has syscall LCD controller
+ hwrMiscFlagExtHasSWBright = $00000400; // device has software controlled brightness
+ // Added by BGT, 08/01/2000
+ hwrMiscFlagExtNeedsLpr = $00000800; // DRAM needs special LP Refresh
+
+// Assigned values for hwrOEMCompanyID (aka sysFtrNumOEMCompanyID):
+// Values are assigned by the Palm Computing Platform Engineering group.
+//
+// Note: These values are different from the values that may be found in some
+// OEM devices which used HwrROMTokens on versions of Palm OS prior to 3.5.
+
+ hwrOEMCompanyIDUnspecified = $00000000; // hwrOEMCompanyID not specified by HAL
+ hwrOEMHALIDUnspecified = $00000000; // hwrOEMHALID not specified by HAL
+ hwrOEMDeviceIDUnspecified = $00000000; // hwrOEMDeviceID not specified by HAL
+
+ hwrOEMCompanyIDPalmPlatform = Rsc('psys'); // Reference Platforms made by Palm Computing
+ hwrOEMCompanyIDPalmDevices = Rsc('palm'); // Devices made by Palm Computing
+
+ hwrOEMCompanyIDSymbol = Rsc('smbl'); // Devices made by Symbol Technologies
+ hwrOEMCompanyIDQualcomm = Rsc('qcom'); // Devices made by Qualcomm
+ hwrOEMCompanyIDTRG = Rsc('trgp'); // Devices made by TRG Products
+ hwrOEMCompanyIDHandspring = Rsc('hspr'); // Devices made by Handspring
+
+// Hardware ID's for DragonBall EZ based products
+
+// hwrMiscFlagIDSumo = hwrMiscFlagID4 or hwrMiscFlagID2 or hwrMiscFlagID1;
+// hwrMiscFlagIDBrad = hwrMiscFlagID4 or hwrMiscFlagID3 or hwrMiscFlagID1;
+
+// Note that values for hwrOEMDeviceID (aka sysFtrNumOEMDeviceID) and
+// hwrOEMHALID (aka sysFtrNumOEMHALID) are OEM vendor-specific, and not
+// necessarily tracked by this Palm OS header file, though it may be
+// worthwhile to include "known" values here for third party developers.
+//
+// It is recommended that OEM vendors choose values for these globals that
+// are four-digit human-readable ASCII values, rather than numeric codes,
+// though this is not a requirement.
+
+// HALs that belong to hwrOEMCompanyIDPalmPlatform
+
+ hwrOEMHALIDEZRef = Rsc('eref'); // (Mono) EZ Reference Platform (Palm Computing)
+ hwrOEMHALIDEZRefColor = Rsc('cref'); // Color EZ Reference Platform (Palm Computing)
+
+// HALs that belong to hwrOEMCompanyIDPalmPlatform
+ hwrOEMHALIDVZRef = Rsc('vref'); // (Mono) VZ Reference Platform (Palm Computing)
+ hwrOEMHALIDVZRefColor = Rsc('cvrf'); // Color VZ Reference Platform (Palm Computing)
+
+// HALs that belong to hwrOEMCompanyIDPalmDevices
+
+ hwrOEMHALID328Jerry = Rsc('jery'); // Palm VII HAL (Palm Computing)
+ hwrOEMHALIDEZSumo = Rsc('sumo'); // Palm IIIx/V/Vx HAL (Palm Computing)
+ hwrOEMHALID328Rocky = Rsc('rcky'); // Pilot, PalmPilot, Palm III HAL (Palm Computing)
+ hwrOEMHALIDEZAustin = Rsc('astn'); // Palm IIIc (Palm Computing)
+ hwrOEMHALIDEZCalvin = Rsc('cvln'); // Palm m100 (Palm Computing)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/imcutils.pp b/packages/palmunits/src/imcutils.pp
new file mode 100644
index 0000000000..1ad15468e5
--- /dev/null
+++ b/packages/palmunits/src/imcutils.pp
@@ -0,0 +1,73 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: IMCUtils.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Routines to handle Internet Mail Consortium specs
+ *
+ * History:
+ * 8/6/97 roger - Created
+ *
+ **************************************************************************)
+
+unit imcutils;
+
+interface
+
+uses palmos, coretraps;
+
+const
+ EOF = $ffff;
+
+// Constants for some common IMC spec values.
+ parameterDelimeterChr = ';';
+ valueDelimeterChr = ':';
+ groupDelimeterChr = '.';
+ paramaterNameDelimiterChr = '=';
+ endOfLineChr = $0D;
+ imcLineSeparatorString = '\015\012';
+ imcFilenameLength = 32;
+ imcUnlimitedChars = $FFFE; // 64K, minus 1 character for null
+
+// These are for functions called to handle input and output. These are currently used
+// to allow disk based or obx based transfers
+
+type
+ GetCharF = function(const p: Pointer): UInt16;
+ PutStringF = procedure(p: Pointer; const stringP: PChar);
+
+// maxChars does NOT include trailing null, buffer may be 1 larger.
+// use imcUnlimitedChars if you don't want a max.
+function ImcReadFieldNoSemicolon(inputStream: Pointer; inputFunc: GetCharF; var c: UInt16;
+ const maxChars: UInt16): PChar; syscall sysTrapImcReadFieldNoSemicolon;
+
+// maxChars does NOT include trailing null, buffer may be 1 larger.
+// use imcUnlimitedChars if you don't want a max.
+function ImcReadFieldQuotablePrintable(inputStream: Pointer; inputFunc: GetCharF; var c: UInt16;
+ const stopAt: Char; const quotedPrintable: Boolean; const maxChars: UInt16): PChar; syscall sysTrapImcReadFieldQuotablePrintable;
+
+procedure ImcReadPropertyParameter(inputStream: Pointer; inputFunc: GetCharF; var cP: UInt16;
+ nameP, valueP: PChar); syscall sysTrapImcReadPropertyParameter;
+
+procedure ImcSkipAllPropertyParameters(inputStream: Pointer; inputFunc: GetCharF; var cP: UInt16;
+ identifierP: PChar; var quotedPrintableP: Boolean); syscall sysTrapImcSkipAllPropertyParameters;
+
+procedure ImcReadWhiteSpace(inputStream: Pointer; inputFunc: GetCharF; var c, charAttrP: UInt16); syscall sysTrapImcReadWhiteSpace;
+
+procedure ImcWriteQuotedPrintable(outputStream: Pointer; outputFunc: PutStringF;
+ const stringP: PChar; const noSemicolons: Boolean); syscall sysTrapImcWriteQuotedPrintable;
+
+procedure ImcWriteNoSemicolon(outputStream: Pointer; outputFunc: PutStringF; const stringP: PChar); syscall sysTrapImcWriteNoSemicolon;
+
+function ImcStringIsAscii(const stringP: PChar): Boolean; syscall sysTrapImcStringIsAscii;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/inetmgr.pp b/packages/palmunits/src/inetmgr.pp
new file mode 100644
index 0000000000..3a5f7f69d1
--- /dev/null
+++ b/packages/palmunits/src/inetmgr.pp
@@ -0,0 +1,964 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: INetMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This header file contains equates for the Internet Library.
+ *
+ * History:
+ * 6/2/97 Created by Ron Marianetti
+ * 12/23/99 Fix <> vs. "" problem. (jmp)
+ *
+ *****************************************************************************)
+
+unit inetmgr;
+
+interface
+
+uses palmos, libtraps, errorbase, datamgr, systemresources, event_;
+
+// Creator. Used for both the database that contains the INet Library and
+// it's features for the feature manager.
+const
+ inetCreator = sysFileCINetLib; // The Net Library creator
+
+// INet Library features have this creator
+ inetLibFtrCreator = sysFileCINetLib; // creatorID of INet Lib features.
+
+// Name of the InetLib
+ inetLibName = 'INet.lib'; // pass in to SysLibFind()
+
+// Feature inetCreator, #0 is index of the the version number feature.
+// The Feature creator is inetLibFtrCreator.
+// Encoding is: 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
+
+ inetFtrNumVersion = 0;
+
+ // INetLib owns the Ctp device bits feature.
+ // Those bits contains device specific info bits that are sent to the Elaine server.
+ // See Ctp.h for the bit descriptions
+ inetFtrNumCtpDeviceBits1 = 1;
+
+ inetLibType = sysFileTLibrary; // Our Net Code Resources Database type
+
+// ID for proxy IP address in flash
+ inetFlashProxyID = 'IP';
+ inetDefaultFlashProxyID = 'DP';
+
+//Also uses mobitexNetworkIdUS and mobitexNetworkIdCanada (0xb433 and 0xc4d7) to store
+//current proxies for US and Canada. The responsibility for writing these and keeping
+//them in sync lies with the Wireless panel, not with netlib.
+
+//-----------------------------------------------------------------------------
+// IP addresses of Elaine servers - used for default wireless proxies
+//-----------------------------------------------------------------------------
+
+ netProxyIPManhattanHGA = $0A0186A5; // Manhattan HGA = 10.1.134.165 or MAN 100005
+ netProxyIPDefaultHGA = netProxyIPManhattanHGA;
+ netProxyIPDefaultHGAStr = '10.1.134.165'; // Should correspond to above value
+
+(********************************************************************
+ * Error codes
+ ********************************************************************)
+
+ inetErrNone = 0;
+ inetErrTooManyClients = inetErrorClass or 1; // Too many clients already
+ inetErrHandleInvalid = inetErrorClass or 2; // Invalid inetH or sockH
+ inetErrParamsInvalid = inetErrorClass or 3;
+ inetErrURLVersionInvalid = inetErrorClass or 4;
+ inetErrURLBufTooSmall = inetErrorClass or 5;
+ inetErrURLInvalid = inetErrorClass or 6;
+ inetErrTooManySockets = inetErrorClass or 7;
+ inetErrNoRequestCreated = inetErrorClass or 8;
+ inetErrNotConnected = inetErrorClass or 9;
+ inetErrInvalidRequest = inetErrorClass or 10;
+ inetErrNeedTime = inetErrorClass or 11;
+ inetErrHostnameInvalid = inetErrorClass or 12;
+ inetErrInvalidPort = inetErrorClass or 13;
+ inetErrInvalidHostAddr = inetErrorClass or 14;
+ inetErrNilBuffer = inetErrorClass or 15;
+ inetErrConnectTimeout = inetErrorClass or 16;
+ inetErrResolveTimeout = inetErrorClass or 17;
+ inetErrSendReqTimeout = inetErrorClass or 18;
+ inetErrReadTimeout = inetErrorClass or 19;
+ inetErrBufTooSmall = inetErrorClass or 20;
+ inetErrSchemeNotSupported = inetErrorClass or 21;
+ inetErrInvalidResponse = inetErrorClass or 22;
+ inetErrSettingTooLarge = inetErrorClass or 25;
+ inetErrSettingSizeInvalid = inetErrorClass or 26;
+ inetErrRequestTooLong = inetErrorClass or 27;
+ inetErrSettingNotImplemented = inetErrorClass or 28;
+
+// Configuration errors
+ inetErrConfigNotFound = inetErrorClass or 29;
+ inetErrConfigCantDelete = inetErrorClass or 30;
+ inetErrConfigTooMany = inetErrorClass or 31;
+ inetErrConfigBadName = inetErrorClass or 32;
+ inetErrConfigNotAlias = inetErrorClass or 33;
+ inetErrConfigCantPointToAlias = inetErrorClass or 34;
+ inetErrConfigEmpty = inetErrorClass or 35;
+ inetErrConfigAliasErr = inetErrorClass or 37;
+
+ inetErrNoWirelessInterface = inetErrorClass or 38;
+
+// Encryption related errors
+ inetErrEncryptionNotAvail = inetErrorClass or 39;
+ // Need to re-send transaction because server told us to reset our
+ // encryption sequence number
+ inetErrNeedRetryEncSeqNum = inetErrorClass or 40;
+ // Need to re-send transaction because server sent us a new
+ // public key to use.
+ inetErrNeedRetryEncPublicKey = inetErrorClass or 41;
+
+ inetErrResponseTooShort = inetErrorClass or 42;
+
+// errors specific to handling Mobitex ILLEGAL responses
+ inetErrMobitexIllegalOKHost = inetErrorClass or 43;
+ inetErrMobitexIllegalBadHost = inetErrorClass or 44;
+// see error 92 also
+
+// HTTP errors
+ inetErrHTTPBadRequest = inetErrorClass or 45;
+ inetErrHTTPUnauthorized = inetErrorClass or 46;
+ inetErrHTTPForbidden = inetErrorClass or 47;
+ inetErrHTTPNotFound = inetErrorClass or 48;
+ inetErrHTTPMethodNotAllowed = inetErrorClass or 49;
+ inetErrHTTPNotAcceptable = inetErrorClass or 50;
+ inetErrHTTPProxyAuthRequired = inetErrorClass or 51;
+ inetErrHTTPRequestTimeout = inetErrorClass or 52;
+ inetErrHTTPConflict = inetErrorClass or 53;
+ inetErrHTTPGone = inetErrorClass or 54;
+ inetErrHTTPLengthRequired = inetErrorClass or 55;
+ inetErrHTTPPreconditionFailed = inetErrorClass or 56;
+ inetErrHTTPRequestTooLarge = inetErrorClass or 57;
+ inetErrHTTPRequestURITooLong = inetErrorClass or 58;
+ inetErrHTTPUnsupportedType = inetErrorClass or 59;
+ inetErrHTTPServerError = inetErrorClass or 60;
+
+// CTP errors
+ inetErrCTPServerError = inetErrorClass or 61;
+
+// Cache errors
+ inetErrTypeNotCached = inetErrorClass or 62;
+ inetErrCacheInvalid = inetErrorClass or 63;
+
+// Palm: and PalmCall: scheme errors
+ inetErrURLDispatched = inetErrorClass or 64;
+ inetErrDatabaseNotFound = inetErrorClass or 65;
+
+ inetErrCTPMalformedRequest = inetErrorClass or 66;
+ inetErrCTPUnknownCommand = inetErrorClass or 67;
+ inetErrCTPTruncated = inetErrorClass or 68;
+ inetErrCTPUnknownError = inetErrorClass or 69;
+ inetErrCTPProxyError = inetErrorClass or 70;
+ inetErrCTPSocketErr = inetErrorClass or 71;
+
+ inetErrCTPInvalidURL = inetErrorClass or 72;
+ inetErrCTPReferringPageOutOfDate = inetErrorClass or 73;
+ inetErrCTPBadRequest = inetErrorClass or 74;
+ inetErrUNUSED = inetErrorClass or 75;
+ inetErrCTPMailServerDown = inetErrorClass or 76;
+ inetErrCTPHostNotFound = inetErrorClass or 77;
+
+// Content Conversion Errors
+ inetErrCTPContentInvalidTag = inetErrorClass or 78;
+ inetErrCTPContentInternal = inetErrorClass or 79;
+ inetErrCTPContentDataEnd = inetErrorClass or 80;
+ inetErrCTPContentResourceTooBig = inetErrorClass or 81;
+ inetErrCTPContentNoNoFrames = inetErrorClass or 82;
+ inetErrCTPContentUnsupportedContent = inetErrorClass or 83;
+ inetErrCTPContentUnsupportedEncoding = inetErrorClass or 84;
+ inetErrCTPContentBadForm = inetErrorClass or 85;
+ inetErrCTPContentBadFormMissingAction = inetErrorClass or 86;
+ inetErrCTPContentBadFormMissingMethod = inetErrorClass or 87;
+ inetErrCTPContentNoSourceData = inetErrorClass or 88;
+ inetErrCTPContentBadImage = inetErrorClass or 89;
+ inetErrCTPContentImageTooLarge = inetErrorClass or 90;
+
+// Mobitex illegal handled error code. This error is sent after
+//INetLib handles inetErrMobitexIllegalOKHost or inetErrMobitexIllegalBadHost
+//errors. The application needs to know that something went wrong and it needs
+//to change state. This error does not need to be displayed to the user.
+ inetErrMobitexErrorHandled = inetErrorClass or 91;
+
+// Proxy down, non-default host, show dialog asking to revert to default
+ inetErrProxyDownBadHost = inetErrorClass or 92;
+
+// A second type of readtime. This should occur only when some data is received
+// and the connection is lost.
+ inetErrHostConnectionLost = inetErrorClass or 93;
+
+// Unable to locate link record within a PQA file
+ inetErrLinkNotFound = inetErrorClass or 94;
+
+ inetErrCacheInvalidSort = inetErrorClass or 95;
+
+// The following are used and bit field parameters to the sort routine. They
+// are additive but ordered. Precendence is given to the lowest ordered bit.
+ inetCacheCompareByMasterURL = $01;
+ inetCacheCompareByURL = $02;
+ inetCacheCompareByTime = $04;
+
+(********************************************************************
+ * Input flags
+ ********************************************************************)
+
+//-----------------------------------------------------------------------------
+// flag word definitions for INetLibURLOpen
+//-----------------------------------------------------------------------------
+
+ inetOpenURLFlagLookInCache = $0001;
+ inetOpenURLFlagKeepInCache = $0002;
+ inetOpenURLFlagForceEncOn = $0008; // use encryption even if
+ // scheme does not desire it
+ inetOpenURLFlagForceEncOff = $0010; // no encryption even if
+ // scheme desires it
+
+//-----------------------------------------------------------------------------
+// flag word definitions for INetURLInfo. These flags bits are set in the
+// flags field of the INetURLINfoType structure by INetLibURLGetInfo()
+//-----------------------------------------------------------------------------
+
+ inetURLInfoFlagIsSecure = $0001;
+ inetURLInfoFlagIsRemote = $0002;
+ inetURLInfoFlagIsInCache = $0004;
+
+(********************************************************************
+ * Configuration Support
+ ********************************************************************)
+
+//-----------------------------------------------------------------------------
+// Names of built-in configuration aliases available through the
+// INetLibConfigXXX calls
+//-----------------------------------------------------------------------------
+
+ inetCfgNameDefault = '.Default'; // The default configuration
+ inetCfgNameDefWireline = '.DefWireline'; // The default wireline configuration
+ inetCfgNameDefWireless = '.DefWireless'; // The default wireless configuration
+ inetCfgNameCTPDefault = '.CTPDefault'; // Points to either .CTPWireline or .CTPWireless
+ inetCfgNameCTPWireline = '.CTPWireline'; // Wireline through the Jerry Proxy
+ inetCfgNameCTPWireless = '.CTPWireless'; // Wireless through the Jerry Proxy
+
+//--------------------------------------------------------------------
+// Structure of a configuration name. Used by INetLibConfigXXX calls
+//---------------------------------------------------------------------
+
+const
+ inetConfigNameSize = 32;
+
+type
+ INetConfigNameType = record
+ name: array [0..inetConfigNameSize-1] of Char; // name of configuration
+ end;
+
+ INetConfigNamePtr = ^INetConfigNameType;
+
+(********************************************************************
+ * Scheme Types
+ ********************************************************************)
+
+type
+ INetSchemeEnum = WordEnum; //!!!
+
+const
+ inetSchemeUnknown = -1;
+ inetSchemeDefault = 0;
+
+ inetSchemeHTTP = Succ(inetSchemeDefault); // http:
+ inetSchemeHTTPS = Succ(inetSchemeHTTP); // https:
+ inetSchemeFTP = Succ(inetSchemeHTTPS); // ftp:
+ inetSchemeGopher = Succ(inetSchemeFTP); // gopher:
+ inetSchemeFile = Succ(inetSchemeGopher); // file:
+ inetSchemeNews = Succ(inetSchemeFile); // news:
+ inetSchemeMailTo = Succ(inetSchemeNews); // mailto:
+ inetSchemePalm = Succ(inetSchemeMailTo); // palm:
+ inetSchemePalmCall = Succ(inetSchemePalm); // palmcall:
+
+ inetSchemeMail = Succ(inetSchemePalmCall); // not applicable to URLS, but used
+ // for the INetLibSockOpen call when
+ // creating a socket for mail IO
+ inetSchemeMac = Succ(inetSchemeMail); // mac: - Mac file system HTML
+
+ inetSchemeFirst = inetSchemeHTTP; // first one
+ inetSchemeLast = inetSchemeMail; // last one
+
+(********************************************************************
+ * Scheme Ports
+ ********************************************************************)
+
+const
+ inetPortFTP = 21;
+ inetPortHTTP = 80;
+ inetPortGopher = 70;
+ inetPortNews = 119;
+ inetPortHTTPS = 44;
+
+(********************************************************************
+ * Structure of a cracked URL.
+ ********************************************************************)
+
+type
+ INetURLType = record
+ version: UInt16; // should be 0, for future compatibility
+
+ schemeP: ^UInt8; // ptr to scheme portion
+ schemeLen: UInt16; // size of scheme portion
+ schemeEnum: UInt16; // INetSchemEnum
+
+ usernameP: ^UInt8; // ptr to username portion
+ usernameLen: UInt16; // size of username
+
+ passwordP: ^UInt8; // ptr to password portion
+ passwordLen: UInt16; // size of password
+
+ hostnameP: ^UInt8; // ptr to host name portion
+ hostnameLen: UInt16; // size of host name
+
+ port: UInt16; // port number
+
+ pathP: ^UInt8; // ptr to path portion
+ pathLen: UInt16; // size of path
+
+ paramP: ^UInt8; // param (;param)
+ paramLen: UInt16; // size of param
+
+ queryP: ^UInt8; // query (?query)
+ queryLen: UInt16; // size of query
+
+ fragP: ^UInt8; // fragment (#frag)
+ fragLen: UInt16; // size of fragment
+ end;
+
+(********************************************************************
+ * Structure for INetURLInfo. This structure is filled in with info
+ * about a URL.
+ ********************************************************************)
+
+type
+ INetURLInfoType = record
+ version: UInt16; // should be 0, for future compatibility
+
+ flags: UInt16; // flags word, one or ore of
+ // inetURLInfoFlagXXX flags
+ undefined: UInt32; // reserved for future use
+ end;
+
+(********************************************************************
+ * Content and Compression Type Enums(from proxy server or PQA Builder)
+ ********************************************************************)
+
+type
+ INetContentTypeEnum = Enum;
+
+const
+ inetContentTypeTextPlain = 0;
+ inetContentTypeTextHTML = Succ(inetContentTypeTextPlain);
+ inetContentTypeImageGIF = Succ(inetContentTypeTextHTML);
+ inetContentTypeImageJPEG = Succ(inetContentTypeImageGIF);
+ inetContentTypeApplicationCML = Succ(inetContentTypeImageJPEG);
+ inetContentTypeImagePalmOS = Succ(inetContentTypeApplicationCML);
+ inetContentTypeOthe = Succ(inetContentTypeImagePalmOS);
+
+type
+ INetCompressionTypeEnum = Enum;
+
+const
+ inetCompressionTypeNone = 0;
+ inetCompressionTypeBitPacked = Succ(inetCompressionTypeNone);
+ inetCompressionTypeLZ77 = Succ(inetCompressionTypeBitPacked);
+ inetCompressionTypeBest = Succ(inetCompressionTypeLZ77);
+ inetCompressionTypeLZ77Primer1 = Succ(inetCompressionTypeBest);
+
+(********************************************************************
+ * Proxy Types
+ ********************************************************************)
+
+type
+ INetProxyEnum = Enum;
+
+const
+ inetProxyNone = 0; // no proxy
+ inetProxyCTP = 1; // CTP (Jerry) proxy
+
+(********************************************************************
+ * Transport Types
+ ********************************************************************)
+type
+ INetTransportEnum = Enum;
+
+const
+ inetTransportPPP = 0; // PPP
+ inetTransportMobitex = 1; // Mobitex
+
+(********************************************************************
+ * Settings for the INetLibSettingSet/Get call.
+ ********************************************************************)
+
+type
+ INetSettingEnum = Enum;
+
+const
+ inetSettingProxyType = 0; // (RW) UInt32, INetProxyEnum
+
+ inetSettingProxyName = Succ(inetSettingProxyType); // (RW) Char[], name of proxy
+ inetSettingProxyPort = Succ(inetSettingProxyName); // (RW) UInt32, TCP port # of proxy
+
+ inetSettingProxySocketType = Succ(inetSettingProxyPort); // (RW) UInt32, which type of socket to use
+ // netSocketTypeXXX
+
+ inetSettingCacheSize = Succ(inetSettingProxySocketType); // (RW) UInt32, max size of cache
+ inetSettingCacheRef = Succ(inetSettingCacheSize); // (R) DmOpenRef, ref of cache DB
+
+ inetSettingNetLibConfig = Succ(inetSettingCacheRef); // (RW) UInt32, Which NetLib config to use.
+
+ inetSettingRadioID = Succ(inetSettingNetLibConfig); // (R) UInt32[2], the 64-bit radio ID
+ inetSettingBaseStationID = Succ(inetSettingRadioID); // (R) UInt32, the radio base station ID
+
+ inetSettingMaxRspSize = Succ(inetSettingBaseStationID); // (W) UInt32 (in bytes)
+ inetSettingConvAlgorithm = Succ(inetSettingMaxRspSize); // (W) UInt32 (CTPConvEnum)
+ inetSettingContentWidth = Succ(inetSettingConvAlgorithm); // (W) UInt32 (in pixels)
+ inetSettingContentVersion = Succ(inetSettingContentWidth); // (W) UInt32 Content version (encoder version)
+
+ inetSettingNoPersonalInfo = Succ(inetSettingContentVersion); // (RW) UInt32 send no deviceID/zipcode
+
+ inetSettingUserName = Succ(inetSettingNoPersonalInfo);
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 4.0
+ //---------------------------------------------------------------------------------
+
+ inetSettingGraphicsSel = Succ(inetSettingUserName); // (W) UInt8 (User Graphics selection)
+
+ inetSettingTransportType = Succ(inetSettingGraphicsSel); // (RW) UInt32, INetTransportEnum
+
+ inetSettingServerBits1 = Succ(inetSettingTransportType); // (RW) UInt32, bits sent by the server over ctp
+ inetSettingSendRawLocationInfo = Succ(inetSettingServerBits1); // (W) Boolean, make the handheld send its Raw Location information.
+ // One use of this feature is to convert Web clipping's "%Location:..." codes into content info
+
+ inetSettingEnableCookies = Succ(inetSettingSendRawLocationInfo); // (RW) Boolean
+ // true: Cookies are enabled
+ // false: Cookies are disabled (default)
+
+ inetSettingMaxCookieJarSize = Succ(inetSettingEnableCookies);
+ // (RW) UInt32, maximum cookie jar size in
+ // in kilobytes
+
+ // The following setting is a new interface in PalmOS 4.0 that allow Clipper
+ // or other INetLib clients to get raw location information as described in
+ // PalmLocRawData.h.
+ // INetLib will return a pointer to a newly allocated memory buffer containing
+ // the raw location information to send to Elaine (Web Clipping proxy server).
+ // Elaine will then use a Windows DLL to analyse the raw location information
+ // in order to transform it into something useful like zipcode, cityname, etc.
+ // See PalmLocRawData.h for more details...
+ inetSettingLocRawInfo = Succ(inetSettingMaxCookieJarSize); // (R) void* Allocated memory buffer - must be free by caller
+
+ // The following affect how the "Web Clipping" panel will edit the
+ // configuration. When "reset to default" is pressed, these default
+ // values will be copied back into the appropriate place.
+ // If the field is set to not be editable, the panel will not allow
+ // the user to change it
+ inetSettingProxyNameDefault = Succ(inetSettingLocRawInfo); // Default Name for this config
+ inetSettingProxyPortDefault = Succ(inetSettingProxyNameDefault); // Default Port for this config
+ inetSettingProxyNameEditable = Succ(inetSettingProxyPortDefault); // Is the proxy name editable?
+ inetSettingProxyPortEditable = Succ(inetSettingProxyNameEditable); // Is the proxy port editable?
+
+ inetSettingPalmUserID = Succ(inetSettingProxyPortEditable); // The palm.net user id
+
+ inetSettingLast = Succ(inetSettingPalmUserID);
+
+(********************************************************************
+ * Settings for the INetLibSockSettingSet/Get call.
+ ********************************************************************)
+
+type
+ INetSockSettingEnum = Enum;
+
+const
+ inetSockSettingScheme = 0; // (R) UInt32, INetSchemeEnum
+ inetSockSettingSockContext = Succ(inetSockSettingScheme); // (RW) UInt32,
+
+ inetSockSettingCompressionType = Succ(inetSockSettingSockContext); // (R) Char[]
+ inetSockSettingCompressionTypeID = Succ(inetSockSettingCompressionType); // (R) UInt32 (INetCompressionTypeEnum)
+ inetSockSettingContentType = Succ(inetSockSettingCompressionTypeID); // (R) Char[]
+ inetSockSettingContentTypeID = Succ(inetSockSettingContentType); // (R) UInt32 (INetContentTypeEnum)
+ inetSockSettingData = Succ(inetSockSettingContentTypeID); // (R) UInt32, pointer to data
+ inetSockSettingDataHandle = Succ(inetSockSettingData); // (R) UInt32, MemHandle to data
+ inetSockSettingDataOffset = Succ(inetSockSettingDataHandle); // (R) UInt32, offset to data from MemHandle
+
+ inetSockSettingTitle = Succ(inetSockSettingDataOffset); // (RW) Char[]
+ inetSockSettingURL = Succ(inetSockSettingTitle); // (R) Char[]
+ inetSockSettingIndexURL = Succ(inetSockSettingURL); // (RW) Char[]
+
+ inetSockSettingFlags = Succ(inetSockSettingIndexURL); // (W) UInt16, one or more of
+ // inetOpenURLFlagXXX flags
+
+ inetSockSettingReadTimeout = Succ(inetSockSettingFlags); // (RW) UInt32. Read timeout in ticks
+
+ inetSockSettingContentVersion = Succ(inetSockSettingReadTimeout); // (R) UInt32, version number for content
+
+ inetSockSettingLast = Succ(inetSockSettingContentVersion);
+
+(********************************************************************
+ * Possible socket status values that can be returned from INetLibSockStatus
+ ********************************************************************)
+
+type
+ INetStatusEnum = Enum;
+
+const
+ inetStatusNew = 0; // just opened
+ inetStatusResolvingName = Succ(inetStatusNew); // looking up host address
+ inetStatusNameResolved = Succ(inetStatusResolvingName); // found host address
+ inetStatusConnecting = Succ(inetStatusNameResolved); // connecting to host
+ inetStatusConnected = Succ(inetStatusConnecting); // connected to host
+ inetStatusSendingRequest = Succ(inetStatusConnected); // sending request
+ inetStatusWaitingForResponse = Succ(inetStatusSendingRequest); // waiting for response
+ inetStatusReceivingResponse = Succ(inetStatusWaitingForResponse); // receiving response
+ inetStatusResponseReceived = Succ(inetStatusReceivingResponse); // response received
+ inetStatusClosingConnection = Succ(inetStatusResponseReceived); // closing connection
+ inetStatusClosed = Succ(inetStatusClosingConnection); // closed
+ inetStatusAcquiringNetwork = Succ(inetStatusClosed); // network temporarily
+ // unreachable; socket on hold
+ inetStatusPrvInvalid = 30; // internal value, not
+ // returned by INetMgr. Should
+ // be last.
+
+(********************************************************************
+ * HTTP Attributes which can be set/get using the
+ * INetLibHTTPAttrSet/Get calls.
+ *
+ * Generally, attributes are only set BEFORE calling
+ * INetLibSockHTTPReqSend
+ * and attributes are only gotten AFTER the complete response
+ * has been received.
+ *
+ * Attributes marked with the following flags:
+ * (R) - read only
+ * (W) - write only
+ * (RW) - read/write
+ * (-) - not implemented yet
+ ********************************************************************)
+
+type
+ INetHTTPAttrEnum = Enum;
+
+const
+ // local error trying to communicate with server, if any
+ inetHTTPAttrCommErr = 0; // (R) UInt32, read-only
+
+ // object attributes, defined at creation
+ inetHTTPAttrEntityURL = Succ(inetHTTPAttrCommErr); // (-) Char[], which resource was requested
+
+ //-----------------------------------------------------------
+ // Request only attributes
+ //-----------------------------------------------------------
+ inetHTTPAttrReqAuthorization = Succ(inetHTTPAttrEntityURL); // (-) Char[]
+ inetHTTPAttrReqFrom = Succ(inetHTTPAttrReqAuthorization); // (-) Char[]
+ inetHTTPAttrReqIfModifiedSince = Succ(inetHTTPAttrReqFrom); // (-) UInt32
+ inetHTTPAttrReqReferer = Succ(inetHTTPAttrReqIfModifiedSince); // (-) Char[]
+
+ // The following are ignored unless going through a CTP proxy
+ inetHTTPAttrWhichPart = Succ(inetHTTPAttrReqReferer); // (W) UInt32 (0 -> N)
+ inetHTTPAttrIncHTTP = Succ(inetHTTPAttrWhichPart); // (W) UInt32 (Boolean) only applicable
+ // when inetHTTPAttrConvAlgorithm set to
+ // ctpConvNone
+ inetHTTPAttrCheckMailHi = Succ(inetHTTPAttrIncHTTP); // (W) UInt32
+ inetHTTPAttrCheckMailLo = Succ(inetHTTPAttrCheckMailHi); // (W) UInt32
+ inetHTTPAttrReqContentVersion = Succ(inetHTTPAttrCheckMailLo); // (W) UInt32 Desired content version. Represented
+ // as 2 low bytes. Lowest byte is minor version,
+ // next higher byte is major version.
+
+ //--------------------------------------------------------------
+ // Response only attributes
+ //--------------------------------------------------------------
+ // Server response info
+ inetHTTPAttrRspAll = Succ(inetHTTPAttrReqContentVersion); // (-) Char[] - entire HTTP response including
+ // data
+ inetHTTPAttrRspSize = Succ(inetHTTPAttrRspAll); // (R) UInt32 - entire HTTP Response size including
+ // header and data
+ inetHTTPAttrRspVersion = Succ(inetHTTPAttrRspSize); // (-) Char[]
+ inetHTTPAttrResult = Succ(inetHTTPAttrRspVersion); // (R) UInt32 (ctpErrXXX when using CTP Proxy)
+ inetHTTPAttrErrDetail = Succ(inetHTTPAttrResult); // (R) UInt32 (server/proxy err code when
+ // using CTP Proxy)
+ inetHTTPAttrReason = Succ(inetHTTPAttrErrDetail); // (R) Char[]
+ inetHTTPAttrDate = Succ(inetHTTPAttrReason); // (-) UInt32
+ inetHTTPAttrNoCache = Succ(inetHTTPAttrDate); // (-) UInt32
+ inetHTTPAttrPragma = Succ(inetHTTPAttrNoCache); // (-) Char[]
+ inetHTTPAttrServer = Succ(inetHTTPAttrPragma); // (-) Char[]
+ inetHTTPAttrWWWAuthentication = Succ(inetHTTPAttrServer); // (-) Char[]
+
+ // Returned entity attributes
+ inetHTTPAttrContentAllow = Succ(inetHTTPAttrWWWAuthentication); // (-) Char[]
+ inetHTTPAttrContentLength = Succ(inetHTTPAttrContentAllow); // (R) UInt32
+ inetHTTPAttrContentLengthUncompressed = Succ(inetHTTPAttrContentLength); // (R) UInt32 (in bytes)
+ inetHTTPAttrContentPtr = Succ(inetHTTPAttrContentLengthUncompressed); // (-) Char *
+ inetHTTPAttrContentExpires = Succ(inetHTTPAttrContentPtr); // (-) UInt32
+ inetHTTPAttrContentLastModified = Succ(inetHTTPAttrContentExpires); // (-) UInt32
+ inetHTTPAttrContentLocation = Succ(inetHTTPAttrContentLastModified); // (-) Char[]
+ inetHTTPAttrContentLengthUntruncated = Succ(inetHTTPAttrContentLocation); // (R) UInt32
+ inetHTTPAttrContentVersion = Succ(inetHTTPAttrContentLengthUntruncated); // (R) UInt32, actual content version. Represented
+ // as 2 low bytes. Lowest byte is minor version,
+ // next higher byte is major version.
+ inetHTTPAttrContentCacheID = Succ(inetHTTPAttrContentVersion); // (R) UInt32, cacheID for this item
+ inetHTTPAttrReqSize = Succ(inetHTTPAttrContentCacheID); // (R) UInt32 size of request sent
+
+(********************************************************************
+ * Structure of our Internet events. This structure is a superset of
+ * the regular event type. Note that we use the first 2 user events
+ * for the Internet Library so any app that uses this library must be
+ * to use user event IDs greater than inetLastEvent.
+ *
+ * library refNum in it....
+ ********************************************************************)
+
+const
+ inetSockReadyEvent = firstINetLibEvent;
+ inetSockStatusChangeEvent = firstINetLibEvent + 1;
+ inetLastEvent = firstINetLibEvent + 1;
+
+type
+ generic = record
+ datum: array [0..7] of UInt16;
+ end;
+
+ inetSockReady = record
+ sockH: MemHandle; // socket MemHandle
+ context: UInt32; // application defined
+ inputReady: Boolean; // true if ready for reads
+ outputReady: Boolean; // true if ready for writes
+ end;
+
+ inetSockStatusChange = record
+ sockH: MemHandle; // socket MemHandle
+ context: UInt32; // application defined
+ status: UInt16; // new status
+ sockErr: Err; // socket err, if any
+ end;
+
+ INetEventType = record
+ eType: UInt16;
+ penDown: Boolean;
+ reserved: UInt8;
+ screenX: Int16;
+ screenY: Int16;
+ case Integer of
+ 0: (generic: generic);
+ 1: (inetSockReady: inetSockReady);
+ 2: (inetSockStatusChange: inetSockStatusChange);
+ end;
+
+(********************************************************************
+ * Commands for INetLibWirelessIndicatorCmd (and INetLibWiCmd)
+ ********************************************************************)
+
+type
+ WiCmdEnum = Enum;
+
+const
+ wiCmdInit = 0;
+ wiCmdClear = Succ(wiCmdInit);
+ wiCmdSetEnabled = Succ(wiCmdClear);
+ wiCmdDraw = Succ(wiCmdSetEnabled);
+ wiCmdEnabled = Succ(wiCmdDraw);
+ wiCmdSetLocation = Succ(wiCmdEnabled);
+ wiCmdEras = Succ(wiCmdSetLocation);
+
+(********************************************************************
+ * INet Library functions.
+ ********************************************************************)
+
+type
+ INetLibTrapNumberEnum = Enum;
+
+const
+ inetLibTrapSettingGet = sysLibTrapCustom;
+ inetLibTrapSettingSet = Succ(inetLibTrapSettingGet);
+
+ inetLibTrapGetEvent = Succ(inetLibTrapSettingSet);
+
+ inetLibTrapURLOpen = Succ(inetLibTrapGetEvent);
+
+ inetLibTrapSockRead = Succ(inetLibTrapURLOpen);
+ inetLibTrapSockWrite = Succ(inetLibTrapSockRead);
+
+ inetLibTrapSockOpen = Succ(inetLibTrapSockWrite);
+ inetLibTrapSockClose = Succ(inetLibTrapSockOpen);
+ inetLibTrapSockStatus = Succ(inetLibTrapSockClose);
+ inetLibTrapSockSettingGet = Succ(inetLibTrapSockStatus);
+ inetLibTrapSockSettingSet = Succ(inetLibTrapSockSettingGet);
+ inetLibTrapSockConnect = Succ(inetLibTrapSockSettingSet);
+
+ // Utilities
+ inetLibTrapURLCrack = Succ(inetLibTrapSockConnect);
+ inetLibTrapURLsAdd = Succ(inetLibTrapURLCrack);
+ inetLibTrapURLsCompare = Succ(inetLibTrapURLsAdd);
+ inetLibTrapURLGetInfo = Succ(inetLibTrapURLsCompare);
+
+ // HTTP calls
+ inetLibTrapSockHTTPReqCreate = Succ(inetLibTrapURLGetInfo);
+ inetLibTrapSockHTTPAttrSet = Succ(inetLibTrapSockHTTPReqCreate);
+ inetLibTrapSockHTTPReqSend = Succ(inetLibTrapSockHTTPAttrSet);
+ inetLibTrapSockHTTPAttrGet = Succ(inetLibTrapSockHTTPReqSend);
+
+ // Mail traps
+ inetLibTrapSockMailReqCreate = Succ(inetLibTrapSockHTTPAttrGet);
+ inetLibTrapSockMailAttrSet = Succ(inetLibTrapSockMailReqCreate);
+ inetLibTrapSockMailReqAdd = Succ(inetLibTrapSockMailAttrSet);
+ inetLibTrapSockMailReqSend = Succ(inetLibTrapSockMailReqAdd);
+ inetLibTrapSockMailAttrGet = Succ(inetLibTrapSockMailReqSend);
+ inetLibTrapSockMailQueryProgress = Succ(inetLibTrapSockMailAttrGet);
+
+ // Cache calls
+ inetLibTrapCacheList = Succ(inetLibTrapSockMailQueryProgress);
+ inetLibTrapCacheGetObject = Succ(inetLibTrapCacheList);
+
+ // Config calls
+ inetLibConfigMakeActive_ = Succ(inetLibTrapCacheGetObject);
+ inetLibConfigList_ = Succ(inetLibConfigMakeActive_);
+ inetLibConfigIndexFromName_ = Succ(inetLibConfigList_);
+ inetLibConfigDelete_ = Succ(inetLibConfigIndexFromName_);
+ inetLibConfigSaveAs_ = Succ(inetLibConfigDelete_);
+ inetLibConfigRename_ = Succ(inetLibConfigSaveAs_);
+ inetLibConfigAliasSet_ = Succ(inetLibConfigRename_);
+ inetLibConfigAliasGet_ = Succ(inetLibConfigAliasSet_);
+
+ //old wireless Indicator
+ inetLibTrapWiCmd = Succ(inetLibConfigAliasGet_);
+
+ // File Calls
+ inetLibTrapSockFileGetByIndex = Succ(inetLibTrapWiCmd);
+
+ inetLibTrapCheckAntennaState = Succ(inetLibTrapSockFileGetByIndex);
+
+ inetLibTrapCTPSend = Succ(inetLibTrapCheckAntennaState);
+
+// Additional Cache calls
+ inetLibTrapCachePurge = Succ(inetLibTrapCTPSend);
+
+// new wireless Indicator
+ inetLibTrapWirelessIndicatorCmd = Succ(inetLibTrapCachePurge);
+
+// Additional Cache calls
+ inetLibTrapCacheGetObjectV2 = Succ(inetLibTrapWirelessIndicatorCmd);
+ inetLibTrapIndexedCacheFind = Succ(inetLibTrapCacheGetObjectV2);
+ inetLibTrapPrepareCacheForHistory = Succ(inetLibTrapIndexedCacheFind);
+
+//This should be at the END ***********
+
+ inetLibTrapLast = Succ(inetLibTrapPrepareCacheForHistory);
+
+(********************************************************************
+ * Structure of cache entry
+ * Used as a parameter to INetLibCacheList. If urlP or titleP are NULL,
+ * the corresponding length fields will be updated with the desired lengths
+ ********************************************************************)
+
+type
+ INetCacheEntryType = record
+ urlP: ^UInt8;
+ urlLen: UInt16;
+
+ titleP: ^UInt8;
+ titleLen: UInt16;
+
+ lastViewed: UInt32; // seconds since 1/1/1904
+ firstViewed: UInt32; // seconds since 1/1/1904
+ end;
+
+ INetCacheEntryP = ^INetCacheEntryType;
+
+(********************************************************************
+ * Structure for INetLibCacheGetObject. This structure is filled in with info
+ * about a cache entry.
+ ********************************************************************)
+
+type
+ INetCacheInfoType = record
+ recordH: MemHandle;
+ contentType: INetContentTypeEnum;
+ encodingType: INetCompressionTypeEnum;
+ uncompressedDataSize: UInt32;
+ flags: UInt8;
+ reserved: UInt8;
+ dataOffset: UInt16; // offset to content
+ dataLength: UInt16; // size of content
+ urlOffset: UInt16; // offset to URL
+ viewTime: UInt32; // time last viewed
+ createTime: UInt32; // time entry was created
+ murlOffset: UInt16; // offset to master URL
+ serverBits1: UInt32; // Bits sent by the server
+ end;
+
+ INetCacheInfoPtr = ^INetCacheInfoType;
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+function INetLibOpen(libRefnum: UInt16; config: UInt16; flags: UInt32;
+ cacheRef: DmOpenRef; cacheSize: UInt32; var inetHP: MemHandle): Err; syscall sysLibTrapOpen;
+
+function INetLibClose(libRefnum: UInt16; inetH: MemHandle): Err; syscall sysLibTrapClose;
+
+function INetLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
+
+function INetLibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
+
+//--------------------------------------------------
+// Settings
+//--------------------------------------------------
+function INetLibSettingGet(libRefnum: UInt16; inetH: MemHandle; setting: UInt16 {INetSettingEnum};
+ bufP: Pointer; var bufLenP: UInt16): Err; syscall inetLibTrapSettingGet;
+
+function INetLibSettingSet(libRefnum: UInt16; inetH: MemHandle; setting: UInt16 {INetSettingEnum};
+ bufP: Pointer; bufLen: UInt16): Err; syscall inetLibTrapSettingSet;
+
+//--------------------------------------------------
+// Event Management
+//--------------------------------------------------
+
+procedure INetLibGetEvent(libRefnum: UInt16; inetH: MemHandle; var eventP: INetEventType; timeout: Int32); syscall inetLibTrapGetEvent;
+
+//--------------------------------------------------
+// High level calls
+//--------------------------------------------------
+
+function INetLibURLOpen(libRefnum: UInt16; inetH: MemHandle; var urlP, cacheIndexURLP: UInt8;
+ var sockHP: MemHandle; timeout: Int32; flags: UInt16): Err; syscall inetLibTrapURLOpen;
+
+
+function INetLibCTPSend(libRefnum: UInt16; inetH: MemHandle; var sockHP: MemHandle;
+ var writeP: UInt8; writelen: UInt32; timeout: Int32; ctpCommand: UInt16): Err; syscall inetLibTrapCTPSend;
+
+
+function INetLibSockClose(libRefnum: UInt16; socketH: MemHandle): Err; syscall inetLibTrapSockClose;
+
+//--------------------------------------------------
+// Read/Write
+//--------------------------------------------------
+
+function INetLibSockRead(libRefnum: UInt16; sockH: MemHandle; bufP: Pointer;
+ reqBytes: UInt32; var actBytesP: UInt32; timeout: Int32): Err; syscall inetLibTrapSockRead;
+
+function INetLibSockWrite(libRefnum: UInt16; sockH: MemHandle; bufP: Pointer;
+ reqBytes: UInt32; var actBytesP: UInt32; timeout: Int32): Err; syscall inetLibTrapSockWrite;
+
+//--------------------------------------------------
+// Low level Socket calls
+//--------------------------------------------------
+
+function INetLibSockOpen(libRefnum: UInt16; inetH: MemHandle;
+ scheme: UInt16 {INetSchemEnum}; var sockHP: MemHandle): Err; syscall inetLibTrapSockOpen;
+
+function INetLibSockStatus(libRefnum: UInt16; socketH: MemHandle; var statusP: UInt16;
+ var sockErrP: Err; var inputReadyP, outputReadyP: Boolean): Err; syscall inetLibTrapSockStatus;
+
+
+function INetLibSockSettingGet(libRefnum: UInt16; socketH: MemHandle; setting: UInt16 {INetSockSettingEnum};
+ bufP: Pointer; var bufLenP: UInt16): Err; syscall inetLibTrapSockSettingGet;
+
+function INetLibSockSettingSet(libRefnum: UInt16; socketH: MemHandle; setting: UInt16 {INetSockSettingEnum};
+ bufP: Pointer; bufLen: UInt16): Err; syscall inetLibTrapSockSettingSet;
+
+
+function INetLibSockConnect(libRefnum: UInt16; sockH: MemHandle; var hostnameP: UInt8;
+ port: UInt16; timeou: Int32): Err; syscall inetLibTrapSockConnect;
+
+//--------------------------------------------------
+// HTTP specific calls
+//--------------------------------------------------
+
+function INetLibSockHTTPReqCreate(libRefnum: UInt16; sockH: MemHandle; var verbP, resNameP, refererP: UInt8): Err; syscall inetLibTrapSockHTTPReqCreate;
+
+function INetLibSockHTTPAttrSet(libRefnum: UInt16; sockH: MemHandle; attr: UInt16 {inetHTTPAttrEnum};
+ attrIndex: UInt16; var bufP: UInt8; bufLen, flags: UInt16): Err; syscall inetLibTrapSockHTTPAttrSet;
+
+function INetLibSockHTTPReqSend(libRefnum: UInt16; sockH: MemHandle; writeP: Pointer;
+ writeLen: UInt32; timeout: Int32): Err; syscall inetLibTrapSockHTTPReqSend;
+
+function INetLibSockHTTPAttrGet(libRefnum: UInt16; sockH: MemHandle; attr: UInt16 {inetHTTPAttrEnum};
+ attrIndex: UInt16; bufP: Pointer; var bufLenP: UInt32): Err; syscall inetLibTrapSockHTTPAttrGet;
+
+//--------------------------------------------------
+// Utilities
+//--------------------------------------------------
+
+function INetLibURLCrack(libRefnum: UInt16; var urlTextP: UInt8; var urlP: INetURLType): Err; syscall inetLibTrapURLCrack;
+
+function INetLibURLsAdd(libRefnum: UInt16; baseURLStr, embeddedURLStr, resultURLStr: PChar; var resultLenP: UInt16): Err; syscall inetLibTrapURLsAdd;
+
+function INetLibURLsCompare(libRefnum: UInt16; URLStr1, URLStr2: PChar): Int16; syscall inetLibTrapURLsCompare;
+
+function INetLibURLGetInfo(libRefnum: UInt16; inetH: MemHandle; var urlTextP: UInt8; var urlInfoP: INetURLInfoType): Err; syscall inetLibTrapURLGetInfo;
+
+type
+ int = SmallInt;
+
+function INetLibWiCmd(refNum: UInt16; cmd: UInt16 {WiCmdEnum}; enableOrX, y: int): Boolean; syscall inetLibTrapWiCmd;
+
+function INetLibWirelessIndicatorCmd(refNum: UInt16; inetH: MemHandle; {WiCmdEnum} cmd: UInt16; enableOrX, y: int): Boolean; syscall inetLibTrapWirelessIndicatorCmd;
+
+function INetLibCheckAntennaState(refNum: UInt16): Err; syscall inetLibTrapCheckAntennaState;
+
+//--------------------------------------------------
+// Cache interface
+//--------------------------------------------------
+
+function INetLibCacheList(libRefnum: UInt16; inetH: MemHandle; var cacheIndexURLP: UInt8;
+ var indexP: UInt16; var uidP: UInt32; cacheP: INetCacheEntryP): Err; syscall inetLibTrapCacheList;
+
+function INetLibCacheGetObject(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8;
+ uniqueID: UInt32; cacheInfoP: INetCacheInfoPtr): Err; syscall inetLibTrapCacheGetObject;
+
+function INetLibCachePurge(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8; uniqueID: UInt32): Err; syscall inetLibTrapCachePurge;
+
+function INetLibCacheGetObjectV2(libRefnum: UInt16; clientParamH: MemHandle; var urlTextP: UInt8; uniqueID: UInt32;
+ rcIndex: UInt16; cacheInfoP: INetCacheInfoPtr; cacheEntryP: INetCacheEntryP): Err; syscall inetLibTrapCacheGetObjectV2;
+
+function INetLibIndexedCacheFind(libRefnum: UInt16; cacheDBRef: DmOpenRef; var dataP: UInt8; lookFor: Int16; var indexP: UInt16;
+ order: Int16; var cacheIdP: UInt32): Err; syscall inetLibTrapIndexedCacheFind;
+
+function INetLibPrepareCacheForHistory(libRefnum: UInt16; clientParamH: MemHandle): Err; syscall inetLibTrapPrepareCacheForHistory;
+
+//--------------------------------------------------
+// Configuration Calls
+//--------------------------------------------------
+
+function INetLibConfigMakeActive(refNum: UInt16; inetH: MemHandle; configIndex: UInt16): Err; syscall inetLibConfigMakeActive_;
+
+function INetLibConfigList(refNum: UInt16; var nameArray{[]}: INetConfigNameType; var arrayEntriesP: UInt16): Err; syscall inetLibConfigList_;
+
+function INetLibConfigIndexFromName(refNum: UInt16; nameP: INetConfigNamePtr; var indexP: UInt16): Err; syscall inetLibConfigIndexFromName_;
+
+function INetLibConfigDelete(refNum: UInt16; index: UInt16): Err; syscall inetLibConfigDelete_;
+
+function INetLibConfigSaveAs(refNum: UInt16; inetH: MemHandle; nameP: INetConfigNamePtr): Err; syscall inetLibConfigSaveAs_;
+
+function INetLibConfigRename(refNum: UInt16; index: UInt16; newNameP: INetConfigNamePtr): Err; syscall inetLibConfigRename_;
+
+function INetLibConfigAliasSet(refNum: UInt16; configIndex, aliasToIndex: UInt16): Err; syscall inetLibConfigAliasSet_;
+
+function INetLibConfigAliasGet(refNum: UInt16; aliasIndex: UInt16; var indexP: UInt16; var isAnotherAliasP: Boolean): Err; syscall inetLibConfigAliasGet_;
+
+//--------------------------------------------------
+// File specific calls
+//--------------------------------------------------
+
+function INetLibSockFileGetByIndex(libRefnum: UInt16; sockH: MemHandle; index: UInt32;
+ var handleP: MemHandle; var offsetP, lengthP: UInt32): Err; syscall inetLibTrapSockFileGetByIndex;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/inspoint.pp b/packages/palmunits/src/inspoint.pp
new file mode 100644
index 0000000000..542c1c4eef
--- /dev/null
+++ b/packages/palmunits/src/inspoint.pp
@@ -0,0 +1,49 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: InsPoint.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines insertion point routines.
+ *
+ * History:
+ * Jan 25, 1995 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit inspoint;
+
+interface
+
+uses palmos, coretraps, systemmgr;
+
+// Blink interval is half of a second
+const
+ insPtBlinkInterval = sysTicksPerSecond_ div 2;
+ insPtWidth = 2;
+
+procedure InsPtInitialize; syscall sysTrapInsPtInitialize;
+
+procedure InsPtSetLocation(const x, y: Int16); syscall sysTrapInsPtSetLocation;
+
+procedure InsPtGetLocation(var x, y: Int16); syscall sysTrapInsPtGetLocation;
+
+procedure InsPtEnable(enableIt: Boolean); syscall sysTrapInsPtEnable;
+
+function InsPtEnabled: Boolean; syscall sysTrapInsPtEnabled;
+
+procedure InsPtSetHeight(const height: Int16); syscall sysTrapInsPtSetHeight;
+
+function InsPtGetHeight: Int16; syscall sysTrapInsPtGetHeight;
+
+procedure InsPtCheckBlink; syscall sysTrapInsPtCheckBlink;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/intlmgr.pp b/packages/palmunits/src/intlmgr.pp
new file mode 100644
index 0000000000..5f85fc141b
--- /dev/null
+++ b/packages/palmunits/src/intlmgr.pp
@@ -0,0 +1,133 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: IntlMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ * 03/01/00 kwk Added intlTxtConvertEncoding selector.
+ * 05/10/00 kwk Added intlIntlSetRoutineAddress selector & routine declaration.
+ * Also intlErrInvalidSelector.
+ * 05/18/00 kwk Added intlMgrStrict feature flag.
+ * 05/26/00 kwk Added intlTxtGetWordWrapOffset selector.
+ * 07/13/00 kwk Added intlTxtNameToEncoding selector.
+ * 07/27/00 kwk Added intlTxtConvertEncodingV35 selector.
+ * 11/29/00 kwk Added intlIntlStrictChecks selector.
+ *
+ *****************************************************************************)
+
+unit intlmgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(***********************************************************************
+ * Public constants
+ ***********************************************************************)
+
+const
+// Bits set for the Intl Mgr feature.
+ intlMgrExists = $00000001; // IntlMgr/TextMgr calls can be made.
+ intlMgrStrict = $00000002; // Trigger extra errors on debug ROM.
+
+// Intl manager error codes.
+ intlErrInvalidSelector = intlErrorClass or 1;
+
+// Selectors for routines found in the international manager. The order
+// of these selectors MUST match the jump table in IntlDispatch.c.
+const
+ intlIntlInit = 0;
+ intlTxtByteAttr = 1;
+ intlTxtCharAttr = 2;
+ intlTxtCharXAttr = 3;
+ intlTxtCharSize = 4;
+ intlTxtGetPreviousChar = 5;
+ intlTxtGetNextChar = 6;
+ intlTxtGetChar = 7;
+ intlTxtSetNextChar = 8;
+ intlTxtCharBounds = 9;
+ intlTxtPrepFindString = 10;
+ intlTxtFindString = 11;
+ intlTxtReplaceStr = 12;
+ intlTxtWordBounds = 13;
+ intlTxtCharEncoding = 14;
+ intlTxtStrEncoding = 15;
+ intlTxtEncodingName = 16;
+ intlTxtMaxEncoding = 17;
+ intlTxtTransliterate = 18;
+ intlTxtCharIsValid = 19;
+ intlTxtCompare = 20;
+ intlTxtCaselessCompare = 21;
+ intlTxtCharWidth = 22;
+ intlTxtGetTruncationOffset = 23;
+ intlIntlGetRoutineAddress = 24;
+
+// New for Palm OS 3.5
+ intlIntlHandleEvent = 25;
+ intlTxtParamString = 26;
+
+// Patched for Palm OS 3.5.2
+ intlTxtConvertEncodingV35 = 27;
+
+// New for Palm OS 4.0
+ intlTxtConvertEncoding = 28;
+ intlIntlSetRoutineAddress = 29;
+ intlTxtGetWordWrapOffset = 30;
+ intlTxtNameToEncoding = 31;
+ intlIntlStrictChecks = 32;
+
+ intlMaxSelector = intlIntlStrictChecks;
+
+type
+ IntlSelector = UInt16;
+
+(***********************************************************************
+ * Public routines
+ ***********************************************************************)
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+function IntlGetRoutineAddress(inSelector: IntlSelector): Pointer;
+
+// Set the address of the international mgr routine indicated by <iSelector>
+// to be <iProcPtr>. If <iSelector> isn't valid, return an error.
+function IntlSetRoutineAddress(iSelector: IntlSelector; iProcPtr: Pointer): Err;
+
+implementation
+
+function __IntlGetRoutineAddress(inSelector: IntlSelector): Pointer; syscall sysTrapIntlDispatch;
+function __IntlSetRoutineAddress(iSelector: IntlSelector; iProcPtr: Pointer): Err; syscall sysTrapIntlDispatch;
+
+function IntlGetRoutineAddress(inSelector: IntlSelector): Pointer;
+begin
+ asm
+ move.l #$intlIntlGetRoutineAddress, D2;
+ end;
+ IntlGetRoutineAddress := __IntlGetRoutineAddress(inSelector);
+end;
+
+function IntlSetRoutineAddress(iSelector: IntlSelector; iProcPtr: Pointer): Err;
+begin
+ asm
+ move.l #$intlIntlSetRoutineAddress, D2;
+ end;
+ IntlSetRoutineAddress := __IntlSetRoutineAddress(iSelector, iProcPtr);
+end;
+
+end.
diff --git a/packages/palmunits/src/irlib.pp b/packages/palmunits/src/irlib.pp
new file mode 100644
index 0000000000..fe81c4dfda
--- /dev/null
+++ b/packages/palmunits/src/irlib.pp
@@ -0,0 +1,1538 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-1999 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+
+ *
+ * Portions of this file are:
+ * Copyright Counterpoint Systems Foundry, Inc. 1995, 1996
+ *
+ * File: IrLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for PalmOS IrDA Library.
+ *
+ * History:
+ * 5/23/97 Created by Gavin Peacock
+ * 2/13/98 Merged with counterpoint libraries
+ * 6/24/98 Added disconnect timeout opt for IrOpen,
+ * remaining speeds. Added parentheses to control defines.
+ *
+ *****************************************************************************)
+
+unit irlib;
+
+interface
+
+uses palmos, libtraps, exgmgr, systemresources;
+
+// The Ir library is used as an Exchange library. ExgLib.h defines all the
+// primary entrypoints into the library. The rest of this include file defines the
+// direct stack API for apps not using the Exchange interface. The Stack API
+// comes after the Exchange library API in the library interface.
+
+// name of Ir library
+const
+ irLibName = 'IrDA Library';
+
+// Specific scheme for IR exg lib
+const
+ exgIrObexScheme = '_irobex';
+
+// Feature Creators and numbers, for use with the FtrGet() call. This
+// feature can be obtained to get the current version of the Ir Library
+const
+ irFtrCreator = sysFileCIrLib;
+ irFtrNumVersion = 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
+
+// Options values for IrOpen
+// BDDDxxxx xxxxxxxx xxxxxxxx xxxSSSSS
+// Where B=background mode, DDD=disconnect timeout, SSSSS=speed
+
+ irOpenOptBackground = $80000000; // Unsupported background task use
+ irOpenOptDisconnect3 = $10000000; // sets amount of time in seconds
+ irOpenOptDisconnect8 = $20000000; // after no activity from other
+ irOpenOptDisconnect12 = $30000000; // device before disconnect is
+ irOpenOptDisconnect16 = $40000000; // initiated.
+ irOpenOptDisconnect20 = $50000000; // default is 40 secs
+ irOpenOptDisconnect25 = $60000000;
+ irOpenOptDisconnect30 = $70000000;
+ irOpenOptDisconnect40 = $00000000;
+ irOpenOptSpeed115200 = $0000003F; // sets max negotiated baud rate
+ irOpenOptSpeed57600 = $0000001F; // default is 57600
+ irOpenOptSpeed38400 = $0000000F;
+ irOpenOptSpeed19200 = $00000007;
+ irOpenOptSpeed9600 = $00000003;
+
+// Option codes for ExgLibControl
+// These options are all unique to the Ir transport
+
+ irGetScanningMode = exgLibCtlSpecificOp or 1; // returns scanning enabled
+ irSetScanningMode = exgLibCtlSpecificOp or 2; // en/disables ir scanning mode
+ irGetStatistics = exgLibCtlSpecificOp or 3; // returns performance stats
+ irSetSerialMode = exgLibCtlSpecificOp or 4; // sets driver to use direct serial
+ irSetBaudMask = exgLibCtlSpecificOp or 5; // set possible baud rates (irOpenOpts)
+ irSetSupported = exgLibCtlSpecificOp or 6; // disables the ir not supported dialog
+ irSuppressScanning = exgLibCtlSpecificOp or 7; // temporarily disabled beam receive
+ irRestoreScanning = exgLibCtlSpecificOp or 8; // restore beam receive state
+
+// structure returned by irGetStatistics
+type
+ IrStatsType = record
+ recLineErrors: UInt16; // # of serial errors since library opend
+ crcErrors: UInt16; // # of crc errors ...
+ end;
+
+//-----------------------------------------------------------------------------
+// Ir library call ID's.
+//-----------------------------------------------------------------------------
+
+// These start after the old exchange library interface. If we add any more exchange
+// library traps, we'll have to separate the publicly accessible "IR Library" and the
+// IrOBEX exchange library.
+
+type
+ IrLibTrapNumberEnum = Enum;
+
+const
+ irLibTrapBind = sysLibTrapCustom + 10; // these start after the ObxLib interface...
+ irLibTrapUnBind = Succ(irLibTrapBind);
+ irLibTrapDiscoverReq = Succ(irLibTrapUnBind);
+ irLibTrapConnectIrLap = Succ(irLibTrapDiscoverReq);
+ irLibTrapDisconnectIrLap = Succ(irLibTrapConnectIrLap);
+ irLibTrapConnectReq = Succ(irLibTrapDisconnectIrLap);
+ irLibTrapConnectRsp = Succ(irLibTrapConnectReq);
+ irLibTrapDataReq = Succ(irLibTrapConnectRsp);
+ irLibTrapLocalBusy = Succ(irLibTrapDataReq);
+ irLibTrapMaxTxSize = Succ(irLibTrapLocalBusy);
+ irLibTrapMaxRxSize = Succ(irLibTrapMaxTxSize);
+ irLibTrapSetDeviceInfo = Succ(irLibTrapMaxRxSize);
+ irLibTrapIsNoProgress = Succ(irLibTrapSetDeviceInfo);
+ irLibTrapIsRemoteBusy = Succ(irLibTrapIsNoProgress);
+ irLibTrapIsMediaBusy = Succ(irLibTrapIsRemoteBusy);
+ irLibTrapIsIrLapConnected = Succ(irLibTrapIsMediaBusy);
+ irLibTrapTestReq = Succ(irLibTrapIsIrLapConnected);
+ irLibTrapIAS_Add = Succ(irLibTrapTestReq);
+ irLibTrapIAS_Query = Succ(irLibTrapIAS_Add);
+ irLibTrapIAS_SetDeviceName = Succ(irLibTrapIAS_Query);
+ irLibTrapIAS_Next = Succ(irLibTrapIAS_SetDeviceName);
+ irLibTrapIrOpen = Succ(irLibTrapIAS_Next);
+ irLibTrapHandleEvent = Succ(irLibTrapIrOpen);
+ irLibTrapWaitForEvent = Succ(irLibTrapHandleEvent);
+
+ irLibTrapLast = Succ(irLibTrapWaitForEvent);
+
+(****************************************************************************
+ *
+ * Types and Constants
+ *
+ ****************************************************************************)
+
+// Maximum size of packet that can be sent at connect time (ConnectReq or
+// ConnectRsp) for IrLMP and Tiny TP connections.
+
+const
+ IR_MAX_CON_PACKET = 60;
+ IR_MAX_TTP_CON_PACKET = 52;
+ IR_MAX_TEST_PACKET = 376;
+ IR_MAX_DEVICE_INFO = 23;
+
+// Size of the device list used in discovery process
+
+ IR_DEVICE_LIST_SIZE = 6;
+
+(*---------------------------------------------------------------------------
+ *
+ * Maximum size of the XID info field used in a discovery frame. The XID
+ * info field contains the device hints and nickname.
+ *)
+
+ IR_MAX_XID_LEN = 23;
+
+// Maximum allowed LSAP in IrLMP
+
+ IR_MAX_LSAP = $6f;
+
+// The following are used to access the hint bits in the first byte
+// of the Device Info field of an XID frame (IrDeviceInfo).
+
+ IR_HINT_PNP = $01;
+ IR_HINT_PDA = $02;
+ IR_HINT_COMPUTER = $04;
+ IR_HINT_PRINTER = $08;
+ IR_HINT_MODEM = $10;
+ IR_HINT_FAX = $20;
+ IR_HINT_LAN = $40;
+ IR_HINT_EXT = $80;
+
+(* The following are used to access the hint bits in the second byte
+ * of the Device Info field of an XID frame (IrDeviceInfo). Note
+ * that LM_HINT_EXT works for all hint bytes.
+ *)
+
+ IR_HINT_TELEPHONY = $01;
+ IR_HINT_FILE = $02;
+ IR_HINT_IRCOMM = $04;
+ IR_HINT_MESSAGE = $08;
+ IR_HINT_HTTP = $10;
+ IR_HINT_OBEX = $20;
+
+(*---------------------------------------------------------------------------
+ *
+ * Status of a stack operation or of the stack.
+ *)
+
+type
+ IrStatus = UInt8;
+
+const
+ IR_STATUS_SUCCESS = 0; // Successful and complete
+ IR_STATUS_FAILED = 1; // Operation failed
+ IR_STATUS_PENDING = 2; // Successfully started but pending
+ IR_STATUS_DISCONNECT = 3; // Link disconnected
+ IR_STATUS_NO_IRLAP = 4; // No IrLAP Connection exists
+ IR_STATUS_MEDIA_BUSY = 5; // IR Media is busy
+ IR_STATUS_MEDIA_NOT_BUSY = 6; // IR Media is not busy
+ IR_STATUS_NO_PROGRESS = 7; // IrLAP not making progress
+ IR_STATUS_LINK_OK = 8; // No progress condition cleared
+ // IR_STATUS_RESERVED1 = 9; // Reserved for future use
+ // IR_STATUS_RESERVED2 = 10; // Reserved for future use
+
+(*---------------------------------------------------------------------------
+ *
+ * Character set for user strings. These are definitions for the character
+ * set in Nicknames and in IAS attributes of type User String.
+ *)
+
+type
+ IrCharSet = UInt8;
+
+const
+ IR_CHAR_ASCII = 0;
+ IR_CHAR_ISO_8859_1 = 1;
+ IR_CHAR_ISO_8859_2 = 2;
+ IR_CHAR_ISO_8859_3 = 3;
+ IR_CHAR_ISO_8859_4 = 4;
+ IR_CHAR_ISO_8859_5 = 5;
+ IR_CHAR_ISO_8859_6 = 6;
+ IR_CHAR_ISO_8859_7 = 7;
+ IR_CHAR_ISO_8859_8 = 8;
+ IR_CHAR_ISO_8859_9 = 9;
+ IR_CHAR_UNICODE = $ff;
+
+(*---------------------------------------------------------------------------
+ *
+ * All indication and confirmations are sent to the IrLMP/TTP connections
+ * through one callback function. The types of the events passed are
+ * defined below. Applications should ignore events listed as "reserved"
+ * as well as events not listed at all, since we may add more events in
+ * future versions of the IR library.
+ *)
+
+
+type
+ IrEvent = UInt8;
+
+const
+ LEVENT_LM_CON_IND = 0;
+ LEVENT_LM_DISCON_IND = 1;
+ LEVENT_DATA_IND = 2;
+ LEVENT_PACKET_HANDLED = 3;
+ LEVENT_LAP_CON_IND = 4;
+ LEVENT_LAP_DISCON_IND = 5;
+ LEVENT_DISCOVERY_CNF = 6;
+ LEVENT_LAP_CON_CNF = 7;
+ LEVENT_LM_CON_CNF = 8;
+ LEVENT_STATUS_IND = 9;
+ LEVENT_TEST_IND = 10;
+ LEVENT_TEST_CNF = 11;
+ // LEVENT_RESERVED1 = 12; // reserved for future use
+ LEVENT_LM_SEND_IND = 13; // added in Palm OS 4.0
+
+// LmConnect flags - used internally
+
+ LCON_FLAGS_TTP = $02;
+
+(****************************************************************************
+ *
+ * IAS Types and Constants
+ *
+ ****************************************************************************)
+
+// Maximum size of a query that observes the IrDA Lite rules
+
+ IR_MAX_QUERY_LEN = 61;
+
+// Maximum values for IAS fields. IR_MAX_IAS_NAME is the maximum allowable
+// size for IAS Object names and Attribute names.
+
+ IR_MAX_IAS_NAME = 60;
+ IR_MAX_ATTRIBUTES = 255;
+
+(* Maximum size of an IAS attribute that fits within the IrDA Lite rules.
+ * Even though attribute values can be larger IrDA Lite highly recommends
+ * that the total size of an attribute value fit within one 64 byte packet
+ * thus, the allowable size is 56 bytes or less. This size is enforced by the
+ * code.
+ *)
+
+ IR_MAX_IAS_ATTR_SIZE = 56;
+
+// Type of the IAS entry. This is the value returned for type when parsing
+// the results buffer after a successful IAS Query.
+
+ IAS_ATTRIB_MISSING = 0;
+ IAS_ATTRIB_INTEGER = 1;
+ IAS_ATTRIB_OCTET_STRING = 2;
+ IAS_ATTRIB_USER_STRING = 3;
+ IAS_ATTRIB_UNDEFINED = $ff;
+
+// Ias Return Codes. One of these values will be found in the IAS Query
+// structure in the retCode field after a successful IAS Query.
+
+ IAS_RET_SUCCESS = 0; // Query operation is successful
+ IAS_RET_NO_SUCH_CLASS = 1; // Query failed no such class exists
+ IAS_RET_NO_SUCH_ATTRIB = 2; // Query failed no such attribute exists
+ IAS_RET_UNSUPPORTED = $ff; // Query failed operation is unsupported
+
+// IAS Get Value By Class opcode number
+
+ IAS_GET_VALUE_BY_CLASS = 4;
+
+(****************************************************************************
+ *
+ * Data Structures
+ *
+ ****************************************************************************)
+
+// stack functions use a diferent type for booleans
+type
+ BOOL = Int16;
+
+(*---------------------------------------------------------------------------
+ *
+ * ListEntry is used internally by the stack
+ *)
+
+ _ListEntry = record
+ Flink: ^ListEntry;
+ Blink: ^ListEntry;
+ end;
+
+ ListEntry = _ListEntry;
+
+// Forward declaration of the IrConnect structure
+
+ IrConnectPtr = ^_hconnect;
+
+(*---------------------------------------------------------------------------
+ *
+ * Packet Structure for sending IrDA packets.
+ *)
+
+ _IrPacket = record
+ (* The node field must be the first field in the structure. It is used
+ * internally by the stack
+ *)
+ node: ListEntry;
+
+ (* The buff field is used to point to a buffer of data to send and len
+ * field indicates the number of bytes in buff.
+ *)
+ buff: ^UInt8;
+ len: UInt16;
+
+ (*================== For Internal Use Only =======================
+ *
+ * The following is used internally by the stack and should not be
+ * modified by the upper layer.
+ *
+ *==================================================================*)
+
+ origin: IrConnectPtr; // Pointer to connection which owns packet
+ headerLen: UInt8; // Number of bytes in the header
+ header: array [0..13] of UInt8; // Storage for the header
+ reserved: UInt8; // Explicitly account for 16-bit alignment padding
+ end;
+
+ IrPacket = _IrPacket;
+
+(*---------------------------------------------------------------------------
+ *
+ * 32-bit Device Address
+ *)
+
+ IrDeviceAddr = record
+ case Integer of
+ 0: (u8: array [0..3] of UInt8);
+ 1: (u16: array [0..1] of UInt16);
+ 2: (u32: UInt32);
+ end;
+
+(*---------------------------------------------------------------------------
+ *
+ * The information returned for each device discovered during discovery.
+ * The maximum size of the xid field is 23. This holds the hints and
+ * the nickname.
+ *)
+
+ IrDeviceInfo = record
+ hDevice: IrDeviceAddr; // 32-bit address of device
+ len: UInt8; // Length of xid
+ xid: array [0..IR_MAX_XID_LEN-1] of UInt8; // XID information
+ end;
+
+(*---------------------------------------------------------------------------
+ *
+ * List of Device Discovery info elements.
+ *)
+
+ IrDeviceList = record
+ nItems: UInt8; // Number items in the list
+ reserved: UInt8; // Explicitly account for 16-bit alignment padding
+ dev: array [0..IR_DEVICE_LIST_SIZE-1] of IrDeviceInfo; // Fixed size in IrDA Lite
+ end;
+
+(*---------------------------------------------------------------------------
+ *
+ * Callback Parameter Structure is used to pass information from the stack
+ * to the upper layer of the stack (application). Not all fields are valid
+ * at any given time. The type of event determines which fields are valid.
+ *)
+
+ IrCallBackParms = record
+ event: IrEvent; // Event causing callback
+ reserved1: UInt8; // Explicitly account for 16-bit alignment padding
+ rxBuff: ^UInt8; // Receive buffer already advanced to app data
+ rxLen: UInt16; // Length of data in receive buffer
+ packet: ^IrPacket; // Pointer to packet being returned
+ deviceList: ^IrDeviceList; // Pointer to discovery device list
+ status: IrStatus; // Status of stack
+ reserved2: UInt8; // Explicitly account for 16-bit alignment padding
+ end;
+ IrCallBackParmsPtr = ^IrCallBackParms;
+
+(* The definitions for the callback function is given below. How the
+ * callback function is used in conjuction with the stack functions is
+ * given below in the Callback Reference.
+ *)
+
+ IrCallBack = procedure(p1: IrConnectPtr; p2: IrCallBackParmsPtr);
+
+(*---------------------------------------------------------------------------
+ *
+ * Definition of IrConnect structure. This structure is used to manage an
+ * IrLMP or Tiny TP connection.
+ *)
+
+ _hconnect = record
+ lLsap: UInt8; // Local LSAP this connection will listen on
+ rLsap: UInt8; // Remote Lsap
+
+ (*================== For Internal Use Only =======================
+ *
+ * The following is used internally by the stack and should not be
+ * modified by the user.
+ *
+ *==================================================================*)
+
+ flags: UInt8; // Flags containing state, type, etc.
+ reserved: UInt8; // Explicitly account for 16-bit alignment padding
+ callBack: IrCallBack; // Pointer to callback function
+
+ (* Tiny TP fields *)
+ packet: IrPacket; // Packet for internal use
+ packets: ListEntry; // List of packets to send
+ sendCredit: UInt16; // Amount of credit from peer
+ availCredit: UInt8; // Amount of credit to give to peer
+ dataOff: UInt8; // Amount of data less than IrLAP size
+ end;
+
+ IrConnect = _hconnect;
+
+(****************************************************************************
+ *
+ * IAS Data Strucutres
+ *
+ ****************************************************************************)
+
+(*---------------------------------------------------------------------------
+ *
+ * The LmIasAttribute is a strucutre that holds one attribute of an IAS
+ * object.
+ *)
+
+ _IrIasAttribute = record
+ name: ^UInt8; // Pointer to name of attribute
+ len: UInt8; // Length of attribute name
+ reserved1: UInt8; // Explicitly account for 16-bit alignment padding
+ value: ^UInt8; // Hardcode value (see below)
+ valLen: UInt8; // Length of the value.
+ reserved2: UInt8; // Explicitly account for 16-bit alignment padding
+ end;
+
+ IrIasAttribute = _IrIasAttribute;
+
+(* The value field of the IrIasAttribute structure is a hard coded string
+ * which represents the actual bytes sent over the IR for the attribute
+ * value. The value field contains all the bytes which represent an
+ * attribute value based on the transmission format described in section
+ * 4.3 of the IrLMP specification. An example of a user string is given
+ * below.
+ *
+ * User String:
+ * 1 byte type, 1 byte Char set, 1 byte length, length byte string
+ *
+ * Example of an user string "Hello World" in ASCII
+ *
+ * U8 helloString[] = {
+ * IAS_ATTRIB_USER_STRING,IR_CHAR_ASCII,11,
+ * 'H','e','l','l','o',' ','W','o','r','l','d'
+ * };
+ *)
+
+(*---------------------------------------------------------------------------
+ *
+ * The LmIasObject is storage for an IAS object managed by the local
+ * IAS server.
+ *)
+
+ _IrIasObject = record
+ name: ^UInt8; // Pointer to name of object
+ len: UInt8; // Length of object name
+
+ nAttribs: UInt8; // Number of attributes
+ attribs: ^IrIasAttribute; // A pointer to an array of attributes
+ end;
+
+ IrIasObject = _IrIasObject;
+
+(*---------------------------------------------------------------------------
+ *
+ * Forward declaration of a structure used for performing IAS Queries so
+ * that a callback type can be defined for use in the structure.
+ *)
+
+type
+ IrIasQueryCallBack = procedure(p: IrStatus);
+
+(*---------------------------------------------------------------------------
+ *
+ * Actual definition of the IrIasQuery structure.
+ *)
+
+ _IrIasQuery = record
+
+ (* Query fields. The query buffer contains the class name and class
+ * attribute whose value is being queried it is as follows:
+ *
+ * 1 byte - Length of class name
+ * "Length" bytes - class name
+ * 1 byte - length of attribute name
+ * "Length" bytes - attribute name
+ *
+ * queryLen - contains the total number of byte in the query
+ *)
+ queryLen: UInt8; // Total length of the query
+ reserved: UInt8; // Explicitly account for 16-bit alignment padding
+ queryBuf: ^UInt8; // Points to buffer containing the query
+
+ (* Fields for the query result *)
+ resultBufSize: UInt16; // Size of the result buffer
+ resultLen: UInt16; // Actual number of bytes in the result buffer
+ listLen: UInt16; // Number of items in the result list.
+ offset: UInt16; // Offset into results buffer
+ retCode: UInt8; // Return code of operation
+ overFlow: UInt8; // Set TRUE if result exceeded result buffer size
+ result: ^UInt8; // Pointer to buffer containing result;
+
+ (* Pointer to callback function *)
+ callBack: IrIasQueryCallBack;
+ end;
+
+ IrIasQuery = _IrIasQuery;
+
+(****************************************************************************
+ *
+ * Function Reference
+ *
+ ****************************************************************************)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: Err IrOpen(UInt16 refnum, UInt32 options)
+ *
+ * Description: Open the Ir library. This allocates the global memory
+ * for the ir stack and reserves and system resources it
+ * requires. This must be done before any other ir libary
+ * calls are made.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * options - open options flags
+ *
+ *
+ * Return Values: zero if no error or exgErrStackInit
+ *
+ *)
+
+function IrOpen(refnum: UInt16; options: UInt32): Err; syscall irLibTrapIrOpen;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: Err IrClose(UInt16 refnum)
+ *
+ * Description: Close the Ir library. This releases the global memory
+ * for the ir stack and any system resources it uses.
+ * This must be called when an application is done with the
+ * ir library.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: zero if no error
+ *
+ *)
+
+function IrClose(refnum: UInt16): Err; syscall sysLibTrapClose;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrBind(UInt16 refNum,IrConnect* con,
+ * IrCallback callBack)
+ *
+ * Description: Obtain a local LSAP selector and register the connection
+ * with the protocol stack. This IrConnect structure will be
+ * initialized. Any values stored in the structure will be
+ * lost. The assigned LSAP will be in the lLsap field of con.
+ * The type of the connection will be set to IrLMP. The
+ * IrConnect must be bound to the stack before it can be used.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure.
+ *
+ * callBack - pointer to a callBack function that handles
+ * the indications and confirmation from the protocol stack.
+ *
+ * Return Values: IR_STATUS_SUCCESS - operation completed successfully.
+ * The assigned LSAP can be found in con->lLsap.
+ *
+ * IR_STATUS_FAILED - the operation failed for one of the
+ * following reasons:
+ * - con is already bound to the stack
+ * - no room in the connection table
+ *)
+
+function IrBind(refNum: UInt16; var con: IrConnect; callBack: IrCallBack): IrStatus; syscall irLibTrapBind;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrUnbind(UInt16 refNum,IrConnect* con)
+ *
+ * Description: Unbind the IrConnect structure from the protocol stack
+ * freeing it's LSAP selector.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure to unbind
+ *
+ * Return Values: IR_STATUS_SUCCESS - operation competed succesfully
+ *
+ * IR_STATUS_FAILED - operation failed
+ * either because the IrConnect structure was not bound
+ * or the lLsap field contained an invalid number.
+ *)
+
+function IrUnbind(refNum: UInt16; var con: IrConnect): IrStatus; syscall irLibTrapUnBind;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrDiscoverReq(UInt16 refNum,IrConnect* con)
+ *
+ * Description: Start an IrLMP discovery process. The result will be
+ * signaled via the callBack function specified in the
+ * IrConnect structure with the event LEVENT_DISCOVERY_CNF.
+ * Only one discovery can be invoked at a time.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to a bound IrConnect structure.
+ *
+ * Return Values: IR_STATUS_PENDING - operation is started successfully
+ * result returned via callback.
+ *
+ * IR_STATUS_MEDIA_BUSY - operation failed because the media
+ * is busy. Media busy is caused by one of the following
+ * reasons:
+ * - Other devices are using the IR medium.
+ * - A discovery process is already in progress
+ * - An IrLAP connection exists.
+ *
+ * IR_STATUS_FAILED - operation failed
+ * because the IrConnect structure is not bound to the stack.
+ *)
+
+function IrDiscoverReq(refNum: UInt16; var con: IrConnect): IrStatus; syscall irLibTrapDiscoverReq;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrConnectIrLap(UInt16 refNum,IrDeviceAddr deviceAddr)
+ *
+ * Description: Start an IrLAP connection. The result is signaled to all
+ * bound IrConnect structures via the callback function. The
+ * callback event is LEVENT_LAP_CON_CNF if successful or
+ * LEVENT_LAP_DISCON_IND if unsuccessful.
+ *
+ * Parameters:: refNum - ir library refNum
+ *
+ * deviceAddr - 32-bit address of device to which connection
+ * should be made.
+ *
+ * Return Values: IR_STATUS_PENDING - operation started successfully and
+ * callback will be called with result.
+ *
+ * IR_STATUS_MEDIA_BUSY - operation failed to start because
+ * the IR media is busy. Media busy is caused by one of the
+ * following reasons:
+ * - Other devices are using the IR medium.
+ * - An IrLAP connection already exists
+ * - A discovery process is in progress
+ *)
+
+function IrConnectIrLap(refNum: UInt16; deviceAddr: IrDeviceAddr): IrStatus; syscall irLibTrapConnectIrLap;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrDisconnectIrLap(UInt16 refNum)
+ *
+ * Description: Disconnect the IrLAP connection. When the IrLAP connection
+ * goes down the callback of all bound IrConnect structures
+ * is called with event LEVENT_LAP_DISCON_IND.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: IR_STATUS_PENDING - operation started successfully and
+ * the all bound IrConnect structures will be called back
+ * when complete.
+ *
+ * IR_STATUS_NO_IRLAP - operation failed because no IrLAP
+ * connection exists.
+ *)
+
+function IrDisconnectIrLap(refNum: UInt16): IrStatus; syscall irLibTrapDisconnectIrLap;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrConnectReq(UInt16 refNum,
+ * IrConnect* con,
+ * IrPacket* packet,
+ * UInt8 credit);
+ *
+ * Description: Request an IrLMP or TinyTP connection. The result is
+ * is signaled via the callback specified in the IrConnect
+ * structure. The callback event is LEVENT_LM_CON_CNF
+ * indicates that the connection is up and LEVENT_LM_DISCON_IND
+ * indicates that the connection failed. Before calling this
+ * function the fields in the con structure must be properly
+ * set.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure for handing the
+ * the connection. The rLsap field must contain the LSAP
+ * selector for the peer on the other device. Also the type
+ * of the connection must be set. Use IR_SetConTypeLMP() to
+ * set the type to an IrLMP conneciton or IR_SetConTypeTTP()
+ * to set the type to a Tiny TP connection.
+ *
+ * packet - pointer to a packet that contains connection data.
+ * Even if no connection data is needed the packet must point
+ * to a valid IrPacket structure. The packet will be returned
+ * via the callback with the LEVENT_PACKET_HANDLED event if no
+ * errors occur. The maximum size of the packet is
+ * IR_MAX_CON_PACKET for an IrLMP connection or
+ * IR_MAX_TTP_CON_PACKET for a Tiny TP connection.
+ *
+ * credit - initial amount of credit advanced to the other side.
+ * Must be less than 127. It is ANDed with 0x7f so if it is
+ * greater than 127 unexpected results will occur. This
+ * parameter is ignored if the Connection is an IrLMP connection.
+ *
+ * Return Values: IR_STATUS_PENDING - operation has been started successfully
+ * and the result will be returned via the callback function with
+ * the event LEVENT_LM_CON_CNF if the connection is made or
+ * LEVENT_LM_DISCON_IND if connection fails. The packet is returned
+ * via the callback with the event LEVENT_PACKET_HANDLED.
+ *
+ * IR_STATUS_FAILED - operation failed because of one of the
+ * reasons below. Note that the packet is
+ * available immediately:
+ * - Connection is busy (already involved in a connection)
+ * - IrConnect structure is not bound to the stack
+ * - Packet size exceeds maximum allowed.
+ *
+ * IR_STATUS_NO_IRLAP - operation failed because there is no
+ * IrLAP connection (the packet is available immediately).
+ *)
+
+function IrConnectReq(refNum: UInt16; var con: IrConnect; var packet: IrPacket; credit: UInt8): IrStatus; syscall irLibTrapConnectReq;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrConnectRsp(UInt16 refNum,
+ * IrConnect* con,
+ * IrPacket* packet,
+ * UInt8 credit);
+ *
+ * Description: Accept an incoming connection that has been signaled via
+ * the callback with the event LEVENT_LM_CON_IND. IR_ConnectRsp
+ * can be called during the callback or later to accept
+ * the connection. The type of the connection must already have
+ * been set to IrLMP or Tiny TP before LEVENT_LM_CON_IND event.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure to managed connection.
+ *
+ * packet - pointer to a packet that contains connection data.
+ * Even if no connection data is needed the packet must point
+ * to a valid IrPacket structure. The packet will be returned
+ * via the callback with the LEVENT_PACKET_HANDLED event if no
+ * errors occur. The maximum size of the packet is
+ * IR_MAX_CON_PACKET for an IrLMP connection or
+ * IR_MAX_TTP_CON_PACKET for a Tiny TP connection.
+ *
+ * credit - initial amount of credit advanced to the other side.
+ * Must be less than 127. It is ANDed with 0x7f so if it is
+ * greater than 127 unexpected results will occur. This
+ * parameter is ignored if the Connection is an IrLMP connection.
+ *
+ * Return Values: IR_STATUS_PENDING - response has been started successfully
+ * and the packet is returned via the callback with the event
+ * LEVENT_PACKET_HANDLED.
+ *
+ * IR_STATUS_FAILED - operation failed because of one of the
+ * reasons below . Note that the packet is
+ * available immediately:
+ * - Connection is not in the proper state to require a
+ * response.
+ * - IrConnect structure is not bound to the stack
+ * - Packet size exceeds maximum allowed.
+ *
+ * IR_STATUS_NO_IRLAP - operation failed because there is no
+ * IrLAP connection (Packet is available immediately).
+ *)
+
+function IrConnectRsp(refNum: UInt16; var con: IrConnect; var packet: IrPacket; credit: UInt8): IrStatus; syscall irLibTrapConnectRsp;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IR_DataReq(IrConnect* con,
+ * IrPacket* packet);
+ *
+ * Description: Send a data packet. The packet is owned by the stack until
+ * it is returned via the callback with event
+ * LEVENT_PACKET_HANDLED. The largest packet that can be sent
+ * is found by calling IR_MaxTxSize().
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure that specifies the
+ * connection over which the packet should be sent.
+ *
+ * packet - pointer to a packet that contains data to send.
+ * The packet should exceed the max size found with
+ * IR_MaxTxSize().
+ *
+ * Return Values: IR_STATUS_PENDING - packet has been queued by the stack.
+ * The packet will be returned via the callback with event
+ * LEVENT_PACKET_HANDLED.
+ *
+ *
+ * IR_STATUS_FAILED - operation failed and packet is available
+ * immediately. Operation failed for one of the following
+ * reasons:
+ * - IrConnect structure is not bound to the stack (error
+ * checking only)
+ * - packet exceeds the maximum size (error checking only)
+ * - IrConnect does not represent an active connection
+ *)
+
+function IrDataReq(refNum: UInt16; var con: IrConnect; var packet: IrPacket): IrStatus; syscall irLibTrapDataReq;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: void IrAdvanceCredit(IrConnect* con,
+ * UInt8 credit);
+ *
+ * Description: Advance credit to the other side. The total amount of
+ * credit should not exceed 127. The credit passed by this
+ * function is added to existing available credit which is
+ * the number that must not exceed 127. This function
+ * only makes sense for a Tiny TP connection.
+ *
+ * Parameters: con - pointer to IrConnect structure representing
+ * connection to which credit is advanced.
+ *
+ * credit - number of credit to advance.
+ *
+ * Return Values: void
+ *)
+
+// IrAdvanceCredit(con, credit) {(con)->availCredit += (credit);}
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: void IrLocalBusy(UInt16 refNum,BOOL flag);
+ *
+ * Description: Set the IrLAP local busy flag. If local busy is set to true
+ * then the local IrLAP layer will send RNR frames to the other
+ * side indicating it cannot receive any more data. If the
+ * local busy is set to false IrLAP is ready to receive frames.
+ * This function should not be used when using Tiny TP or when
+ * multiple connections exist. It takes affect the next time
+ * IrLAP sends an RR frame. If IrLAP has data to send the data
+ * will be sent first so it should be used carefully.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * flag - value (true or false) to set IrLAP's local busy flag.
+ *
+ * Return Values: void
+ *)
+
+procedure IrLocalBusy(refNum: UInt16; flag: BOOL); syscall irLibTrapLocalBusy;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: void IrSetConTypeTTP(IrConnect* con)
+ *
+ * Description: Set the type of the connection to Tiny TP. This function
+ * must be called after the IrConnect structure is bound to
+ * the stack.
+ *
+ * Parameters: con - pointer to IrConnect structure.
+ *
+ * Return Values: void
+ *)
+
+// IrSetConTypeTTP(con) { ((con)->flags |= LCON_FLAGS_TTP); }
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: void IrSetConTypeLMP(IrConnect* con)
+ *
+ * Description: Set the type of the connection to IrLMP. This function
+ * must be called after the IrConnect structure is bound to
+ * the stack.
+ *
+ * Parameters: con - pointer to IrConnect structure.
+ *
+ * Return Values: void
+ *)
+
+// IrSetConTypeLMP(con) { ((con)->flags &= ~LCON_FLAGS_TTP); }
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: UInt16 IrMaxTxSize(UInt16 refNum,IrConnect* con);
+ *
+ * Description: Returns the maximum size allowed for a transmit packet.
+ * The value returned is only valid for active connections.
+ * The maximum size will vary for each connection and is based
+ * on the negotiated IrLAP parameters and the type of the
+ * connection.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure which represents
+ * an active connection.
+ *
+ * Return Values: Maxmum number of bytes for a transmit packet.
+ *)
+
+function IrMaxTxSize(refNum: UInt16; var con: IrConnect): UInt16; syscall irLibTrapMaxTxSize;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrMaxRxSize(UInt16 refNum,IrConnect* con);
+ *
+ * Description: Returns the maximum size buffer that can be sent by the
+ * the other device. The value returned is only valid for
+ * active connections. The maximum size will vary for
+ * each connection and is based on the negotiated IrLAP
+ * parameters and the type of the connection.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * con - pointer to IrConnect structure which represents
+ * an active connection.
+ *
+ * Return Values: Maxmum number of bytes that can be sent by the other
+ * device (maximum bytes that can be received).
+ *)
+
+function IrMaxRxSize(refNum: UInt16; var con: IrConnect): UInt16; syscall irLibTrapMaxRxSize;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrSetDeviceInfo(UInt16 refNum,UInt8 *info,UInt8 len);
+ *
+ * Description: Set the XID info string used during discovery to the given
+ * string and length. The XID info string contains hints and
+ * the nickname of the device. The size cannot exceed
+ * IR_MAX_DEVICE_INFO bytes.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * info - pointer to array of bytes
+ *
+ * len - number of bytes pointed to by info
+ *
+ * Return Values: IR_STATUS_SUCCESS - operation is successful.
+ *
+ * IR_STATUS_FAILED - operation failed because info is too
+ * big (Error Checking only).
+ *)
+
+function IrSetDeviceInfo(refNum: UInt16; var info: UInt8; len: UInt8): IrStatus; syscall irLibTrapSetDeviceInfo;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: BOOL IrIsNoProgress(UInt16 refNum);
+ *
+ * Description: Return true if IrLAP is not making progress otherwise
+ * return false (this is an optional function).
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: true if IrLAP is not making progress, false otherwise.
+ *)
+
+function IrIsNoProgress(refNum: UInt16): BOOL; syscall irLibTrapIsNoProgress;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: Boolean IrIsRemoteBusy(UInt16 refNum)
+ *
+ * Description: Return true if the other device's IrLAP is busy otherwise
+ * return false (this is an optional function).
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: true if the other device's IrLAP is busy, false otherwise.
+ *)
+
+function IrIsRemoteBusy(refNum: UInt16): BOOL; syscall irLibTrapIsRemoteBusy;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: BOOL IrIsMediaBusy(UInt16 refNum);
+ *
+ * Description: Return true if the IR media is busy. Otherwise return false
+ * (this is an optional function).
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: true if IR media is busy, false otherwise.
+ *)
+
+function IrIsMediaBusy(refNum: UInt16): BOOL; syscall irLibTrapIsMediaBusy;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: BOOL IrIsIrLapConnected(UInt16 refNum);
+ *
+ * Description: Return true if an IrLAP connection exists (this is an
+ * optional function). Only available if IR_IS_LAP_FUNCS is
+ * defined.
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * Return Values: true if IrLAP is connected, false otherwise.
+ *)
+
+function IrIsIrLapConnected(refNum: UInt16): BOOL; syscall irLibTrapIsIrLapConnected;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IR_TestReq(IrDeviceAddr devAddr,
+ * IrConnect* con,
+ * IrPacket* packet)
+ *
+ * Description: Request a TEST command frame be sent in the NDM state. The
+ * result is signaled via the callback specified in the
+ * IrConnect structure. The callback event is LEVENT_TEST_CNF
+ * and the status field indates the result of the operation.
+ * IR_STATUS_SUCCESS indicates success and IR_STATUS_FAILED
+ * indicates no response was received. A packet must be passed
+ * containing the data to send in the TEST frame. The packet
+ * is returned when the LEVENT_TEST_CNF event is given.
+ *
+ *
+ * Parameters: refNum - ir library refNum
+ *
+ * devAddr - device address of device where TEST will be
+ * sent. This address is not checked so it can be the
+ * broadcast address or 0.
+ *
+ * con - pointer to IrConnect structure specifying the
+ * callback function to call to report the result.
+ *
+ * packet - pointer to a packet that contains the data to
+ * send in the TEST command packet. The maximum size data
+ * that can be sent is IR_MAX_TEST_PACKET. Even if no
+ * data is to be sent a valid packet must be passed.
+ *
+ *
+ * Return Values: IR_STATUS_PENDING - operation has been started successfully
+ * and the result will be returned via the callback function with
+ * the event LEVENT_TEST_CNF. This is also the indication
+ * returning the packet.
+ *
+ * IR_STATUS_FAILED - operation failed because of one of the
+ * reasons below. Note that the packet is
+ * available immediately:
+ * - IrConnect structure is not bound to the stack
+ * - Packet size exceeds maximum allowed.
+ *
+ * IR_STATUS_MEDIA_BUSY - operation failed because the media is
+ * busy or the stack is not in the NDM state (the packet is
+ * available immediately).
+ *)
+
+function IrTestReq(refNum: UInt16; devAddr: IrDeviceAddr; var con: IrConnect; var packet: IrPacket): IrStatus; syscall irLibTrapTestReq;
+
+(****************************************************************************
+ *
+ * Callback Reference
+ *
+ ****************************************************************************)
+
+(*---------------------------------------------------------------------------
+ *
+ * The stack calls the application via a callback function stored in each
+ * IrConnect structure. The callback function is called with a pointer to
+ * the IrConnect structure and a pointer to a parameter structure. The
+ * parameter structure contains an event field which indicates the reason
+ * the callback is called and other parameters which have meaning based
+ * on the event.
+ *
+ * The meaning of the events are as follows:
+ *
+ * LEVENT_LM_CON_IND - Other device has initiated a connection. IR_ConnectRsp
+ * should be called to accept the connection. Any data associated with the
+ * connection request can be found using fields rxBuff and rxLen for the
+ * data pointer and length respectively.
+ *
+ * LEVENT_LM_DISCON_IND - The IrLMP/Tiny TP connection has been disconnected.
+ * Any data associated with the disconnect indication can be found using
+ * fields rxBuff and rxLen for the data pointer and length respectively.
+ *
+ * LEVENT_DATA_IND - Data has been received. The received data is accessed
+ * using fields rxBuff and rxLen;
+ *
+ * LEVENT_PACKET_HANDLED - A packet is being returned. A pointer to the
+ * packet exists in field packet.
+ *
+ * LEVENT_LAP_CON_IND - Indicates that the IrLAP connection has come up. The
+ * callback of all bound IrConnect structures is called.
+ *
+ * LEVENT_LAP_DISCON_IND - Indicates that the IrLAP connection has gone
+ * down. This means that all IrLMP connections are also down. A callback
+ * with event LEVENT_LM_CON_IND will not be given. The callback function
+ * of all bound IrConnect structures is called.
+ *
+ * LEVENT_DISCOVERY_CNF - Indicates the completion of a discovery operation.
+ * The field deviceList points to the discovery list.
+ *
+ * LEVENT_LAP_CON_CNF - The requested IrLAP connection has been made
+ * successfully. The callback function of all bound IrConnect structures
+ * is called.
+ *
+ * LEVENT_LM_CON_CNF - The requested IrLMP/Tiny TP connection has been made
+ * successfully. Connection data from the other side is found using fields
+ * rxBuff and rxLen.
+ *
+ * LEVENT_STATUS_IND - Indicates that a status event from the stack has
+ * occured. The status field indicates the status generating the event.
+ * Possible statuses are as follows. Note this event is optional:
+ * IR_STATUS_NO_PROGRESS - means that IrLAP has no progress for 3 seconds
+ * threshold time (e.g. beam is blocked).
+ *
+ * IR_STATUS_LINK_OK - indicates that the no progress condition has
+ * cleared.
+ *
+ * IR_STATUS_MEDIA_NOT_BUSY - indicates that the IR media has
+ * transitioned from busy to not busy.
+ *
+ * LEVENT_TEST_IND - Indicates that a TEST command frame has been received.
+ * A pointer to the received data is in rxBuff and rxLen. A pointer to the
+ * packet that will be sent in response to the test command is in the packet
+ * field. The packet is currently setup to respond with the same data sent
+ * in the command TEST frame. If different data is desired as a response
+ * then modify the packet structure. This event is sent to the callback
+ * function in all bound IrConnect structures. The IAS connections ignore
+ * this event.
+ *
+ * LEVENT_TEST_CNF - Indicates that a TEST command has completed. The status
+ * field indicates if the test was successful. IR_STATUS_SUCCESS indicates
+ * that operation was successful and the data in the test response can be
+ * found by using the rxBuff and rxLen fields. IR_STATUS_FAILED indicates
+ * that no TEST response was received. The packet passed to perform the test
+ * command is passed back in the packet field and is now available (no
+ * separate packet handled event will occur).
+ *)
+(* The following functions are used to extract U16 and U32 bit numbers
+ * from an IAS result. Only IasGetU16 is used internal by the stack
+ * but they are part of some of the IAS Query result macros. To enable
+ * the function versions define IR_IAS_GET_AS_FUNC
+ *)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrIAS_Add(UInt16 refNum,IrIasObject* obj)
+ *
+ * Description: Add an IAS Object to the IAS Database. The Object is
+ * is not copied so the memory for the object must exist
+ * for as long as the object is in the data base. The
+ * IAS database is designed to only allow objects with unique
+ * class names. The error checking version checks for this.
+ * Class names and attributes names must not exceed
+ * IR_MAX_IAS_NAME. Also attribute values must not exceed
+ * IR_MAX_IAS_ATTR_SIZE.
+ *
+ * Parameters: refNum - ir library reference number
+ *
+ * obj - pointer to an IrIasObject structure.
+ *
+ * Return Values: IR_STATUS_SUCCESS - operation is successful.
+ *
+ * IR_STATUS_FAILED - operation failed for one of the
+ * following reasons:
+ * - No space in the data base (see irconfig.h to
+ * increase the size of the IAS database).
+ * - An entry with the same class name already exists.
+ * Error check only.
+ * - The attributes of the object violate the IrDA Lite
+ * rules (attribute name exceeds IR_MAX_IAS_NAME or
+ * attribute value exceeds IR_MAX_IAS_ATTR_SIZE).
+ * Error check only.
+ * - The class name exceeds IR_MAX_IAS_NAME. Error check
+ * only
+ *)
+
+function IrIAS_Add(refNum: UInt16; var obj: IrIasObject): IrStatus; syscall irLibTrapIAS_Add;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrIAS_Query(UInt16 refNum,IrIasQuery* token)
+ *
+ * Description: Make an IAS query of another devices IAS database. An IrLAP
+ * connection must exist to the other device. The IAS query
+ * token must be initialized as described below. The result is
+ * signaled by calling the callback function whose pointer
+ * exists in the IrIasQuery structure. Only one Query can be
+ * made at a time.
+ *
+ * Parameters: refNum - ir library reference number
+ *
+ * token - pointer to an IrIasQuery structure initialized
+ * as follows:
+ * - pointer to a callback function in which the result will
+ * signaled.
+ * - result points to a buffer large enough to hold the
+ * result of the query.
+ * - resultBufSize is set to the size of the result buffer.
+ * - queryBuf must point to a valid query.
+ * - queryLen is set to the number of bytes in queryBuf.
+ * The length must not exceed IR_MAX_QUERY_LEN.
+ *
+ * Return Values: IR_STATUS_PENDING - operation is started successfully and
+ * the result will be signaled via the calback function.
+ *
+ * IR_STATUS_FAILED - operation failed for one of the
+ * following reasons (Error check only):
+ * - The query exceeds IR_MAX_QUERY_LEN.
+ * - The result field of token is 0.
+ * - The resultBuffSize field of token is 0.
+ * - The callback field of token is 0.
+ * - A query is already in progress.
+ *
+ * IR_STATUS_NO_IRLAP - operation failed because there is no
+ * IrLAP connection.
+ *)
+
+function IrIAS_Query(refNum: UInt16; var token: IrIasQuery): IrStatus; syscall irLibTrapIAS_Query;
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrStatus IrIAS_SetDeviceName(UInt16 refNum,UInt8 *name, UInt8 len)
+ *
+ * Description: Set the value field of the device name attribute of the
+ * "Device" object in the IAS Database. This function is only
+ * available if IR_IAS_DEVICE_NAME is defined.
+ *
+ * Parameters: name - pointer to an IAS value field for the device name
+ * attribute of the device object. It includes the attribute
+ * type, character set and device name. This value field should
+ * be a constant and the pointer must remain valid until
+ * IRIAS_SetDeviceName() is called with another pointer.
+ *
+ * len - total length of the value field. Maximum size allowed
+ * is IR_MAX_IAS_ATTR_SIZE.
+ *
+ * Return Values: IR_STATUS_SUCCESS - operation is successful.
+ *
+ * IR_STATUS_FAILED - len is too big or the value field is not
+ * a valid user string (Error Checking only).
+ *)
+
+function IrIAS_SetDeviceName(refNum: UInt16; var name: UInt8; len: UInt8): IrStatus; syscall irLibTrapIAS_SetDeviceName;
+
+(*---------------------------------------------------------------------------
+ *
+ * Below are some functions and macros for parsing the results buffer
+ * after a successfull IAS Query.
+ *)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: void IrIAS_StartResult(IrIasQuery* token)
+ *
+ * Description: Put the internal pointer to the start of the
+ * result buffer.
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: void
+ *)
+
+// IrIAS_StartResult(t) ((t)->offset = 0)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U16 IRIAS_GetObjectID(IrIasQuery* token)
+ *
+ * Description: Return the unique object ID of the current result item.
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: object ID
+ *)
+
+// IrIAS_GetObjectID(t) IasGetU16((t)->result + (t)->offset)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U8 IrIAS_GetType(IrIasQuery* token)
+ *
+ * Description: Return the type of the current result item
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Type of result item such as IAS_ATTRIB_INTEGER,
+ * IAS_ATTRIB_OCTET_STRING or IAS_ATTRIB_USER_STRING.
+ *)
+
+// IrIAS_GetType(t) ((t)->result[(t)->offset + 2])
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U32 IrIAS_GetInteger(IrIasQuery* token)
+ *
+ * Description: Return an integer value assuming that the current result
+ * item is of type IAS_ATTRIB_INTEGER (call IRIAS_GetType() to
+ * determine the type of the current result item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Integer value.
+ *)
+
+// IrIAS_GetInteger(t) IasGetU32((t)->result + (t)->offset + 3)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U8 IrIAS_GetIntLsap(IrIasQuery* token)
+ *
+ * Description: Return an integer value that represents an LSAP assuming
+ * that the current result item is of type IAS_ATTRIB_INTEGER
+ * (call IRIAS_GetType() to determine the type of the current
+ * result item). Usually integer values returned in a query
+ * are LSAP selectors.
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Integer value.
+ *)
+
+// IrIAS_GetIntLsap(t) ((t)->result[(t)->offset + 6])
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U16 IrIAS_GetOctetStringLen(IrIasQuery* token)
+ *
+ * Description: Get the length of an octet string assuming that the current
+ * result item is of type IAS_ATTRIB_OCTET_STRING (call
+ * IRIAS_GetType() to determine the type of the current result
+ * item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Length of octet string
+ *)
+
+// IrIAS_GetOctetStringLen(t) IasGetU16((t)->result + (t)->offset + 3)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U8* IrIAS_GetOctetString(IrIasQuery* token)
+ *
+ * Description: Return a pointer to an octet string assuming that the
+ * current result item is of type IAS_ATTRIB_OCTET_STRING (call
+ * IRIAS_GetType() to determine the type of the current result
+ * item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: pointer to octet string
+ *)
+
+// IrIAS_GetOctetString(t) ((t)->result + (t)->offset + 5)
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U8 IrIAS_GetUserStringLen(IrIasQuery* token)
+ *
+ * Description: Return the length of a user string assuming that the
+ * current result item is of type IAS_ATTRIB_USER_STRING (call
+ * IRIAS_GetType() to determine the type of the current result
+ * item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Length of user string
+ *)
+
+// IrIAS_GetUserStringLen(t) ((t)->result[(t)->offset + 4])
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: IrCharSet IrIAS_GetUserStringCharSet(IrIasQuery* token)
+ *
+ * Description: Return the character set of the user string assuming that
+ * the current result item is of type IAS_ATTRIB_USER_STRING
+ * (call IRIAS_GetType() to determine the type of the current
+ * result item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Character set
+ *)
+
+// IrIAS_GetUserStringCharSet(t) ((t)->result[(t)->offset + 3])
+
+(*---------------------------------------------------------------------------
+ *
+ * Prototype: U8* IrIAS_GetUserString(IrIasQuery* token)
+ *
+ * Description: Return a pointer to a user string assuming that the
+ * current result item is of type IAS_ATTRIB_USER_STRING (call
+ * IRIAS_GetType() to determine the type of the current result
+ * item).
+ *
+ * Parameters: token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Pointer to result string
+ *)
+
+// IrIAS_GetUserString(t) ((t)->result + (t)->offset + 5)
+
+ (*---------------------------------------------------------------------------
+ *
+ * Prototype: UInt8 *IrIAS_Next(UInt16 refNum,IrIasQuery* token)
+ *
+ * Description: Move the internal pointer to the next result item. This
+ * function returns a pointer to the start of the next result
+ * item. If the poiinter is 0 then there are no more result
+ * items. Only available if IR_IAS_NEXT is defined.
+ *
+ * Parameters: refNum - library reference number
+ *
+ * token - pointer to an IrIasQuery structure
+ *
+ * Return Values: Pointer to the next result item or 0 if no more items.
+ *)
+
+function IrIAS_Next(refNum: UInt16; var token: IrIasQuery): UInt8Ptr; syscall irLibTrapIAS_Next;
+
+(****************************************************************************
+ *
+ * IAS Callback Reference
+ *
+ ****************************************************************************)
+
+(*---------------------------------------------------------------------------
+ *
+ * The result of IAS query is signaled by calling the callback function
+ * pointed to by the callBack field of IrIasQuery structure. The callback
+ * has the following prototype:
+ *
+ * void callBack(IrStatus);
+ *
+ * The callback is called with a status as follows:
+ *
+ * IR_STATUS_SUCCESS - the query operation finished successfully and
+ * the results can be parsed
+ *
+ * IR_STATUS_DISCONNECT - the link or IrLMP connection was disconnected
+ * during the query so the results are not valid.
+
+=========================================================================== *)
+
+// The following two functions are only for advances uses - do not use these.
+
+ (*---------------------------------------------------------------------------
+ *
+ * Prototype: IrHandleEvent(UInt16 refnum)
+ *
+ * Description: MemHandle background task event (ony used for special cases)
+ * Normally you will not use this function
+ *
+ * Parameters: refNum - library reference number
+ **
+ * Return Values: Pointer to the next result item or 0 if no more items.
+ *)
+
+function IrHandleEvent(refnum: UInt16): Boolean; syscall irLibTrapHandleEvent;
+
+ (*---------------------------------------------------------------------------
+ *
+ * Prototype: IrWaitForEvent(UInt16 libRefnum,Int32 timeout)
+ *
+ * Description: Wait for background task event (ony used for special cases)
+ * Normally you will not use this function
+ *
+ * Parameters: refNum - library reference number
+ *
+ * timeout - number of ticks to wait
+ *
+ * Return Values: Pointer to the next result item or 0 if no more items.
+ *)
+
+function IrWaitForEvent(libRefnum: UInt16; timeout: Int32): Err; syscall irLibTrapWaitForEvent;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/keyboard.pp b/packages/palmunits/src/keyboard.pp
new file mode 100644
index 0000000000..cab9505aae
--- /dev/null
+++ b/packages/palmunits/src/keyboard.pp
@@ -0,0 +1,90 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Keyboard.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the keyboard's structures
+ * and routines.
+ *
+ * History:
+ * March 29, 1995 Created by Roger Flores
+ *
+ *****************************************************************************)
+
+unit keyboard;
+
+interface
+
+uses palmos, coretraps, rect, chars, window, control;
+
+const
+ kbdReturnKey = linefeedChr;
+ kbdTabKey = tabChr;
+ kbdBackspaceKey = backspaceChr;
+ kbdShiftKey = 2;
+ kbdCapsKey = 1;
+ kbdNoKey = $ff;
+
+type
+ KeyboardType = Enum;
+
+const
+ kbdAlpha = 0;
+ kbdNumbersAndPunc = 1;
+ kbdAccent = 2;
+ kbdDefault = $ff; // based on graffiti mode (usually alphaKeyboard)
+
+type
+ KeyboardStatus = record
+ end;
+ KeyboardStatusPtr = ^KeyboardStatus;
+
+// Shift state flags
+const
+ KeyboardShiftFlag = $0001;
+ KeyboardCapslockFlag = $0002;
+
+(************************************************************
+ * Keyboard procedures
+ *************************************************************)
+
+// At some point the Graffiti code will need access to the
+// shift and caps lock info. Either export the structures
+// or provide calls to the info.
+
+procedure SysKeyboardDialogV10; syscall sysTrapSysKeyboardDialogV10;
+
+procedure SysKeyboardDialog(kbd: KeyboardType); syscall sysTrapSysKeyboardDialog;
+
+function KeyboardStatusNew(keyboardID: UInt16): KeyboardStatusPtr; syscall sysTrapKeyboardStatusNew;
+
+procedure KeyboardStatusFree(ks: KeyboardStatusPtr); syscall sysTrapKeyboardStatusFree;
+
+procedure KbdSetLayout(ks: KeyboardStatusPtr; layout: UInt16); syscall sysTrapKbdSetLayout;
+
+function KbdGetLayout(const ks: KeyboardStatusPtr): UInt16; syscall sysTrapKbdGetLayout;
+
+procedure KbdSetPosition(ks: KeyboardStatusPtr; const p: PointPtr); syscall sysTrapKbdSetPosition;
+
+procedure KbdGetPosition(const ks: KeyboardStatusPtr; p: PointPtr); syscall sysTrapKbdGetPosition;
+
+procedure KbdSetShiftState(ks: KeyboardStatusPtr; shiftState: UInt16); syscall sysTrapKbdSetShiftState;
+
+function KbdGetShiftState(const ks: KeyboardStatusPtr): UInt16; syscall sysTrapKbdGetShiftState;
+
+procedure KbdDraw(ks: KeyboardStatusPtr; keyTopsOnly, ignoreModifiers: Boolean); syscall sysTrapKbdDraw;
+
+procedure KbdErase(ks: KeyboardStatusPtr); syscall sysTrapKbdErase;
+
+function KbdHandleEvent(ks: KeyboardStatusPtr; pEvent: EventPtr): Boolean; syscall sysTrapKbdHandleEvent;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/keymgr.pp b/packages/palmunits/src/keymgr.pp
new file mode 100644
index 0000000000..14ccf288c3
--- /dev/null
+++ b/packages/palmunits/src/keymgr.pp
@@ -0,0 +1,67 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: KeyMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ *
+ *****************************************************************************)
+
+unit keymgr;
+
+interface
+
+uses palmos, coretraps;
+
+(********************************************************************
+ * Definition of bit field returned from KeyCurrentState
+ ********************************************************************)
+
+const
+ keyBitPower = $0001; // Power key
+ keyBitPageUp = $0002; // Page-up
+ keyBitPageDown = $0004; // Page-down
+ keyBitHard1 = $0008; // App #1
+ keyBitHard2 = $0010; // App #2
+ keyBitHard3 = $0020; // App #3
+ keyBitHard4 = $0040; // App #4
+ keyBitCradle = $0080; // Button on cradle
+ keyBitAntenna = $0100; // Antenna "key" <chg 3-31-98 RM>
+ keyBitContrast = $0200; // Contrast key
+
+ keyBitsAll = $FFFFFFFF; // all keys
+
+ slowestKeyDelayRate = $ff;
+ slowestKeyPeriodRate = $ff;
+
+(********************************************************************
+ * Key manager Routines
+ ********************************************************************)
+
+// Set/Get the auto-key repeat rate
+function KeyRates(set_: Boolean; var initDelayP, periodP, doubleTapDelayP: UInt16;
+ var queueAheadP: Boolean): Err; syscall sysTrapKeyRates;
+
+// Get the current state of the hardware keys
+// This is now updated every tick, even when more than 1 key is held down.
+function KeyCurrentState: UInt32; syscall sysTrapKeyCurrentState;
+
+// Set the state of the hardware key mask which controls if the key
+// generates a keyDownEvent
+function KeySetMask(keyMask: UInt32): UInt32; syscall sysTrapKeySetMask;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/launcher.pp b/packages/palmunits/src/launcher.pp
new file mode 100644
index 0000000000..6919556d3a
--- /dev/null
+++ b/packages/palmunits/src/launcher.pp
@@ -0,0 +1,38 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Launcher.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * These are the routines for the launcher.
+ *
+ * History:
+ * April 27, 1995 Created by Roger Flores
+ * July 21, 2000 Deleted (mostly) by Bob Ebert, old launcher dialog not supported
+ *
+ *****************************************************************************)
+
+unit launcher;
+
+interface
+
+uses coretraps;
+
+(************************************************************
+ * Launcher procedures
+ *************************************************************)
+
+// We're leaving the trap in place for now, but it just does a SysUIAppSwitch to
+// launch the real launcher. --Bob 21-Jul-00
+
+procedure SysAppLauncherDialog; syscall sysTrapSysAppLauncherDialog;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/libtraps.pp b/packages/palmunits/src/libtraps.pp
new file mode 100644
index 0000000000..c50965a0e2
--- /dev/null
+++ b/packages/palmunits/src/libtraps.pp
@@ -0,0 +1,45 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: LibTraps.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Palm OS Shared Library 'default' traps.
+ *
+ * History:
+ * 7/15/99 Created by Bob Ebert
+ * mm/dd/yy initials - brief revision comment
+ *
+ *****************************************************************************)
+
+unit libtraps;
+
+interface
+
+uses palmos;
+
+//--------------------------------------------------------------------
+// Define Library Trap Numbers
+//--------------------------------------------------------------------
+// Library traps start here and go up by 1's
+const
+ sysLibTrapBase = $A800;
+
+type
+ SysLibTrapNumber = WordEnum;
+
+const
+ sysLibTrapName = sysLibTrapBase;
+ sysLibTrapOpen = Succ(sysLibTrapName);
+ sysLibTrapClose = Succ(sysLibTrapOpen);
+ sysLibTrapSleep = Succ(sysLibTrapClose);
+ sysLibTrapWake = Succ(sysLibTrapSleep);
+ sysLibTrapCustom = Succ(sysLibTrapWake);
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/list.pp b/packages/palmunits/src/list.pp
new file mode 100644
index 0000000000..c81e02fb0f
--- /dev/null
+++ b/packages/palmunits/src/list.pp
@@ -0,0 +1,117 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: List.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines list structures and routines.
+ *
+ * History:
+ * November 3, 1994 Created by Roger Flores
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 2/9/99 fixed const stuff
+ *
+ *****************************************************************************)
+
+unit list;
+
+interface
+
+uses palmos, coretraps, rect, font, window, control;
+
+const
+ noListSelection = -1;
+
+//-------------------------------------------------------------------
+// List structures
+//-------------------------------------------------------------------
+
+type
+ ListAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 usable :1; // set if part of ui
+ UInt16 enabled :1; // set if interactable (not grayed out)
+ UInt16 visible :1; // set if drawn
+ UInt16 poppedUp :1; // set if choices displayed in popup win.
+ UInt16 hasScrollBar:1; // set if the list has a scroll bar
+ UInt16 search :1; // set if incremental search is enabled
+ UInt16 reserved :2;
+}
+ {$endif}
+ end;
+ ListAttrTag = ^ListAttrType;
+
+// Load data callback routine prototype
+type
+ ListDrawDataFuncType = procedure (itemNum: Int16; bounds: RectanglePtr; var itemsText: PChar);
+ ListDrawDataFuncPtr = ListDrawDataFuncType;
+
+type
+ ListType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
+ id: UInt16;
+ bounds: RectangleType;
+ attr: ListAttrType;
+ itemsText: ^PChar;
+ numItems: Int16; // number of choices in the list
+ currentItem: Int16; // currently display choice
+ topItem: Int16; // top item visible when poped up
+ font: FontID; // font used to draw list
+ reserved: UInt8;
+ popupWin: WinHandle; // used only by popup lists
+ drawItemsCallback: ListDrawDataFuncPtr; // 0 indicates no function
+ {$endif}
+ end;
+ ListPtr = ^ListType;
+
+//-------------------------------------------------------------------
+// List routines
+//-------------------------------------------------------------------
+
+procedure LstDrawList(listP: ListPtr); syscall sysTrapLstDrawList;
+
+procedure LstEraseList(listP: ListPtr); syscall sysTrapLstEraseList;
+
+function LstGetSelection(const listP: ListPtr): Int16; syscall sysTrapLstGetSelection;
+
+function LstGetSelectionText(const listP: ListPtr; itemNum: Int16): PChar; syscall sysTrapLstGetSelectionText;
+
+function LstHandleEvent(listP: ListPtr; const eventP: EventPtr): Boolean; syscall sysTrapLstHandleEvent;
+
+procedure LstSetHeight(listP: ListPtr; visibleItems: Int16); syscall sysTrapLstSetHeight;
+
+procedure LstSetPosition(listP: ListPtr; x, y: Coord); syscall sysTrapLstSetPosition;
+
+procedure LstSetSelection(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetSelection;
+
+procedure LstSetListChoices(listP: ListPtr; var itemsText: PChar; numItems: Int16); syscall sysTrapLstSetListChoices;
+
+procedure LstSetDrawFunction(listP: ListPtr; func: ListDrawDataFuncPtr); syscall sysTrapLstSetDrawFunction;
+
+procedure LstSetTopItem(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetTopItem;
+
+procedure LstMakeItemVisible(listP: ListPtr; itemNum: Int16); syscall sysTrapLstMakeItemVisible;
+
+function LstGetNumberOfItems(const listP: ListPtr): Int16; syscall sysTrapLstGetNumberOfItems;
+
+function LstPopupList(listP: ListPtr): Int16; syscall sysTrapLstPopupList;
+
+function LstScrollList(listP: ListPtr; direction: WinDirectionType; itemCount: Int16): Boolean; syscall sysTrapLstScrollList;
+
+function LstGetVisibleItems(const listP: ListPtr): Int16; syscall sysTrapLstGetVisibleItems;
+
+function LstNewList(formPP: PointerPtr; id: UInt16; x, y, width, height: Coord;
+ font: FontID; visibleItems, triggerId: Int16): Err; syscall sysTrapLstNewList;
+
+function LstGetTopItem(const listP: ListPtr): Int16; syscall sysTrapLstGetTopItem;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/localemgr.pp b/packages/palmunits/src/localemgr.pp
new file mode 100644
index 0000000000..cc2fceb937
--- /dev/null
+++ b/packages/palmunits/src/localemgr.pp
@@ -0,0 +1,237 @@
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: LocaleMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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).
+ *
+ *****************************************************************************)
+unit localemgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+// Supporting lmChoiceLanguageName would add over 3K to the 'locs' resource.
+// DOLATER CS - either do it or punt.
+
+const
+ SUPPORT_LANGUAGE_NAME = 0;
+
+(***********************************************************************
+ * Locale Manager errors
+ **********************************************************************)
+
+// Locale not found in 'locs' resource.
+
+const
+ lmErrUnknownLocale = lmErrorClass or 1;
+
+// Locale index >= LmGetNumLocales().
+
+ lmErrBadLocaleIndex = lmErrorClass or 2;
+
+// LmLocaleSettingChoice out of bounds.
+
+ lmErrBadLocaleSettingChoice = lmErrorClass or 3;
+
+// Data for locale setting too big for destination.
+
+ lmErrSettingDataOverflow = lmErrorClass or 4;
+
+(***********************************************************************
+ * Locale Manager settings (pass to LmGetLocaleSetting)
+ **********************************************************************)
+
+type
+ LmLocaleSettingChoice = UInt16;
+
+// LmLocaleType
+
+const
+ lmChoiceLocale = LmLocaleSettingChoice(1);
+
+// Char[kMaxLanguageNameLen+1] - Name of the language spoken there (localized)
+
+const
+ lmChoiceLanguageName = LmLocaleSettingChoice(4);
+
+// Char[kMaxCountryNameLen+1] - Name of the country (localized)
+
+ lmChoiceCountryName = LmLocaleSettingChoice(5);
+
+// DateFormatType
+
+ lmChoiceDateFormat = LmLocaleSettingChoice(6);
+
+// DateFormatType
+
+ lmChoiceLongDateFormat = LmLocaleSettingChoice(7);
+
+// TimeFormatType
+
+ lmChoiceTimeFormat = LmLocaleSettingChoice(8);
+
+// UInt16 - Weekday for calendar column 1 (sunday=0, monday=1, etc.)
+
+ lmChoiceWeekStartDay = LmLocaleSettingChoice(9);
+
+// Int16 - Default GMT offset minutes, + for east of GMT, - for west
+
+ lmChoiceTimeZone = LmLocaleSettingChoice(10);
+
+// NumberFormatType - Specifies decimal and thousands separator characters
+
+ lmChoiceNumberFormat = LmLocaleSettingChoice(11);
+
+// Char[kMaxCurrencyNameLen+1] - Name of local currency (e.g., "US Dollar")
+
+ lmChoiceCurrencyName = LmLocaleSettingChoice(12);
+
+// Char[kMaxCurrencySymbolLen+1] - Currency symbol (e.g., "$")
+
+ lmChoiceCurrencySymbol = LmLocaleSettingChoice(13);
+
+// Char[kMaxCurrencySymbolLen+1] - Unique currency symbol (e.g., "US$")
+
+ lmChoiceUniqueCurrencySymbol = LmLocaleSettingChoice(14);
+
+// UInt16 - Number of decimals for currency (e.g., 2 for $10.12)
+
+ lmChoiceCurrencyDecimalPlaces = LmLocaleSettingChoice(15);
+
+// MeasurementSystemType - Metric, English, etc.
+
+ lmChoiceMeasurementSystem = LmLocaleSettingChoice(16);
+
+(***********************************************************************
+ * Locale Manager constants
+ **********************************************************************)
+
+const
+ lmAnyCountry = Word(65535); // Pass LmLocaleToIndex's iLocale
+ lmAnyLanguage = Word(65535); // Pass LmLocaleToIndex's iLocale
+
+const
+ kMaxCountryNameLen = 19;
+ kMaxLanguageNameLen = 19;
+ kMaxCurrencyNameLen = 19;
+ kMaxCurrencySymbolLen = 5;
+
+(***********************************************************************
+ * Selectors & macros used for calling Locale Manager routines
+ **********************************************************************)
+
+// Selectors used for getting to the right Locale Manager routine via
+// the LmDispatch trap.
+
+// DOLATER:jwm: remove me after fixing LocaleMgr.c:PrvSelectorError
+type
+ LmRoutineSelector = UInt16;
+
+const
+ lmInit = 0;
+ lmGetNumLocales_ = 1;
+ lmLocaleToIndex_ = 2;
+ lmGetLocaleSetting_ = 3;
+
+const
+ lmMaxRoutineSelector = lmGetLocaleSetting_;
+
+(***********************************************************************
+ * Locale Manager types
+ **********************************************************************)
+
+type
+ LanguageType = UInt8;
+ CountryType = UInt8;
+
+ _LmLocaleType = record
+ language: UInt16; // Language spoken in locale (LanguageType)
+ country: UInt16; // Specifies "dialect" of language (CountryType)
+ end;
+ LmLocaleType = _LmLocaleType;
+ LmLocalePtr = ^LmLocaleType;
+
+(***********************************************************************
+ * Locale Manager routines
+ **********************************************************************)
+
+// Return the number of known locales (maximum locale index + 1).
+
+function LmGetNumLocales: UInt16; // syscall sysTrapLmDispatch, lmGetNumLocales_;
+
+// Convert <iLocale> to <oLocaleIndex> by locating it within the set of known
+// locales.
+
+function LmLocaleToIndex({const} var iLocale: LmLocaleType; var oLocaleIndex: UInt16): Err; // syscall sysTrapLmDispatch, 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.
+
+function LmGetLocaleSetting(iLocaleIndex: UInt16; iChoice: LmLocaleSettingChoice;
+ oValue: Pointer; iValueSize: UInt16): Err; // syscall sysTrapLmDispatch, lmGetLocaleSetting_;
+
+implementation
+
+function __LmGetNumLocales: UInt16; syscall sysTrapLmDispatch;
+function __LmLocaleToIndex(var iLocale: LmLocaleType; var oLocaleIndex: UInt16): Err; syscall SysTrapLmDispatch;
+function __LmGetLocaleSetting(iLocaleIndex: UInt16; iChoice: LmLocaleSettingChoice;
+ oValue: Pointer; iValueSize: UInt16): Err; syscall sysTrapLmDispatch;
+
+function LmGetNumLocales: UInt16; // syscall sysTrapLmDispatch, lmGetNumLocales_;
+begin
+ asm
+ move.l #$lmGetNumLocales_, d2;
+ end;
+ LmGetNumLocales := __LmGetNumLocales;
+end;
+
+function LmLocaleToIndex({const} var iLocale: LmLocaleType; var oLocaleIndex: UInt16): Err; // syscall sysTrapLmDispatch, lmLocaleToIndex_;
+begin
+ asm
+ MOVE.L #$lmLocaleToIndex_, d2;
+ end;
+ LmLocaleToIndex := __LmLocaleToIndex(iLocale, oLocaleIndex);
+end;
+
+function LmGetLocaleSetting(iLocaleIndex: UInt16; iChoice: LmLocaleSettingChoice;
+ oValue: Pointer; iValueSize: UInt16): Err; // syscall sysTrapLmDispatch, lmGetLocaleSetting_;
+begin
+ asm
+ MOVE.L #$lmGetLocaleSetting_, d2;
+ end;
+ LmGetLocaleSetting := __LmGetLocaleSetting(iLocaleIndex, iChoice, oValue, iValueSize);
+end;
+
+end.
diff --git a/packages/palmunits/src/localize.pp b/packages/palmunits/src/localize.pp
new file mode 100644
index 0000000000..1ddad29738
--- /dev/null
+++ b/packages/palmunits/src/localize.pp
@@ -0,0 +1,40 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Localize.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Functions to localize data.
+ *
+ * History:
+ * 8/28/96 Roger - Initial version
+ *
+ *****************************************************************************)
+
+unit localize;
+
+interface
+
+uses palmos, coretraps;
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+type
+ NumberFormatType = Enum;
+
+const
+ nfCommaPeriod = 0;
+ nfPeriodComma = Succ(nfCommaPeriod);
+ nfSpaceComma = Succ(nfPeriodComma);
+ nfApostrophePeriod = Succ(nfSpaceComma);
+ nfApostropheComma = Succ(nfApostrophePeriod);
+
+procedure LocGetNumberSeparators(numberFormat: NumberFormatType; thousandSeparator, decimalSeparator: PChar); syscall sysTrapLocGetNumberSeparators;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/lz77mgr.pp b/packages/palmunits/src/lz77mgr.pp
new file mode 100644
index 0000000000..951a8ad00d
--- /dev/null
+++ b/packages/palmunits/src/lz77mgr.pp
@@ -0,0 +1,171 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2001 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Lz77Mgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * History:
+ * 11/01/99 Created by Michel Turcotte
+ * Initial revision based on InetLib
+ *
+ *****************************************************************************)
+
+unit lz77mgr;
+
+interface
+
+uses palmos, libtraps, errorbase, systemresources;
+
+//
+// Common PalmOS and Windows section
+//
+
+const
+ Lz77VerID = 1;
+ Lz77LastSupportedVerID = 1;
+
+ lz77Compress = True;
+ lz77Expand = False;
+
+type
+ Lz77ErrorType = Err;
+
+(********************************************************************
+ * Error codes
+ ********************************************************************)
+
+const
+ lz77Success = $00;
+ // Non Fatal Errors
+ lz77ErrNonFatalFirstErr = lz77ErrorClass or $00;
+ lz77ErrNonFatalInputBufferIncomplete = lz77ErrorClass or $01;
+ lz77ErrNonFatalOutputBufferFull = lz77ErrorClass or $02;
+ lz77ErrNonFatalLastErr = lz77ErrorClass or $7F;
+ // Fatal Errors
+ lz77ErrFatalFirstErr = lz77ErrorClass or $80;
+ lz77ErrFatalUnfinishedInputBuffer = lz77ErrorClass or $80;
+ lz77ErrFatalInputBufferIncomplete = lz77ErrorClass or $81;
+ lz77ErrFatalInputBufferInvalid = lz77ErrorClass or $82;
+ lz77ErrFatalMemAllocation = lz77ErrorClass or $83;
+ lz77ErrFatalHandleInvalid = lz77ErrorClass or $84;
+ lz77ErrFatalCantChangeToCompress = lz77ErrorClass or $85;
+ lz77ErrFatalUnknownVersion = lz77ErrorClass or $86;
+ lz77ErrFatalOutputBufferTooSmall = lz77ErrorClass or $87;
+ lz77ErrFatalInvalidArgument = lz77ErrorClass or $88;
+ lz77ErrFatalLastErr = lz77ErrorClass or $FF;
+
+function lz77ErrIsFatal(err: Lz77ErrorType): Boolean;
+
+//
+// Specific PalmOS section
+//
+
+// Creator. Used for both the database that contains the LZ77 Library and
+// it's features for the feature manager.
+const
+ lz77Creator = sysFileCLz77Lib; // Lz77 Library creator
+ lz77LibName = 'Lz77.lib'; // pass in to SysLibFind()
+
+(********************************************************************
+ * LZ77 Library functions.
+ ********************************************************************)
+
+const
+ lz77LibTrapChunk = sysLibTrapCustom;
+ lz77LibTrapMaxBufferSize = sysLibTrapCustom + 1;
+ lz77LibTrapBufferGetInfo = sysLibTrapCustom + 2;
+ lz77LibTrapBufferSetInfo = sysLibTrapCustom + 3;
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+
+function Lz77LibOpen(
+ libRefnum: UInt16; // Palm OS reference calling number
+ var lz77HandleP: MemHandle; // <- Pointer to returning LZ77 handle (NULL for error)
+ compressFlag: Boolean; // -> TRUE = Compress; FALSE = Expand
+ sourceSize: UInt32; // -> Source size in bytes
+ var destHP: MemHandle; // <-> If (*destHP != NULL) => use pre allocated memory
+ // (*destHP and *destSizeP)
+ // If (*destHP == NULL) => allocate memory in *destHP
+ var destSizeP: UInt32; // <-> If (*destSizeP ==0) THEN *destP must be NULL
+ // => Lz77Open will calculate maximum buffer size
+ // based on compressFlag and sourceSize
+ // If (*destSizeP !=0) THEN it indicate
+ // the size in bytes of the destination buffer
+ useVerNum: UInt16; // -> if (useVerNum !=0) THEN Use Version numbering
+ // (Compress will write the value useVerNum in the
+ // output buffer Expand will verify if the Version
+ // in the source buffer is compatible)
+ var primerP: UInt8; // -> if (compressFlag ==lz77Compress)
+ // UncompressPrimer buffer pointer
+ // else CompressPrimer buffer pointer
+ // Must be valid compressed lz77 data
+ // compressed without a primer.
+ // NULL means no primer
+ primerL: UInt32; // -> Byte length of primer
+ processedPrimerL: UInt32 // -> Byte length of processed primer
+ ): Err; syscall sysLibTrapOpen;
+ // Note: The output buffer must be large enough to include the emtire processed primer.
+ // When Expanding, the compressed primer is passed to the Open routine and
+ // the output buffer must be large enough to contain the expanded primer.
+
+function Lz77LibClose(
+ libRefnum: UInt16; // Palm OS reference calling number
+ lz77Handle: MemHandle; // -> Lz77 Handle
+ var ResultingSizeP: UInt32 // <- Size in bytes of output generated buffer
+ // Output buffer will be resized to the resulting size
+ // if Lz77Open have allocated the output buffer.
+ // Output buffer must be free by the calling application
+ ): Err; syscall sysLibTrapClose;
+
+function Lz77LibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
+
+function Lz77LibWake(libRefnum: UInt16): Err; syscall sysLibTrapWake;
+
+function Lz77LibChunk(
+ libRefnum: UInt16; // Palm OS reference calling number
+ lz77Handle: MemHandle; // -> Lz77 Handle
+ var sourceP: Int8; // -> Source buffer pointer
+ sourceSize: UInt32; // -> Source buffer Size (bytes)
+ var sourceBitReadOffset: UInt32 // <-> Next bit to read from source
+ ): Err; syscall lz77LibTrapChunk;
+
+function Lz77LibMaxBufferSize(
+ libRefnum: UInt16; // Palm OS reference calling number
+ compressFlag: Boolean; // -> TRUE = Compress; FALSE = Expand
+ sourceSize: UInt32; // -> Size of Source buffer
+ var maxBufferSizeP: UInt32 // <- result size pointer
+ ): Err; syscall lz77LibTrapMaxBufferSize;
+
+function Lz77LibBufferGetInfo(
+ libRefnum: UInt16; // Palm OS reference calling number
+ lz77Handle: MemHandle; // -> Lz77 Handle
+ var compressFlagP: Boolean; // <- Get compressFlag (true = compress mode; false = expand mode)
+ var bufferHP: MemHandle; // <- Get the Pointer to the accumulated destination buffer
+ var bufferByteSizeP: UInt32; // <- Get destination buffer size in bytes
+ var destBitOffsetP: UInt32 // <- Get destination bit offset
+ ): Err; syscall lz77LibTrapBufferGetInfo;
+
+function Lz77LibBufferSetInfo(
+ libRefnum: UInt16; // Palm OS reference calling number
+ lz77Handle: MemHandle; // -> Lz77 Handle
+ compressFlag: Boolean; // -> Set compressFlag (true = compress mode; false = expand mode)
+ destH: MemHandle; // -> Set a Pointer to the accumulated destination buffer
+ destByteSize: UInt32; // -> Set destination buffer size in bytes
+ destBitOffset: UInt32 // -> Set destination bit offset
+ ): Err; syscall lz77LibTrapBufferSetInfo;
+
+implementation
+
+function lz77ErrIsFatal(err: Lz77ErrorType): Boolean;
+begin
+ lz77ErrIsFatal := (err <> lz77Success) and ((err < lz77ErrNonFatalFirstErr) or (err > lz77ErrNonFatalLastErr));
+end;
+
+end.
diff --git a/packages/palmunits/src/m68khwr.pp b/packages/palmunits/src/m68khwr.pp
new file mode 100644
index 0000000000..1fc4bdc3a4
--- /dev/null
+++ b/packages/palmunits/src/m68khwr.pp
@@ -0,0 +1,115 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: M68KHwr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Pilot debugger remote hardware/system info
+ *
+ * History:
+ * 1/18/95 RM - Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit m68khwr;
+
+interface
+
+uses palmos;
+
+(***********************************************************************
+ * Breakpoint words we use
+ ***********************************************************************)
+
+const
+ m68kTrapInstr = $4E40;
+ m68kTrapVectorMask = $000F;
+
+(***********************************************************************
+ * 68000 Exception Vector table
+ ***********************************************************************)
+
+type
+ M68KExcTableType = record
+ initStack: UInt32; // initial stack pointer
+ initPC: UInt32; // initial PC
+
+ busErr: UInt32; // 08
+ addressErr: UInt32; // 0C
+ illegalInstr: UInt32; // 10
+ divideByZero: UInt32; // 14
+ chk: UInt32; // 18
+ trap: UInt32; // 1C
+ privilege: UInt32; // 20
+ trace: UInt32; // 24
+ aTrap: UInt32; // 28
+ fTrap: UInt32; // 2C
+ reserved12: UInt32; // 30
+ coproc: UInt32; // 34
+ formatErr: UInt32; // 38
+ unitializedInt: UInt32; // 3C
+
+ reserved: array [0..7] of UInt32; // 40-5C
+
+ spuriousInt: UInt32; // 60
+ autoVec1: UInt32; // 64
+ autoVec2: UInt32; // 68
+ autoVec3: UInt32; // 6C
+ autoVec4: UInt32; // 70
+ autoVec5: UInt32; // 74
+ autoVec6: UInt32; // 78
+ autoVec7: UInt32; // 7C
+
+ trapN: array [0..15] of UInt32; // 80 - BC
+
+ unassigned: array [0..15] of UInt32; // C0 - FC
+ end;
+
+(**************************************************************************************
+ * structure for the Motorolla 68000 processor registers (variables).
+ *
+ * WARNING:
+ * This structure is used as the body of the 'read regs' command response
+ * packet. Any changes to it will require changes in the nub's code.
+ *
+ **************************************************************************************)
+
+ M68KRegsType = record
+ d: array [0..7] of UInt32; // data registers
+ a: array [0..7] of UInt32; // address registers
+ usp: UInt32; // user stack pointer
+ ssp: UInt32; // supervisor stack pointer
+ pc: UInt32; // program counter
+ sr: UInt16; // status register
+ end;
+
+(**************************************************************************************
+ * bit masks for testing M68000 status register fields
+ **************************************************************************************)
+
+// trace mode
+const
+ m68kSrTraceMask = $08000;
+ m68kSrTraceBit = 15;
+
+// supervisor state
+ m68kSrSupervisorMask = $02000;
+
+// interrupt mask
+ m68kSrInterruptMask = $00700;
+ m68kSrInterruptOffset = 8; // offset for right-shifting interrupt mask
+
+// condition codes
+ m68kSrExtendMask = $00010;
+ m68kSrNegativeMask = $00008;
+ m68kSrZeroMask = $00004;
+ m68kSrOverflowMask = $00002;
+ m68kSrCarryMask = $00001;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/memorymgr.pp b/packages/palmunits/src/memorymgr.pp
new file mode 100644
index 0000000000..8139840686
--- /dev/null
+++ b/packages/palmunits/src/memorymgr.pp
@@ -0,0 +1,259 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: MemoryMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Memory Manager
+ *
+ * History:
+ * 10/25/94 RM Created by Ron Marianetti
+ * 10/28/99 kwk Added memErrROMOnlyCard.
+ *
+ *****************************************************************************)
+
+unit memorymgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * Memory Manager Types
+ *************************************************************)
+
+type
+ LocalIDKind = Enum;
+
+const
+ memIDPtr = 0;
+ memIDHandle = Succ(memIDPtr);
+
+(************************************************************
+ * Flags accepted as parameter for MemNewChunk.
+ *************************************************************)
+
+ memNewChunkFlagPreLock = $0100;
+ memNewChunkFlagNonMovable = $0200;
+ memNewChunkFlagAtStart = $0400; // force allocation at front of heap
+ memNewChunkFlagAtEnd = $0800; // force allocation at end of heap
+
+(************************************************************
+ * Memory Manager Debug settings for the MemSetDebugMode function
+ *************************************************************)
+
+ memDebugModeCheckOnChange = $0001;
+ memDebugModeCheckOnAll = $0002;
+ memDebugModeScrambleOnChange = $0004;
+ memDebugModeScrambleOnAll = $0008;
+ memDebugModeFillFree = $0010;
+ memDebugModeAllHeaps = $0020;
+ memDebugModeRecordMinDynHeapFree = $0040;
+
+(************************************************************
+ * Memory Manager result codes
+ *************************************************************)
+
+ memErrChunkLocked = memErrorClass or 1;
+ memErrNotEnoughSpace = memErrorClass or 2;
+ memErrInvalidParam = memErrorClass or 3; // invalid param or requested size is too big
+ memErrChunkNotLocked = memErrorClass or 4;
+ memErrCardNotPresent = memErrorClass or 5;
+ memErrNoCardHeader = memErrorClass or 6;
+ memErrInvalidStoreHeader = memErrorClass or 7;
+ memErrRAMOnlyCard = memErrorClass or 8;
+ memErrWriteProtect = memErrorClass or 9;
+ memErrNoRAMOnCard = memErrorClass or 10;
+ memErrNoStore = memErrorClass or 11;
+ memErrROMOnlyCard = memErrorClass or 12;
+
+(********************************************************************
+ * Memory Manager Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+function MemInit: Err; syscall sysTrapMemInit;
+
+function MemKernelInit: Err; syscall sysTrapMemKernelInit;
+
+function MemInitHeapTable(cardNo: UInt16): Err; syscall sysTrapMemInitHeapTable;
+
+//-------------------------------------------------------------------
+// Card formatting and Info
+//-------------------------------------------------------------------
+
+function MemNumCards: UInt16; syscall sysTrapMemNumCards;
+
+function MemCardFormat(cardNo: UInt16; const cardNameP, manufNameP, ramStoreNameP: PChar): Err; syscall sysTrapMemCardFormat;
+
+function MemCardInfo(cardNo: UInt16; cardNameP, manufNameP: PChar; var versionP: UInt16;
+ var crDateP, romSizeP, ramSizeP, freeBytesP: UInt32): Err; syscall sysTrapMemCardInfo;
+
+//-------------------------------------------------------------------
+// Store Info
+//-------------------------------------------------------------------
+
+function MemStoreInfo(cardNo, storeNumber: UInt16; var versionP, flagsP: UInt16;
+ nameP: PChar; var crDateP, bckUpDateP, heapListOffsetP, initCodeOffset1P,
+ initCodeOffset2P: UInt32; var databaseDirIDP: LocalID): Err; syscall sysTrapMemStoreInfo;
+
+function MemStoreSetInfo(cardNo, storeNumber: UInt16; var versionP, flagsP: UInt16;
+ nameP: PChar; var crDateP, bckUpDateP, heapListOffsetP, initCodeOffset1P,
+ initCodeOffset2P: UInt32; var databaseDirIDP: LocalID): Err; syscall sysTrapMemStoreSetInfo;
+
+//-------------------------------------------------------------------
+// Heap Info & Utilities
+//-------------------------------------------------------------------
+
+function MemNumHeaps(cardNo: UInt16): UInt16; syscall sysTrapMemNumHeaps;
+
+function MemNumRAMHeaps(cardNo: UInt16): UInt16; syscall sysTrapMemNumRAMHeaps;
+
+function MemHeapID(cardNo, heapIndex: UInt16): UInt16; syscall sysTrapMemHeapID;
+
+function MemHeapDynamic(heapID: UInt16): Boolean; syscall sysTrapMemHeapDynamic;
+
+function MemHeapFreeBytes(heapID: UInt16; var freeP, maxP: UInt32): Err; syscall sysTrapMemHeapFreeBytes;
+
+function MemHeapSize(heapID: UInt16): UInt32; syscall sysTrapMemHeapSize;
+
+function MemHeapFlags(heapID: UInt16): UInt16; syscall sysTrapMemHeapFlags;
+
+// Heap utilities
+function MemHeapCompact(heapID: UInt16): Err; syscall sysTrapMemHeapCompact;
+
+function MemHeapInit(heapID: UInt16; numHandles: Int16; initContents: Boolean): Err; syscall sysTrapMemHeapInit;
+
+function MemHeapFreeByOwnerID(heapID, ownerID: UInt16): Err; syscall sysTrapMemHeapFreeByOwnerID;
+
+//-------------------------------------------------------------------
+// Low Level Allocation
+//-------------------------------------------------------------------
+
+function MemChunkNew(heapID: UInt16; size: UInt32; attr: UInt16): MemPtr; syscall sysTrapMemChunkNew;
+
+function MemChunkFree(chunkDataP: MemPtr): Err; syscall sysTrapMemChunkFree;
+
+//-------------------------------------------------------------------
+// Pointer (Non-Movable) based Chunk Routines
+//-------------------------------------------------------------------
+
+function MemPtrNew(size: UInt32): MemPtr; syscall sysTrapMemPtrNew;
+
+function MemPtrFree(chunkDataP: MemPtr): Err; syscall sysTrapMemChunkFree;
+
+// Getting Attributes
+function MemPtrRecoverHandle(p: MemPtr): MemHandle; syscall sysTrapMemPtrRecoverHandle;
+
+function MemPtrFlags(p: MemPtr): UInt16; syscall sysTrapMemPtrFlags;
+
+function MemPtrSize(p: MemPtr): UInt32; syscall sysTrapMemPtrSize;
+
+function MemPtrOwner(p: MemPtr): UInt16; syscall sysTrapMemPtrOwner;
+
+function MemPtrHeapID(p: MemPtr): UInt16; syscall sysTrapMemPtrHeapID;
+
+function MemPtrDataStorage(p: MemPtr): Boolean; syscall sysTrapMemPtrDataStorage;
+
+function MemPtrCardNo(p: MemPtr): UInt16; syscall sysTrapMemPtrCardNo;
+
+function MemPtrToLocalID(p: MemPtr): LocalID; syscall sysTrapMemPtrToLocalID;
+
+// Setting Attributes
+function MemPtrSetOwner(p: MemPtr; owner: UInt16): Err; syscall sysTrapMemPtrSetOwner;
+
+function MemPtrResize(p: MemPtr; newSize: UInt32): Err; syscall sysTrapMemPtrResize;
+
+function MemPtrResetLock(p: MemPtr): Err; syscall sysTrapMemPtrResetLock;
+
+function MemPtrUnlock(p: MemPtr): Err; syscall sysTrapMemPtrUnlock;
+
+//-------------------------------------------------------------------
+// MemHandle (Movable) based Chunk Routines
+//-------------------------------------------------------------------
+
+function MemHandleNew(size: UInt32): MemHandle; syscall sysTrapMemHandleNew;
+
+function MemHandleFree(h: MemHandle): Err; syscall sysTrapMemHandleFree;
+
+// Getting Attributes
+function MemHandleFlags(h: MemHandle): UInt16; syscall sysTrapMemHandleFlags;
+
+function MemHandleSize(h: MemHandle): UInt32; syscall sysTrapMemHandleSize;
+
+function MemHandleOwner(h: MemHandle): UInt16; syscall sysTrapMemHandleOwner;
+
+function MemHandleLockCount(h: MemHandle): UInt16; syscall sysTrapMemHandleLockCount;
+
+function MemHandleHeapID(h: MemHandle): UInt16; syscall sysTrapMemHandleHeapID;
+
+function MemHandleDataStorage(h: MemHandle): Boolean; syscall sysTrapMemHandleDataStorage;
+
+function MemHandleCardNo(h: MemHandle): UInt16; syscall sysTrapMemHandleCardNo;
+
+function MemHandleToLocalID(h: MemHandle): LocalID; syscall sysTrapMemHandleToLocalID;
+
+// Setting Attributes
+function MemHandleSetOwner(h: MemHandle; owner: UInt16): Err; syscall sysTrapMemHandleSetOwner;
+
+function MemHandleResize(h: MemHandle; newSize: UInt32): Err; syscall sysTrapMemHandleResize;
+
+function MemHandleLock(h: MemHandle): MemPtr; syscall sysTrapMemHandleLock;
+
+function MemHandleUnlock(h: MemHandle): Err; syscall sysTrapMemHandleUnlock;
+
+function MemHandleResetLock(h: MemHandle): Err; syscall sysTrapMemHandleResetLock;
+
+//-------------------------------------------------------------------
+// Local ID based routines
+//-------------------------------------------------------------------
+
+function MemLocalIDToGlobal(local: LocalID; cardNo: UInt16): MemPtr; syscall sysTrapMemLocalIDToGlobal;
+
+function MemLocalIDKind(local: LocalID): LocalIDKind; syscall sysTrapMemLocalIDKind;
+
+function MemLocalIDToPtr(local: LocalID; cardNo: UInt16): MemPtr; syscall sysTrapMemLocalIDToPtr;
+
+function MemLocalIDToLockedPtr(local: LocalID; cardNo: UInt16): MemPtr; syscall sysTrapMemLocalIDToLockedPtr;
+
+//-------------------------------------------------------------------
+// Utilities
+//-------------------------------------------------------------------
+
+function MemMove(dstP: Pointer; const sP: Pointer; numBytes: Int32): Err; syscall sysTrapMemMove;
+
+function MemSet(dstP: Pointer; numBytes: Int32; value: UInt8): Err; syscall sysTrapMemSet;
+
+function MemCmp(const s1: Pointer; const s2: Pointer; numBytes: Int32): Int16; syscall sysTrapMemCmp;
+
+function MemSemaphoreReserve(writeAccess: Boolean): Err; syscall sysTrapMemSemaphoreReserve;
+
+function MemSemaphoreRelease(writeAccess: Boolean): Err; syscall sysTrapMemSemaphoreRelease;
+
+//-------------------------------------------------------------------
+// Debugging Support
+//-------------------------------------------------------------------
+
+function MemDebugMode: UInt16; syscall sysTrapMemDebugMode;
+
+function MemSetDebugMode(flags: UInt16): Err; syscall sysTrapMemSetDebugMode;
+
+function MemHeapScramble(heapID: UInt16): Err; syscall sysTrapMemHeapScramble;
+
+function MemHeapCheck(heapID: UInt16): Err; syscall sysTrapMemHeapCheck;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/menu_.pp b/packages/palmunits/src/menu_.pp
new file mode 100644
index 0000000000..463bcba3cb
--- /dev/null
+++ b/packages/palmunits/src/menu_.pp
@@ -0,0 +1,191 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Menu.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines menu structures and routines.
+ *
+ * History:
+ * November 18, 1994 Created by Roger Flores
+ * Name Date Description
+ * ---- ---- -----------
+ * gap 09/29/99 Added gsiWasEnabled to MenuCmdBarType
+ *
+ *****************************************************************************)
+
+unit menu_;
+
+interface
+
+uses palmos, coretraps, errorbase, control, event_;
+
+// Errors returned by Menu routines
+
+const
+ menuErrNoMenu = menuErrorClass or 1;
+ menuErrNotFound = menuErrorClass or 2;
+ menuErrSameId = menuErrorClass or 3;
+ menuErrTooManyItems = menuErrorClass or 4;
+ menuErrOutOfMemory = menuErrorClass or 5;
+
+// Command bar structures
+
+type
+ MenuCmdBarResultType = Enum;
+
+const
+ menuCmdBarResultNone = 0; // send nothing (this'd be quite unusual but is allowed)
+ menuCmdBarResultChar = Succ(menuCmdBarResultNone); // char to send (with commandKeyMask bit set)
+ menuCmdBarResultMenuItem = Succ(menuCmdBarResultChar); // id of the menu item
+ menuCmdBarResultNotify = Succ(menuCmdBarResultMenuItem); // Nofication Manager notification type
+
+// maximum length of the prompt string to display in the command bar
+ menuCmdBarMaxTextLength = 20;
+
+type
+ MenuCmdBarButtonType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ bitmapId: UInt16;
+ name: array [0..menuCmdBarMaxTextLength-1] of Char;
+ resultType: MenuCmdBarResultType;
+ reserved: UInt8; // alignment padding
+ result: UInt32;
+ {$endif}
+ end;
+ MenuCmdBarButtonTag = MenuCmdBarButtonType;
+
+ MenuCmdBarType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ bitsBehind: WinHandle;
+ timeoutTick: Int32; // tick to disappear on
+ top: Coord;
+ numButtons: Int16;
+ insPtWasEnabled: Boolean;
+ gsiWasEnabled: Boolean;
+ feedbackMode: Boolean; // set when just displaying confirmation feedback
+ buttonsData: ^MenuCmdBarButtonType;
+ {$endif}
+ end;
+
+// to tell MenuCmdBarAddButton where to add the button: on right or left.
+const
+ menuCmdBarOnRight = 0;
+ menuCmdBarOnLeft = $ff;
+
+////Menu-specific
+
+ noMenuSelection = -1;
+ noMenuItemSelection = -1;
+ separatorItemSelection = -2;
+
+// cause codes for menuOpen Event
+ menuButtonCause = 0;
+ menuCommandCause = 1;
+
+// To match Apple's ResEdit the first byte of a menu item's text can
+// be a special char indicating a special menu item.
+ MenuSeparatorChar = '-';
+
+type
+ MenuItemType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ id: UInt16; // id of the menu item
+ command: Char; // command key
+ bits: UInt8;
+{
+ UInt8 hidden: 1; // true if menu item is hidden
+ UInt8 reserved: 7;
+}
+ itemStr: PChar; // string to be displayed
+ {$endif}
+ end;
+ MenuItemTag = MenuItemType;
+
+ MenuPullDownType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ menuWin: WinHandle; // window of pull-down menu
+ bounds: RectangleType; // bounds of the pulldown
+ bitsBehind: WinHandle; // saving bits behind pull-down menu
+ titleBounds: RectangleType; // bounds of the title in menu bar
+ title: PChar; // menu title displayed in menu bar
+ bits: UInt16;
+{
+ UInt16 hidden: 1; // true if pulldown is hidden
+ UInt16 numItems: 15; // number of items in the menu
+}
+ items: ^MenuItemType; // array of menu items
+ {$endif}
+ end;
+ MenuPullDownTag = MenuPullDownType;
+ MenuPullDownPtr = ^MenuPullDownType;
+
+ MenuBarAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ bits: UInt16;
+{
+ UInt16 visible :1; // Set if menu bar is drawn
+ UInt16 commandPending :1; // Set if next key is a command
+ UInt16 insPtEnabled :1; // Set if insPt was on when menu was drawn
+ UInt16 needsRecalc :1; // if set then recalc menu dimensions
+ UInt16 attnIndicatorIsAllowed :1; // set if attn indicator was allowed when menu was drawn
+ UInt16 reserved :11; // reserved for future use
+}
+ {$endif}
+ end;
+ MenuBarAttrTag = MenuBarAttrType;
+
+ MenuBarType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_MENUS} // These fields will not be available in the next OS release!
+ barWin: WinHandle; // window of menu bar
+ bitsBehind: WinHandle; // saving bits behind menu bar
+ savedActiveWin: WinHandle;
+ bitsBehindStatus: WinHandle;
+ attr: MenuBarAttrType;
+ curMenu: Int16; // current menu or -1 if none
+ curItem: Int16; // current item in curMenu, -1 if none
+ commandTick: Int32;
+ numMenus: Int16; // number of menus
+ menus: MenuPullDownPtr; // array of menus
+ {$endif}
+ end;
+ MenuBarTag = MenuBarType;
+ MenuBarPtr = ^MenuBarType;
+
+function MenuInit(resourceId: UInt16): MenuBarPtr; syscall sysTrapMenuInit;
+
+function MenuGetActiveMenu: MenuBarPtr; syscall sysTrapMenuGetActiveMenu;
+
+function MenuSetActiveMenu(menuP: MenuBarPtr): MenuBarPtr; syscall sysTrapMenuSetActiveMenu;
+
+procedure MenuDispose(menuP: MenuBarPtr); syscall sysTrapMenuDispose;
+
+function MenuHandleEvent(menuP: MenuBarPtr; var event: EventType; var error: UInt16): Boolean; syscall sysTrapMenuHandleEvent;
+
+procedure MenuDrawMenu(menuP: MenuBarPtr); syscall sysTrapMenuDrawMenu;
+
+procedure MenuEraseStatus(menuP: MenuBarPtr); syscall sysTrapMenuEraseStatus;
+
+procedure MenuSetActiveMenuRscID(resourceId: UInt16); syscall sysTrapMenuSetActiveMenuRscID;
+
+function MenuCmdBarAddButton(where: UInt8; bitmapId: UInt16; resultType: MenuCmdBarResultType;
+ result_: UInt32; nameP: PChar): Err; syscall sysTrapMenuCmdBarAddButton;
+
+function MenuCmdBarGetButtonData(buttonIndex: Int16; var bitmapIdP: UInt16; var resultTypeP: MenuCmdBarResultType;
+ var resultP: UInt32; nameP: PChar): Boolean; syscall sysTrapMenuCmdBarGetButtonData;
+
+procedure MenuCmdBarDisplay; syscall sysTrapMenuCmdBarDisplay;
+
+function MenuShowItem(id: UInt16): Boolean; syscall sysTrapMenuShowItem;
+
+function MenuHideItem(id: UInt16): Boolean; syscall sysTrapMenuHideItem;
+
+function MenuAddItem(positionId, id: UInt16; cmd: Char; const textP: PChar): Err; syscall sysTrapMenuAddItem;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/modemmgr.pp b/packages/palmunits/src/modemmgr.pp
new file mode 100644
index 0000000000..dcc2887879
--- /dev/null
+++ b/packages/palmunits/src/modemmgr.pp
@@ -0,0 +1,144 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ModemMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Modem Manager
+ *
+ * History:
+ * 9/20/95 VMK - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************)
+
+unit modemmgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * Modem Manager constants
+ *************************************************************)
+
+const
+ mdmMaxStringSize = 40;
+
+ mdmCmdBufSize = 81; // command buffer capacity (including null)
+ mdmRespBufSize = 81; // reply buffer capacity (including null)
+ mdmCmdSize = 8; // max storage needed for smartmodem command
+
+ mdmDefCmdTimeOut = 500000; // in micro-seconds
+
+ mdmDefDTWaitSec = 4;
+ mdmDefDCDWaitSec = 70;
+ mdmDefSpeakerVolume = 1;
+ mdmResetStrInCmdBuf = $01;
+
+// Speaker volume settings
+const
+ mdmVolumeOff = 0;
+ mdmVolumeLow = 1;
+ mdmVolumeMed = 2;
+ mdmVolumeHigh = 3;
+
+// Modem connection stages (NEW for Pilot 2.0)
+type
+ MdmStageEnum = Enum;
+
+const
+ mdmStageInvalid = 0; // invalid state
+ mdmStageReserved = 1; // reserved for 1.0 compatibility
+ mdmStageFindingModem = Succ(mdmStageReserved); // checking if modem is present
+ mdmStageInitializing = Succ(mdmStageFindingModem); // initializing the modem
+ mdmStageDialing = Succ(mdmStageInitializing); // dialing the modem
+ mdmStageWaitingForCarrier = Succ(mdmStageDialing); // waiting for carrier detect
+ mdmStageHangingUp = Succ(mdmStageWaitingForCarrier); // hanging up the modem
+
+(************************************************************
+ * Modem Manager data structures
+ *************************************************************)
+
+// Prototype for the "user cancel" check callback function
+
+type
+ MdmUserCanProcPtr = function(userRef: UInt32): Int16;
+
+ MdmInfoType = record
+ portID: UInt16; // serial port ID number. [NewSerialMgr; replaces serRefNum]
+ initialBaud: UInt32; // initial baud rate to use
+ cmdTimeOut: UInt32; // number of micro-sec to wait after a cmd
+ dtWaitSec: Int16; // dialtone wait (sec) (-1 for modem's default)
+ dcdWaitSec: Int16; // dcd timeout wait (sec) (-1 for modem's default)
+ volume: Int16; // speaker volume(see mdmVolume... constants)
+ pulse: Boolean; // pulse or tone dialing
+ hwHShake: Boolean; // enable cts/rts handshaking
+ autoBaud: Boolean; // enable/disable auto-baud to connected baud rate
+ telConnection: UInt8; // Boolean true if connecting to a mobile phone
+ // false otherwise.
+ canProcP: MdmUserCanProcPtr; // ptr to user-cancel function
+ userRef: UInt32; // parameter for canProcP()
+ cmdBuf: array [0..mdmCmdBufSize-1] of Char; // build all commands here
+ respBuf: array [0..mdmRespBufSize-1] of Char; // response buffer
+ connectBaud: UInt32; // baud at which connection was established
+ // (0 = unknown)
+ curStage: UInt8; // set by ModemMgr to report current MdmStageEnum
+ strInCmdBuf: UInt8; // Set to mdmResetStrInCmdBuf if the reset string is
+ // stored in the command buffer cmdBuf. This is to
+ // get around a compatibility problem with not being
+ // able pass in a reset string. The reset string
+ // must be prefixed with AT. Set to zero otherwise
+ end;
+
+ MdmInfoPtr = ^MdmInfoType;
+
+(************************************************************
+ * Modem Manager result codes
+ * (mdmErrorClass is defined in ErrorBase.h)
+ *************************************************************)
+
+const
+ mdmErrNoTone = mdmErrorClass or 1; // no dial tone
+ mdmErrNoDCD = mdmErrorClass or 2; // no carrier / timeout
+ mdmErrBusy = mdmErrorClass or 3; // busy signal heard
+ mdmErrUserCan = mdmErrorClass or 4; // cancelled by user
+ mdmErrCmdError = mdmErrorClass or 5; // command error
+ mdmErrNoModem = mdmErrorClass or 6; // no modem detected
+ mdmErrMemory = mdmErrorClass or 7; // not enough memory
+ mdmErrPrefs = mdmErrorClass or 8; // modem preferences have not been
+ // setup - (app should take user to modem prefs panel)
+ mdmErrDial = mdmErrorClass or 9; // dial command error - most likely the dial
+ // string is too long for the modem's buffer or
+ // contains invalid characters
+// <chg 3-7-98 RM> New error code for empty phone number which is only invalid if
+// the modem type is not a "Direct Connect" modem
+ mdmErrNoPhoneNum = mdmErrorClass or 10; // No phone number and not "Direct Connect"
+
+(********************************************************************
+ * Modem Manager Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+function MdmDial(modemP: MdmInfoPtr; okDialP, userInitP, phoneNumP: PChar): Err; syscall sysTrapMdmDial;
+
+function MdmHangUp(modemP: MdmInfoPtr): Err; syscall sysTrapMdmHangUp;
+
+(************************************************************
+ * Modem Manager Macros
+ *************************************************************)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/netbitutils.pp b/packages/palmunits/src/netbitutils.pp
new file mode 100644
index 0000000000..73b6aba76b
--- /dev/null
+++ b/packages/palmunits/src/netbitutils.pp
@@ -0,0 +1,158 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetBitUtils.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ *
+ *****************************************************************************)
+
+unit netbitutils;
+
+interface
+
+uses palmos, netmgr;
+
+// # of bits in a byte
+const
+ 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]
+ 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)
+*)
+
+//=====================================================
+// Macros that convert native integers to and from
+// big-endian (network) order which is the order used to store
+// variable length integers by the BitMove utilities.
+//====================================================
+
+(*
+#if CPU_TYPE == CPU_x86
+
+#define _NetSwap16(x) \
+ ((((x) >> 8) & 0xFF) | \
+ (((x) & 0xFF) << 8))
+
+#define _NetSwap32(x) \
+ ((((x) >> 24) & 0x00FF) | \
+ (((x) >> 8) & 0xFF00) | \
+ (((x) & 0xFF00) << 8) | \
+ (((x) & 0x00FF) << 24))
+
+#define NetHToNS(x) _NetSwap16(x)
+#define NetHToNL(x) _NetSwap32(x)
+#define NetNToHS(x) _NetSwap16(x)
+#define NetNToHL(x) _NetSwap32(x)
+
+#elif CPU_TYPE == CPU_68K
+
+#define NetHToNS(x) (x)
+#define NetHToNL(x) (x)
+#define NetNToHS(x) (x)
+#define NetNToHL(x) (x)
+
+#else
+// We'll define these macros for any other architectures needed as we come
+// across them.
+#endif
+*)
+
+//=====================================================
+// Functions
+//====================================================
+
+//--------------------------------------------------
+// Bit Moving functions. For "slim" bit packing protocols
+// used over wireless.
+//--------------------------------------------------
+procedure NetLibBitMove(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32;
+ var srcP: UInt8; var srcBitOffsetP: UInt32; numBits: UInt32); syscall netLibTrapBitMove;
+
+procedure NetLibBitPutFixed(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32;
+ value: UInt32; numBits: UInt16); syscall netLibTrapBitPutFixed;
+
+function NetLibBitGetFixed(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32;
+ numBits: UInt16): UInt32; syscall netLibTrapBitGetFixed;
+
+procedure NetLibBitPutUIntV(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32;
+ value: UInt32); syscall netLibTrapBitPutUIntV;
+
+function NetLibBitGetUIntV(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32): UInt32; syscall netLibTrapBitGetUIntV;
+
+procedure NetLibBitPutIntV(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32;
+ value: Int32); syscall netLibTrapBitPutUIntV;
+
+function NetLibBitGetIntV(libRefNum: UInt16; var dstP: UInt8; var dstBitOffsetP: UInt32): Int32; syscall netLibTrapBitGetUIntV;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/netmgr.pp b/packages/palmunits/src/netmgr.pp
new file mode 100644
index 0000000000..c487f2b6c3
--- /dev/null
+++ b/packages/palmunits/src/netmgr.pp
@@ -0,0 +1,1657 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NetMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ * jhl 7/14/00 added net notice
+ *
+ *****************************************************************************)
+
+unit netmgr;
+
+interface
+
+uses palmos, libtraps, errorbase, sysevent, event_;
+
+(********************************************************************
+ * Type and creator of Net Library database
+ ********************************************************************)
+
+// Creator. Used for both the database that contains the Net Library and
+// it's preferences database.
+const
+ netCreator = Rsc('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
+ netFtrCreator = netCreator;
+ 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
+// Begin Change (BGT)
+// Feature for defining the number of command blocks to allocate
+ netFtrCommandBlocks = 1; // get the number of command blocks
+
+// Types. Used to identify the Net Library from it's prefs.
+ netLibType = Rsc('libr'); // Our Net Code Resources Database type
+ netPrefsType = Rsc('rsrc'); // Our Net Preferences Database type
+
+// All Network interface's have the following type:
+ netIFFileType = Rsc('neti'); // The filetype of all Network Interfaces
+
+// Each Network interface has a unique creator:
+ netIFCreatorLoop = Rsc('loop'); // Loopback network interface creator.
+ netIFCreatorSLIP = Rsc('slip'); // SLIP network interface creator.
+ netIFCreatorPPP = Rsc('ppp_'); // PPP network interface creator.
+//<chg 1-28-98 RM>
+ netIFCreatorRAM = Rsc('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
+ netConfigIndexCurSettings = $FFFF;
+
+// <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
+// netMaxNetIFs = 4;
+
+//-----------------------------------------------------------------------------
+// Misc. constants
+//-----------------------------------------------------------------------------
+
+const
+ netDrvrTypeNameLen = 8; // Maximum driver type length
+ netDrvrHWNameLen = 16; // Maximum driver hardware name length
+ netIFNameLen = 10; // Maximum interface name (driver type + instance num)
+ netIFMaxHWAddrLen = 14; // Maximum size of a hardware address
+ 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
+//-----------------------------------------------------------------------------
+
+ netCfgNameDefault = '.Default'; // The default configuration
+ netCfgNameDefWireline = '.DefWireline'; // The default wireline configuration
+ netCfgNameDefWireless = '.DefWireless'; // The default wireless configuration
+ netCfgNameCTPWireline = '.CTPWireline'; // Wireline through the Jerry Proxy
+ netCfgNameCTPWireless = '.CTPWireless'; // Wireless through the Jerry Proxy
+
+//-----------------------------------------------------------------------------
+//Flags for the NetUWirelessAppHandleEvent() utility routine
+//-----------------------------------------------------------------------------
+
+const
+ netWLAppEventFlagCTPOnly = $00000001; // using wireless radio for CTP protocol only
+ netWLAppEventFlagDisplayErrs = $00000002; // 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
+type
+ NetSocketOptEnum = WordEnum;
+
+const
+ // 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 = $0001; // turn on debugging info recording
+ netSocketOptSockAcceptConn = $0002; // socket has had listen
+ netSocketOptSockReuseAddr = $0004; // allow local address reuse
+ netSocketOptSockKeepAlive = $0008; // keep connections alive
+ netSocketOptSockDontRoute = $0010; // just use interface addresses
+ netSocketOptSockBroadcast = $0020; // permit sending of broadcast msgs
+ netSocketOptSockUseLoopback = $0040; // bypass hardware when possible
+ netSocketOptSockLinger = $0080; // linger on close if data present
+ netSocketOptSockOOBInLine = $0100; // leave received OutOfBand data in line
+
+ netSocketOptSockSndBufSize = $1001; // send buffer size
+ netSocketOptSockRcvBufSize = $1002; // receive buffer size
+ netSocketOptSockSndLowWater = $1003; // send low-water mark
+ netSocketOptSockRcvLowWater = $1004; // receive low-water mark
+ netSocketOptSockSndTimeout = $1005; // send timeout
+ netSocketOptSockRcvTimeout = $1006; // receive timeout
+ netSocketOptSockErrorStatus = $1007; // get error status and clear
+ netSocketOptSockSocketType = $1008; // get socket type
+
+ // The following are Pilot specific options
+ netSocketOptSockNonBlocking = $2000; // set non-blocking mode on or off
+ netSocketOptSockRequireErrClear = $2001; // return error from all further calls to socket
+ // unless netSocketOptSockErrorStatus is cleared.
+ netSocketOptSockMultiPktAddr = $2002; // for SOCK_RDM (RMP) sockets. This is the
+ // fixed IP addr (i.e. Mobitex MAN #) to use
+ // for multiple packet requests.
+ // for socket notification
+ // 05/20/00 jhl
+ netSocketOptSockNotice = $2003; // prime socket for notification
+
+// Option levels for SocketOptionSet and SocketOptionGet
+type
+ NetSocketOptLevelEnum = WordEnum;
+
+const
+ netSocketOptLevelIP = 0; // IP level options (IPPROTO_IP)
+ netSocketOptLevelTCP = 6; // TCP level options (IPPROTO_TCP)
+ netSocketOptLevelSocket = $FFFF; // Socket level options (SOL_SOCKET)
+
+// Structure used for manipulating the linger option
+type
+ NetSocketLingerType = record
+ onOff: Int16; // option on/off
+ time: Int16; // linger time in seconds
+ end;
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket domains and types passed to NetSocketOpen
+//-----------------------------------------------------------------------------
+
+type
+ NetSocketAddrEnum = Enum;
+
+const
+ netSocketAddrRaw = 0; // (AF_UNSPEC, AF_RAW)
+ netSocketAddrINET = 2; // (AF_INET)
+
+type
+ NetSocketTypeEnum = Enum;
+
+const
+ netSocketTypeStream = 1; // (SOCK_STREAM)
+ netSocketTypeDatagram = 2; // (SOCK_DGRAM)
+ netSocketTypeRaw = 3; // (SOCK_RAW)
+ netSocketTypeReliableMsg = 4; // (SOCK_RDM)
+ netSocketTypeLicensee = 8; // Socket entry reserved for licensees.
+
+// Protocols, passed in the protocol parameter to NetLibSocketOpen
+const
+ netSocketProtoIPICMP = 1; // IPPROTO_ICMP
+ netSocketProtoIPTCP = 6; // IPPROTO_TCP
+ netSocketProtoIPUDP = 17; // IPPROTO_UDP
+ netSocketProtoIPRAW = 255; // IPPROTO_RAW
+
+//-----------------------------------------------------------------------------
+// Enumeration of Socket direction, passed to NetSocketShutdown
+//-----------------------------------------------------------------------------
+
+type
+ NetSocketDirEnum = Enum;
+
+const
+ netSocketDirInput = 0;
+ netSocketDirOutput = 1;
+ netSocketDirBoth = 2;
+
+//-----------------------------------------------------------------------------
+// Basic Types
+//-----------------------------------------------------------------------------
+// Socket refnum
+
+type
+ NetSocketRef = Int16;
+
+// Type used to hold internet addresses
+ NetIPAddr = UInt32; // a 32-bit IP address.
+
+// IFMediaEvent notifications types
+type
+ NetLibIFMediaEventNotificationTypeEnum = Enum;
+
+const
+ netIFMediaUp = 1; // Usually sent by Network interfaces
+ // after they have displayed the UI for displaying
+ // connection establishment progress.
+
+ netIFMediaDown = Succ(netIFMediaUp);
+ // Sent by Network interface's when their inactivity timer
+ // is ellapsed.
+
+// Notification structure sent in SysNotifyNetLibIFMedia.
+type
+ SysNotifyNetLibIFMediaTag = record
+ eType: NetLibIFMediaEventNotificationTypeEnum;
+ ifCreator: UInt32; // interface creator
+ ifInstance: UInt16; // interface instance
+ end;
+ SysNotifyNetLibIFMediaType = SysNotifyNetLibIFMediaTag;
+
+//-----------------------------------------------------------------------------
+// For socket notification
+// 05/20/00 jhl
+//-----------------------------------------------------------------------------
+
+// Notice types
+type
+ NoticeTypeEnum = Enum;
+
+const
+ netSocketNoticeNotify = 1;
+// ummmm...
+// shouldn't do this - must fix EventMgr before background/ISR events can be posted
+ netSocketNoticeEvent = Succ(netSocketNoticeNotify);
+ netSocketNoticeMailbox = Succ(netSocketNoticeEvent);
+ netSocketNoticeCallback = Succ(netSocketNoticeMailbox);
+ netSocketNoticeWake = Succ(netSocketNoticeCallback);
+
+// Notification structure sent for netSocketNoticeNotify.
+type
+ SysNotifyNetSocketType = record
+ socketRef: NetSocketRef; // Socket sending the notification
+ condition: UInt32; // Bit field reporting trigger conditions
+ end;
+
+// Event structure sent for netSocketNoticeEvent.
+// This should be defined via Event.h, so it stays in sync.
+type
+ netSocketNotice = record
+ socketRef: NetSocketRef; // Socket sending the notification
+ condition: UInt32; // Bit field reporting trigger conditions
+ end;
+
+type
+ NetSocketNoticeEventType = record
+ eType: eventsEnum; // User specified event type
+ penDown: Boolean;
+ tapCount: UInt8;
+ screenX: Int16;
+ screenY: Int16;
+ case Integer of
+ 1: (generic: _GenericEventType); // Establish size of union
+ 2: (netSocketNotice: netSocketNotice);
+ end;
+
+// Mailbox structure sent for netSocketNoticeMailbox.
+type
+ NetSocketNoticeMailboxType = record
+ message_: UInt32; // User specified message
+ reserved: UInt16;
+ socketRef: NetSocketRef; // Socket sending the notification
+ condition: UInt32; // Bit field reporting trigger conditions
+ end;
+
+// Callback definition for netSocketNoticeCallback.
+type
+ NetSocketNoticeCallbackPtr = function(userDataP: Pointer; socketRef: UInt16; condition: UInt32): Err;
+
+type
+ notify = record
+ notifyType: UInt32; // Notification type
+ // sends SysNotifyNetSocketType in notification
+ end;
+
+type
+ event = record
+ eType: eventsEnum; // Event type
+ // adds NetSocketNoticeEventType event to UI event queue
+ end;
+
+type
+ mailbox = record
+ mailboxID: UInt32; // ID of mailbox for send
+ message_: UInt32; // first element of mailbox message
+ wAck: UInt32; // third argument to SysMailboxSend()
+ // sends NetSocketNoticeMailboxType message to specified mailboxID
+ end;
+
+type
+ callback = record
+ callbackP: NetSocketNoticeCallbackPtr; // Callback proc pointer
+ userDataP: Pointer; // User specified ptr passed as callback parameter
+ // (*callbackP)(userDataP,socketRef,condition)
+ end;
+
+type
+ wake = record
+ taskID: UInt32; // ID of task to wake
+ socketRefP: ^NetSocketRef; // address to receive socketRef
+ conditionP: ^UInt32; // address to receive trigger condition
+ end;
+
+// Structure used to register for a notice
+type
+ NetSocketNoticeType = record
+ condition: UInt32; // Bit field specifying trigger conditions
+ type_: NoticeTypeEnum; // Notice type
+ case Integer of
+ 1: (notify: notify);
+// ummmm...
+// shouldn't do this - must fix EventMgr before background/ISR events can be posted
+ 2: (event: event);
+ 3: (mailbox: mailbox);
+ 4: (callback: callback);
+ 5: (wake: wake); // SysTaskWake(taskID)
+ end;
+
+// Bit values for specifying and reporting trigger conditions
+const
+ netSocketNoticeErr = $00000001;
+ netSocketNoticeUDPReceive = $00000002;
+ netSocketNoticeTCPReceive = $00000004;
+ netSocketNoticeTCPTransmit = $00000008;
+ netSocketNoticeTCPRemoteClosed = $00000010;
+ netSocketNoticeTCPClosed = $00000020;
+ netSocketNoticeConnectInbound = $00000040;
+ netSocketNoticeConnectOutbound = $00000080;
+
+//-----------------------------------------------------------------------------
+// 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.
+//-----------------------------------------------------------------------------
+
+type
+ NetSocketAddrINType = record
+ family: Int16; // Address family in HBO (Host UInt8 Order)
+ port: UInt16; // the UDP port in NBO (Network UInt8 Order)
+ addr: NetIPAddr; // IP address in NBO (Network UInt8 Order)
+ end;
+
+// Constant that means "use the local machine's IP address"
+const
+ 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.
+
+type
+ NetSocketAddrType = record
+ family: Int16; // Address family
+ data: array [0..14-1] of UInt8; // 14 bytes of address
+ end;
+ NetSocketAddrPtr = ^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.
+
+type
+ NetSocketAddrRawType = record
+ family: Int16; // Address family in HBO (Host UInt8 Order)
+ ifInstance: UInt16; // the interface instance number
+ ifCreator: UInt32; // the interface creator
+ end;
+
+//-----------------------------------------------------------------------------
+// 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.
+
+type
+ NetIOVecType = record
+ bufP: ^UInt8; // buffer address
+ bufLen: UInt16; // buffer length
+ end;
+
+ NetIOVecPtr = ^NetIOVecType;
+
+const
+ netIOVecMaxLen = 16; // max# of NetIOVecTypes in an array
+
+// Read/Write ParamBlock type. Passed directly to the SendPB and RecvPB calls.
+type
+ NetIOParamType = record
+ addrP: ^UInt8; // address - or 0 for default
+ addrLen: UInt16; // length of address
+ iov: NetIOVecPtr; // scatter/gather array
+ iovLen: UInt16; // length of above array
+ accessRights: ^UInt8; // access rights
+ accessRightsLen: UInt16; // length of accessrights
+ end;
+
+ NetIOParamPtr = ^NetIOParamType;
+
+// Flags values for the NetLibSend, NetLibReceive calls
+const
+ netIOFlagOutOfBand = $01; // process out-of-band data
+ netIOFlagPeek = $02; // peek at incoming message
+ netIOFlagDontRoute = $04; // send without using routing
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a host by name or address (NetLibGetHostByName)
+//-----------------------------------------------------------------------------
+
+// Equates for DNS names, from RFC-1035
+ netDNSMaxDomainName = 255;
+ netDNSMaxDomainLabel = 63;
+
+ netDNSMaxAliases = 1; // max # of aliases for a host
+ 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.
+
+type
+ NetHostInfoType = record
+ nameP: PChar; // official name of host
+ nameAliasesP: ^PChar; // array of alias's for the name
+ addrType: UInt16; // address type of return addresses
+ addrLen: UInt16; // the length, in bytes, of the addresses
+ // Note this denotes length of a address, not # of addresses.
+ addrListP: ^UInt8Ptr; // array of ptrs to addresses in HBO
+ end;
+
+ NetHostInfoPtr = ^NetHostInfoType;
+
+// "Buffer" passed to call as a place to store the results
+ NetHostInfoBufType = record
+ hostInfo: NetHostInfoType; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // hostInfo points to
+ name: array [0..netDNSMaxDomainName] of Char; // hostInfo->name
+
+ aliasList: array [0..netDNSMaxAliases] of PChar; // +1 for 0 termination.
+ aliases: array [0..netDNSMaxAliases-1, 0..netDNSMaxDomainName] of Char;
+
+ addressList: array [0..netDNSMaxAddresses-1] of ^NetIPAddr;
+ address: array [0..netDNSMaxAddresses-1] of NetIPAddr;
+ end;
+
+ NetHostInfoBufPtr = ^NetHostInfoBufType;
+
+//-----------------------------------------------------------------------------
+// Structures used for looking up a service (NetLibGetServByName)
+//-----------------------------------------------------------------------------
+
+// Equates for service names
+const
+ netServMaxName = 15; // max # characters in service name
+ netProtoMaxName = 15; // max # characters in protocol name
+ 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.
+
+type
+ NetServInfoType = record
+ nameP: PChar; // official name of service
+ nameAliasesP: ^PChar; // array of alias's for the name
+ port: UInt16; // port number for this service
+ protoP: PChar; // name of protocol to use
+ end;
+
+ NetServInfoPtr = ^NetServInfoType;
+
+// "Buffer" passed to call as a place to store the results
+ NetServInfoBufType = record
+ servInfo: NetServInfoType; // high level results of call are here
+
+ // The following fields contain the variable length data that
+ // servInfo points to
+ name: array [0..netServMaxName] of Char; // hostInfo->name
+
+ aliasList: array [0..netServMaxAliases] of PChar; // +1 for 0 termination.
+ aliases: array [0..netServMaxAliases-1, 0..netServMaxName-1] of Char;
+ protoName: array [0..netProtoMaxName] of Char;
+
+ reserved: UInt8;
+ end;
+
+ NetServInfoBufPtr = ^NetServInfoBufType;
+
+//--------------------------------------------------------------------
+// Structure of a configuration name. Used by NetLibConfigXXX calls
+// <chg 1-28-98 RM> added for the new Config calls.
+//---------------------------------------------------------------------
+const
+ netConfigNameSize = 32;
+
+type
+ NetConfigNameType = record
+ name: array [0..netConfigNameSize-1] of Char; // name of configuration
+ end;
+
+ NetConfigNamePtr = ^NetConfigNameType;
+
+(********************************************************************
+ * Tracing Flags. These flags are ORed together and passed as a UInt32
+ * in the netSettingTraceFlags setting and netIFSettingTraceFlags to
+ * enable/disable various trace options.
+ ********************************************************************)
+
+const
+ netTracingErrors = $00000001; // record errors
+ netTracingMsgs = $00000002; // record messages
+ netTracingPktIP = $00000004; // record packets sent/received
+ // to/from interfaces at the IP layer
+ // NOTE: netTracingPktData40 & netTracingPktData
+ // will control how much data of each packet is
+ // recorded.
+ netTracingFuncs = $00000008; // record function flow
+ netTracingAppMsgs = $00000010; // record application messages
+ // (NetLibTracePrintF, NetLibTracePutS)
+ netTracingPktData40 = $00000020; // 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
+ netTracingPktData = $00000040; // record all bytes of IP packets
+ // sent/received to/from interfaces
+ // NOTE: Mutually exclusive with
+ // netTracingPkts & netTracingPktData64
+ netTracingPktIFHi = $00000080; // 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.
+ netTracingPktIFMid = $00000100; // 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.
+ netTracingPktIFLow = $00000200; // 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
+ 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.
+ *
+ ********************************************************************)
+
+type
+ NetMasterEnum = Enum;
+
+const
+ // These calls return info
+ netMasterInterfaceInfo = 0;
+ netMasterInterfaceStats = Succ(netMasterInterfaceInfo);
+ netMasterIPStats = Succ(netMasterInterfaceStats);
+ netMasterICMPStats = Succ(netMasterIPStats);
+ netMasterUDPStats = Succ(netMasterICMPStats);
+ netMasterTCPStats = Succ(netMasterUDPStats);
+
+ // This call used to read the trace buffer.
+ netMasterTraceEventGet = Succ(netMasterTCPStats); // get trace event by index
+
+type
+
+ //.............................................................
+ // InterfaceInfo command
+ //.............................................................
+
+ interfaceInfo = record
+ index: UInt16; // -> index of interface
+ creator: UInt32; // <- creator
+ instance: UInt16; // <- instance
+ netIFP: Pointer; // <- net_if pointer
+
+ // driver level info
+ drvrName: array [0..netDrvrTypeNameLen-1] of Char; // <- type of driver (SLIP,PPP, etc)
+ hwName: array [0..netDrvrHWNameLen-1] of Char; // <- hardware name (Serial Library, etc)
+ localNetHdrLen: UInt8; // <- local net header length
+ localNetTrailerLen: UInt8; // <- local net trailer length
+ localNetMaxFrame: UInt16; // <- local net maximum frame size
+
+ // media layer info
+ ifName: array [0..netIFNameLen-1] of Char; // <- interface name w/instance
+ driverUp: Boolean; // <- true if interface driver up
+ ifUp: Boolean; // <- true if interface is up
+ hwAddrLen: UInt16; // <- length of hardware address
+ hwAddr: array [0..netIFMaxHWAddrLen-1] of UInt8; // <- hardware address
+ mtu: UInt16; // <- maximum transfer unit of interface
+ speed: UInt32; // <- speed in bits/sec.
+ lastStateChange: UInt32; // <- time in milliseconds of last state change
+
+ // Address info
+ ipAddr: NetIPAddr; // Address of this interface
+ subnetMask: NetIPAddr; // subnet mask of local network
+ broadcast: NetIPAddr; // broadcast address of local network
+ end;
+
+ //.............................................................
+ // InterfaceStats command
+ //.............................................................
+
+ interfaceStats = record
+ index: UInt16; // -> index of interface
+ inOctets: UInt32; // <- ....
+ inUcastPkts: UInt32;
+ inNUcastPkts: UInt32;
+ inDiscards: UInt32;
+ inErrors: UInt32;
+ inUnknownProtos: UInt32;
+ outOctets: UInt32;
+ outUcastPkts: UInt32;
+ outNUcastPkts: UInt32;
+ outDiscards: UInt32;
+ outErrors: UInt32;
+ end;
+
+ //.............................................................
+ // IPStats command
+ //.............................................................
+
+ ipStats = record
+ 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: UInt32;
+ end;
+
+ //.............................................................
+ // ICMPStats command
+ //.............................................................
+
+ icmpStats = record
+ 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: UInt32;
+ end;
+
+ //.............................................................
+ // UDPStats command
+ //.............................................................
+
+ udpStats = record
+ udpInDatagrams: UInt32;
+ udpNoPorts: UInt32;
+ udpInErrors: UInt32;
+ udpOutDatagrams: UInt32;
+ end;
+
+ //.............................................................
+ // TCPStats command
+ //.............................................................
+
+ tcpStats = record
+ 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: UInt32;
+ end;
+
+ //.............................................................
+ // TraceEventGet command
+ //.............................................................
+
+ traceEventGet = record
+ index: UInt16; // which event
+ textP: PChar; // ptr to text string to return it in
+ end;
+
+type
+ NetMasterPBType = record
+ // These fields are specific to each command
+ case Integer of
+ 0: (interfaceInfo: interfaceInfo);
+ 1: (interfaceStats: interfaceStats);
+ 2: (ipStats: ipStats);
+ 3: (icmpStats: icmpStats);
+ 4: (udpStats: udpStats);
+ 5: (tcpStats: tcpStats);
+ 6: (traceEventGet: traceEventGet);
+ end;
+
+ NetMasterPBPtr = ^NetMasterPBType;
+
+//-----------------------------------------------------------------------------
+// Enumeration of Net settings as passed to NetLibSettingGet/Set.
+//-----------------------------------------------------------------------------
+
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Global environment settings common to all attached network interfaces,
+// passed to NetLibSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+type
+ NetSettingEnum = WordEnum;
+
+const
+ netSettingResetAll = 0; // void, NetLibSettingSet only, resets all settings
+ // to their defaults.
+
+ netSettingPrimaryDNS = Succ(netSettingResetAll); // UInt32, IP address of Primary DN Server
+ netSettingSecondaryDNS = Succ(netSettingPrimaryDNS); // UInt32, IP address of Secondary DN Server
+ netSettingDefaultRouter = Succ(netSettingSecondaryDNS); // UInt32, IP address of Default router
+ netSettingDefaultIFCreator = Succ(netSettingDefaultRouter); // UInt32, Creator type of default interface
+ netSettingDefaultIFInstance = Succ(netSettingDefaultIFCreator); // UInt16, Instance# of default interface
+ netSettingHostName = Succ(netSettingDefaultIFInstance); // Char[64], name of host (not including domain)
+ netSettingDomainName = Succ(netSettingHostName); // Char[256], domain name of hosts's domain
+ netSettingHostTbl = Succ(netSettingDomainName); // Char[], host table
+ netSettingCloseWaitTime = Succ(netSettingHostTbl); // UInt32, time in milliseconds to stay in close-wait state
+ netSettingInitialTCPResendTime = Succ(netSettingCloseWaitTime); // 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 = $1000; // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netSettingTraceSize = Succ(netSettingTraceBits); // UInt32, max trace buffer size in bytes. Default 0x800.
+ // Setting this will also clear the trace buffer.
+ netSettingTraceStart = Succ(netSettingTraceSize); // UInt32, for internal use ONLY!!
+ netSettingTraceRoll = Succ(netSettingTraceStart); // UInt8, if true, trace buffer will rollover after it fills.
+ // Default is true.
+
+ netSettingRTPrimaryDNS = Succ(netSettingTraceRoll); // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+ netSettingRTSecondaryDNS = Succ(netSettingRTPrimaryDNS); // used internally by Network interfaces
+ // that dynamically obtain the DNS address
+
+ netSettingConfigTable = Succ(netSettingRTSecondaryDNS); // used internally by NetLib - NOT FOR USE BY
+ // APPLICATIONS!!
+
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+// Settings for each Network Interface, passed to NetLibIFSettingGet/Set
+//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+type
+ NetIFSettingEnum = WordEnum;
+
+const
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Reset all settings to defaults
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingResetAll = 0; // void, NetLibIFSettingSet only, resets all settings
+ // to their defaults.
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Status - read only
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUp = Succ(netIFSettingResetAll); // UInt8, true if interface is UP.
+ netIFSettingName = Succ(netIFSettingUp); // Char[32], name of interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // Addressing
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingReqIPAddr = Succ(netIFSettingName); // UInt32, requested IP address of this interface
+ netIFSettingSubnetMask = Succ(netIFSettingReqIPAddr); // UInt32, subnet mask of this interface
+ netIFSettingBroadcast = Succ(netIFSettingSubnetMask); // UInt32, broadcast address for this interface
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // User Info
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingUsername = Succ(netIFSettingBroadcast); // Char[], login script user name
+ // If 0 length, then user will be prompted for it
+ netIFSettingPassword = Succ(netIFSettingUsername); // Char[], login script user password
+ // If 0 length, then user will be prompted for it
+ netIFSettingDialbackUsername = Succ(netIFSettingPassword); // Char[], login script dialback user name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingDialbackPassword = Succ(netIFSettingDialbackUsername); // Char[], login script dialback user password.
+ // If 0 length, then user will be prompted for it
+ netIFSettingAuthUsername = Succ(netIFSettingDialbackPassword); // Char[], PAP/CHAP name.
+ // If 0 length, then netIFSettingUsername is used
+ netIFSettingAuthPassword = Succ(netIFSettingAuthUsername); // 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 = Succ(netIFSettingAuthPassword); // Char[], name of service
+ netIFSettingLoginScript = Succ(netIFSettingServiceName); // Char[], login script
+ netIFSettingConnectLog = Succ(netIFSettingLoginScript); // Char[], connect log
+ netIFSettingInactivityTimeout = Succ(netIFSettingConnectLog); // UInt16, # of seconds of inactivity allowed before
+ // interface is brought down. If 0 then
+ // no inactivity timeout enforced.
+ netIFSettingEstablishmentTimeout = Succ(netIFSettingInactivityTimeout); // UInt16, max delay in seconds between connection
+ // establishment stages
+
+ // Serial based protocol options
+ netIFSettingDynamicIP = Succ(netIFSettingEstablishmentTimeout); // UInt8, if true, get IP address from server
+ // N/A for SLIP
+ netIFSettingVJCompEnable = Succ(netIFSettingDynamicIP); // UInt8, if true enable VJ Header compression
+ // Default is on for PPP, off for SLIP
+ netIFSettingVJCompSlots = Succ(netIFSettingVJCompEnable); // UInt8, # of slots to use for VJ compression.
+ // Default is 4 for PPP, 16 for SLIP
+ // (each slot uses 256 bytes of RAM).
+ netIFSettingMTU = Succ(netIFSettingVJCompSlots); // UInt16, maximum transmission unit in bytes
+ // ignored in current PPP and SLIP interfaces
+ netIFSettingAsyncCtlMap = Succ(netIFSettingMTU); // UInt32, bitmask of characters to escape
+ // ignored in current PPP interfaces
+
+ // Serial settings, used by serial based network interfaces
+ netIFSettingPortNum = Succ(netIFSettingAsyncCtlMap); // UInt16, port number to use
+ netIFSettingBaudRate = Succ(netIFSettingPortNum); // UInt32, baud rate in bits/sec.
+ netIFSettingFlowControl = Succ(netIFSettingBaudRate); // UInt8, flow control setting bits. Set to 0x01 for
+ // hardware flow control, else set to 0x00.
+ netIFSettingStopBits = Succ(netIFSettingFlowControl); // UInt8, # of stop bits
+ netIFSettingParityOn = Succ(netIFSettingStopBits); // UInt8, true if parity on
+ netIFSettingParityEven = Succ(netIFSettingParityOn); // UInt8, true if parity even
+
+ // Modem settings, optionally used by serial based network interfaces
+ netIFSettingUseModem = Succ(netIFSettingParityEven); // UInt8, if true dial-up through modem
+ netIFSettingPulseDial = Succ(netIFSettingUseModem); // UInt8, if true use pulse dial, else tone
+ netIFSettingModemInit = Succ(netIFSettingPulseDial); // Char[], modem initialization string
+ netIFSettingModemPhone = Succ(netIFSettingModemInit); // Char[], modem phone number string
+ netIFSettingRedialCount = Succ(netIFSettingModemPhone); // UInt16, # of times to redial
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.0
+ // Power control, usually only implemented by wireless interfaces
+ //---------------------------------------------------------------------------------
+ netIFSettingPowerUp = Succ(netIFSettingRedialCount); // 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 = Succ(netIFSettingPowerUp); // UInt8, true if this interface is wireless
+
+ // Option to query server for address of DNS servers
+ netIFSettingDNSQuery = Succ(netIFSettingWireless); // 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 = Succ(netIFSettingDNSQuery); // BYTE W-only. Power down RF on tx fail
+ netIFSettingQueueSize = Succ(netIFSettingQuitOnTxFail); // UInt8 R-only. The size of the Tx queue in the RF interface
+ netIFSettingTxInQueue = Succ(netIFSettingQueueSize); // BYTE R-only. Packets remaining to be sent
+ netIFSettingTxSent = Succ(netIFSettingTxInQueue); // BYTE R-only. Packets sent since SocketOpen
+ netIFSettingTxDiscard = Succ(netIFSettingTxSent); // BYTE R-only. Packets discarded on SocketClose
+ netIFSettingRssi = Succ(netIFSettingTxDiscard); // char R-only. signed value in dBm.
+ netIFSettingRssiAsPercent = Succ(netIFSettingRssi); // char R-only. signed value in percent, with 0 being no coverage and 100 being excellent.
+ netIFSettingRadioState = Succ(netIFSettingRssiAsPercent); // enum R-only. current state of the radio
+ netIFSettingBase = Succ(netIFSettingRadioState); // UInt32 R-only. Interface specific
+ netIFSettingRadioID = Succ(netIFSettingBase); // UInt32[2] R-only, two 32-bit. interface specific
+ netIFSettingBattery = Succ(netIFSettingRadioID); // UInt8, R-only. percentage of battery left
+ netIFSettingNetworkLoad = Succ(netIFSettingBattery); // UInt8, R-only. percent estimate of network loading
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 3.3
+ //---------------------------------------------------------------------------------
+
+ netIFSettingConnectionName = Succ(netIFSettingNetworkLoad); // Char [] Connection Profile Name
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // The following settings are not used for configuration, but rather put the
+ // stack into various modes for debugging, etc.
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingTraceBits = $1000; // UInt32, enable/disable various trace flags (netTraceBitXXXX)
+ netIFSettingGlobalsPtr = Succ(netIFSettingTraceBits); // UInt32, (Read-Only) sinterface's globals ptr
+ netIFSettingActualIPAddr = Succ(netIFSettingGlobalsPtr); // 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 = Succ(netIFSettingActualIPAddr); // 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 = Succ(netIFSettingServerIPAddr); // 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 = Succ(netIFSettingBringDownOnPowerDown); // UInt32, parameter to pass to raw_rcv() along with
+ // packet pointer.
+
+ //---------------------------------------------------------------------------------
+ // New Settings as of PalmOS 4.0
+ //---------------------------------------------------------------------------------
+
+ // The following setting is a new interface in PalmOS 4.0 that allow INetlib
+ // or other NetLib clients to get raw location information as described in
+ // PalmLocRawData.h.
+ // NetLib will return a pointer to a newly allocated memory buffer containing
+ // the raw location information to send to Elaine (Web Clipping proxy server).
+ // Elaine will then use a Windows DLL to analyse the raw location information
+ // in order to transform it into something useful like zipcode, cityname, etc.
+ // See PalmLocRawData.h for more details...
+ netIFSettingLocRawInfo = Succ(netIFSettingRawMode); // void* R-only: Allocated memory buffer - must be free by caller
+
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ // 3rd party settings start here...
+ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ netIFSettingCustom = $8000;
+
+//=========================================================================================
+// Enums for the netIFSettingRadioState setting
+//
+// JB added for the radio state setting.
+// <chg 3-17-98 RM> fixed naming conventions.
+//=========================================================================================
+
+type
+ NetRadioStateEnum = Enum;
+
+const
+ netRadioStateOffNotConnected = 0;
+ netRadioStateOnNotConnected = Succ(netRadioStateOffNotConnected); // scanning
+ netRadioStateOnConnected = Succ(netRadioStateOnNotConnected); // have channel
+ netRadioStateOffConnected = Succ(netRadioStateOnConnected);
+
+(************************************************************
+ * Net Library Macros
+ *************************************************************)
+
+// Return current time in milliseconds.
+function NetNow: UInt32;
+
+// File Descriptor macros used for the NetLibSelect() call
+type
+ NetFDSetType = UInt32;
+ NetFDSetPtr = ^NetFDSetType;
+
+const
+ netFDSetSize = 32;
+
+procedure netFDSet(n: UInt8; var p: NetFDSetType);
+procedure nnetFDClr(n: UInt8; var p: NetFDSetType);
+function nnetFDIsSet(n: UInt8; var p: NetFDSetType): Boolean;
+procedure nnetFDZero(var p: NetFDSetType);
+
+//-----------------------------------------------------------------------------
+// Net error codes
+//-----------------------------------------------------------------------------
+
+const
+ netErrAlreadyOpen = netErrorClass or 1;
+ netErrNotOpen = netErrorClass or 2;
+ netErrStillOpen = netErrorClass or 3;
+ netErrParamErr = netErrorClass or 4;
+ netErrNoMoreSockets = netErrorClass or 5;
+ netErrOutOfResources = netErrorClass or 6;
+ netErrOutOfMemory = netErrorClass or 7; // Might be because free heap space is <32K probably because handheld's RAM <2MB
+ netErrSocketNotOpen = netErrorClass or 8;
+ netErrSocketBusy = netErrorClass or 9; //EINPROGRESS
+ netErrMessageTooBig = netErrorClass or 10;
+ netErrSocketNotConnected = netErrorClass or 11;
+ netErrNoInterfaces = netErrorClass or 12; //ENETUNREACH
+ netErrBufTooSmall = netErrorClass or 13;
+ netErrUnimplemented = netErrorClass or 14;
+ netErrPortInUse = netErrorClass or 15; //EADDRINUSE
+ netErrQuietTimeNotElapsed = netErrorClass or 16; //EADDRINUSE
+ netErrInternal = netErrorClass or 17;
+ netErrTimeout = netErrorClass or 18; //ETIMEDOUT
+ netErrSocketAlreadyConnected = netErrorClass or 19; //EISCONN
+ netErrSocketClosedByRemote = netErrorClass or 20;
+ netErrOutOfCmdBlocks = netErrorClass or 21;
+ netErrWrongSocketType = netErrorClass or 22;
+ netErrSocketNotListening = netErrorClass or 23;
+ netErrUnknownSetting = netErrorClass or 24;
+ netErrInvalidSettingSize = netErrorClass or 25;
+ netErrPrefNotFound = netErrorClass or 26;
+ netErrInvalidInterface = netErrorClass or 27;
+ netErrInterfaceNotFound = netErrorClass or 28;
+ netErrTooManyInterfaces = netErrorClass or 29;
+ netErrBufWrongSize = netErrorClass or 30;
+ netErrUserCancel = netErrorClass or 31;
+ netErrBadScript = netErrorClass or 32;
+ netErrNoSocket = netErrorClass or 33;
+ netErrSocketRcvBufFull = netErrorClass or 34;
+ netErrNoPendingConnect = netErrorClass or 35;
+ netErrUnexpectedCmd = netErrorClass or 36;
+ netErrNoTCB = netErrorClass or 37;
+ netErrNilRemoteWindowSize = netErrorClass or 38;
+ netErrNoTimerProc = netErrorClass or 39;
+ netErrSocketInputShutdown = netErrorClass or 40; // EOF to sockets API
+ netErrCmdBlockNotCheckedOut = netErrorClass or 41;
+ netErrCmdNotDone = netErrorClass or 42;
+ netErrUnknownProtocol = netErrorClass or 43;
+ netErrUnknownService = netErrorClass or 44;
+ netErrUnreachableDest = netErrorClass or 45;
+ netErrReadOnlySetting = netErrorClass or 46;
+ netErrWouldBlock = netErrorClass or 47; //EWOULDBLOCK
+ netErrAlreadyInProgress = netErrorClass or 48; //EALREADY
+ netErrPPPTimeout = netErrorClass or 49;
+ netErrPPPBroughtDown = netErrorClass or 50;
+ netErrAuthFailure = netErrorClass or 51;
+ netErrPPPAddressRefused = netErrorClass or 52;
+// The following map into the Epilogue DNS errors declared in DNS.ep.h:
+// and MUST be kept in this order!!
+ netErrDNSNameTooLong = netErrorClass or 53;
+ netErrDNSBadName = netErrorClass or 54;
+ netErrDNSBadArgs = netErrorClass or 55;
+ netErrDNSLabelTooLong = netErrorClass or 56;
+ netErrDNSAllocationFailure = netErrorClass or 57;
+ netErrDNSTimeout = netErrorClass or 58;
+ netErrDNSUnreachable = netErrorClass or 59;
+ netErrDNSFormat = netErrorClass or 60;
+ netErrDNSServerFailure = netErrorClass or 61;
+ netErrDNSNonexistantName = netErrorClass or 62;
+ netErrDNSNIY = netErrorClass or 63;
+ netErrDNSRefused = netErrorClass or 64;
+ netErrDNSImpossible = netErrorClass or 65;
+ netErrDNSNoRRS = netErrorClass or 66;
+ netErrDNSAborted = netErrorClass or 67;
+ netErrDNSBadProtocol = netErrorClass or 68;
+ netErrDNSTruncated = netErrorClass or 69;
+ netErrDNSNoRecursion = netErrorClass or 70;
+ netErrDNSIrrelevant = netErrorClass or 71;
+ netErrDNSNotInLocalCache = netErrorClass or 72;
+ netErrDNSNoPort = netErrorClass or 73;
+// The following map into the Epilogue IP errors declared in IP.ep.h:
+// and MUST be kept in this order!!
+ netErrIPCantFragment = netErrorClass or 74;
+ netErrIPNoRoute = netErrorClass or 75;
+ netErrIPNoSrc = netErrorClass or 76;
+ netErrIPNoDst = netErrorClass or 77;
+ netErrIPktOverflow = netErrorClass or 78;
+// End of Epilogue IP errors
+ netErrTooManyTCPConnections = netErrorClass or 79;
+ netErrNoDNSServers = netErrorClass or 80;
+ netErrInterfaceDown = netErrorClass or 81;
+
+// Mobitex network radio interface error code returns
+ netErrNoChannel = netErrorClass or 82; // The datalink layer cannot acquire a channel
+ netErrDieState = netErrorClass or 83; // Mobitex network has issued a DIE command.
+ netErrReturnedInMail = netErrorClass or 84; // The addressed of the transmitted packet was not available, and the message was placed in the network's mailbox.
+ netErrReturnedNoTransfer = netErrorClass or 85; // This message cannot be transferred or put in the network mailbox.
+ netErrReturnedIllegal = netErrorClass or 86; // The message could not be switched to the network
+ netErrReturnedCongest = netErrorClass or 87; // Line, radio channels, or network nodes are congested.
+ netErrReturnedError = netErrorClass or 88; // Technical error in the network.
+ netErrReturnedBusy = netErrorClass or 89; // The B-party is busy.
+ netErrGMANState = netErrorClass or 90; // The modem has not registered with the network.
+ netErrQuitOnTxFail = netErrorClass or 91; // Couldn't get packet through, shutdown.
+ netErrFlexListFull = netErrorClass or 92; // raw IF error message: see Mobitex spec.
+ netErrSenderMAN = netErrorClass or 93; // ditto
+ netErrIllegalType = netErrorClass or 94; // ditto
+ netErrIllegalState = netErrorClass or 95; // ditto
+ netErrIllegalFlags = netErrorClass or 96; // ditto
+ netErrIllegalSendlist = netErrorClass or 97; // ditto
+ netErrIllegalMPAKLength = netErrorClass or 98; // ditto
+ netErrIllegalAddressee = netErrorClass or 99; // ditto
+ netErrIllegalPacketClass = netErrorClass or 100; // ditto
+ netErrBufferLength = netErrorClass or 101; // any
+ netErrNiCdLowBattery = netErrorClass or 102; // any
+ netErrRFinterfaceFatal = netErrorClass or 103; // any
+ netErrIllegalLogout = netErrorClass or 104; // raw IF error message
+ netErrAAARadioLoad = netErrorClass or 105; // 7/20/98 JB. If there is insufficient AAA
+ netErrAntennaDown = netErrorClass or 106;
+ netErrNiCdCharging = netErrorClass or 107; // just for charging
+ netErrAntennaWentDown = netErrorClass or 108;
+ netErrNotActivated = netErrorClass or 109; // The unit has not been FULLY activated. George and Morty completed.
+ netErrRadioTemp = netErrorClass or 110; // Radio's temp is too high for FCC compliant TX
+ netErrNiCdChargeError = netErrorClass or 111; // Charging stopped due to NiCd charging characteristic
+ netErrNiCdSag = netErrorClass or 112; // the computed sag or actual sag indicates a NiCd with diminished capacity.
+ netErrNiCdChargeSuspend = netErrorClass or 113; // Charging has been suspended due to low AAA batteries.
+// Left room for more Mobitex errors
+
+// Configuration errors
+ netErrConfigNotFound = netErrorClass or 115;
+ netErrConfigCantDelete = netErrorClass or 116;
+ netErrConfigTooMany = netErrorClass or 117;
+ netErrConfigBadName = netErrorClass or 118;
+ netErrConfigNotAlias = netErrorClass or 119;
+ netErrConfigCantPointToAlias = netErrorClass or 120;
+ netErrConfigEmpty = netErrorClass or 121;
+ netErrAlreadyOpenWithOtherConfig = netErrorClass or 122;
+ netErrConfigAliasErr = netErrorClass or 123;
+ netErrNoMultiPktAddr = netErrorClass or 124;
+ netErrOutOfPackets = netErrorClass or 125;
+ netErrMultiPktAddrReset = netErrorClass or 126;
+ netErrStaleMultiPktAddr = netErrorClass or 127;
+
+// Login scripting plugin errors
+ netErrScptPluginMissing = netErrorClass or 128;
+ netErrScptPluginLaunchFail = netErrorClass or 129;
+ netErrScptPluginCmdFail = netErrorClass or 130;
+ netErrScptPluginInvalidCmd = netErrorClass or 131;
+
+ // Telephony errors
+ netErrTelMissingComponent = netErrorClass or 132;
+ netErrTelErrorNotHandled = netErrorClass or 133;
+
+ netErrMobitexStart = netErrNoChannel;
+ 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!!!
+//-----------------------------------------------------------------------------
+
+type
+ NetLibTrapNumberEnum = Enum;
+
+const
+ netLibTrapAddrINToA = sysLibTrapCustom;
+ netLibTrapAddrAToIN = Succ(netLibTrapAddrINToA);
+
+ netLibTrapSocketOpen = Succ(netLibTrapAddrAToIN);
+ netLibTrapSocketClose = Succ(netLibTrapSocketOpen);
+ netLibTrapSocketOptionSet = Succ(netLibTrapSocketClose);
+ netLibTrapSocketOptionGet = Succ(netLibTrapSocketOptionSet);
+ netLibTrapSocketBind = Succ(netLibTrapSocketOptionGet);
+ netLibTrapSocketConnect = Succ(netLibTrapSocketBind);
+ netLibTrapSocketListen = Succ(netLibTrapSocketConnect);
+ netLibTrapSocketAccept = Succ(netLibTrapSocketListen);
+ netLibTrapSocketShutdown = Succ(netLibTrapSocketAccept);
+
+ netLibTrapSendPB = Succ(netLibTrapSocketShutdown);
+ netLibTrapSend = Succ(netLibTrapSendPB);
+ netLibTrapReceivePB = Succ(netLibTrapSend);
+ netLibTrapReceive = Succ(netLibTrapReceivePB);
+ netLibTrapDmReceive = Succ(netLibTrapReceive);
+ netLibTrapSelect = Succ(netLibTrapDmReceive);
+
+ netLibTrapPrefsGet = Succ(netLibTrapSelect);
+ netLibTrapPrefsSet = Succ(netLibTrapPrefsGet);
+
+ // The following traps are for internal and Network interface
+ // use only.
+ netLibTrapDrvrWake = Succ(netLibTrapPrefsSet);
+ netLibTrapInterfacePtr = Succ(netLibTrapDrvrWake);
+ netLibTrapMaster = Succ(netLibTrapInterfacePtr);
+
+ // New Traps
+ netLibTrapGetHostByName = Succ(netLibTrapMaster);
+ netLibTrapSettingGet = Succ(netLibTrapGetHostByName);
+ netLibTrapSettingSet = Succ(netLibTrapSettingGet);
+ netLibTrapIFAttach = Succ(netLibTrapSettingSet);
+ netLibTrapIFDetach = Succ(netLibTrapIFAttach);
+ netLibTrapIFGet = Succ(netLibTrapIFDetach);
+ netLibTrapIFSettingGet = Succ(netLibTrapIFGet);
+ netLibTrapIFSettingSet = Succ(netLibTrapIFSettingGet);
+ netLibTrapIFUp = Succ(netLibTrapIFSettingSet);
+ netLibTrapIFDown = Succ(netLibTrapIFUp);
+ netLibTrapIFMediaUp = Succ(netLibTrapIFDown);
+ netLibTrapScriptExecuteV32 = Succ(netLibTrapIFMediaUp);
+ netLibTrapGetHostByAddr = Succ(netLibTrapScriptExecuteV32);
+ netLibTrapGetServByName = Succ(netLibTrapGetHostByAddr);
+ netLibTrapSocketAddr = Succ(netLibTrapGetServByName);
+ netLibTrapFinishCloseWait = Succ(netLibTrapSocketAddr);
+ netLibTrapGetMailExchangeByName = Succ(netLibTrapFinishCloseWait);
+ netLibTrapPrefsAppend = Succ(netLibTrapGetMailExchangeByName);
+ netLibTrapIFMediaDown = Succ(netLibTrapPrefsAppend);
+ netLibTrapOpenCount = Succ(netLibTrapIFMediaDown);
+
+ netLibTrapTracePrintF = Succ(netLibTrapOpenCount);
+ netLibTrapTracePutS = Succ(netLibTrapTracePrintF);
+
+ netLibTrapOpenIfCloseWait = Succ(netLibTrapTracePutS);
+ netLibTrapHandlePowerOff = Succ(netLibTrapOpenIfCloseWait);
+
+ netLibTrapConnectionRefresh = Succ(netLibTrapHandlePowerOff);
+
+ // Traps added after 1.0 release of NetLib
+ netLibTrapBitMove = Succ(netLibTrapConnectionRefresh);
+ netLibTrapBitPutFixed = Succ(netLibTrapBitMove);
+ netLibTrapBitGetFixed = Succ(netLibTrapBitPutFixed);
+ netLibTrapBitPutUIntV = Succ(netLibTrapBitGetFixed);
+ netLibTrapBitGetUIntV = Succ(netLibTrapBitPutUIntV);
+ netLibTrapBitPutIntV = Succ(netLibTrapBitGetUIntV);
+ netLibTrapBitGetIntV = Succ(netLibTrapBitPutIntV);
+
+ // Traps added after 2.0 release of NetLib
+ netLibOpenConfig_ = Succ(netLibTrapBitGetIntV);
+ netLibConfigMakeActive_ = Succ(netLibOpenConfig_);
+ netLibConfigList_ = Succ(netLibConfigMakeActive_);
+ netLibConfigIndexFromName_ = Succ(netLibConfigList_);
+ netLibConfigDelete_ = Succ(netLibConfigIndexFromName_);
+ netLibConfigSaveAs_ = Succ(netLibConfigDelete_);
+ netLibConfigRename_ = Succ(netLibConfigSaveAs_);
+ netLibConfigAliasSet_ = Succ(netLibConfigRename_);
+ netLibConfigAliasGet_ = Succ(netLibConfigAliasSet_);
+
+ // Traps added after 3.2 release of NetLib
+ netLibTrapScriptExecute = Succ(netLibConfigAliasGet_);
+
+ netLibTrapLast = Succ(netLibTrapScriptExecute);
+
+(************************************************************
+ * Net Library procedures.
+ *************************************************************)
+
+//--------------------------------------------------
+// Library initialization, shutdown, sleep and wake
+//--------------------------------------------------
+
+function NetLibOpen(libRefnum: UInt16; var netIFErrsP: UInt16): Err; syscall sysLibTrapOpen;
+
+function NetLibClose(libRefnum: UInt16; immediate: UInt16): Err; syscall sysLibTrapClose;
+
+function NetLibSleep(libRefnum: UInt16): Err; syscall sysLibTrapSleep;
+
+function NetLibWake(libRefnum: UInt16): Err; syscall 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.
+function NetLibFinishCloseWait(libRefnum: UInt16): Err; syscall 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
+function NetLibOpenIfCloseWait(libRefnum: UInt16): Err; syscall netLibTrapOpenIfCloseWait;
+
+// Get the open Count of the NetLib
+function NetLibOpenCount(refNum: UInt16; var countP: UInt16): Err; syscall 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
+
+function NetLibHandlePowerOff(refNum: UInt16; var eventP: SysEventType): Err; syscall netLibTrapHandlePowerOff;
+
+// 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.
+function NetLibConnectionRefresh(refNum: UInt16; refresh: Boolean;
+ var allInterfacesUpP: UInt8; var netIFErrP: UInt16): Err; syscall netLibTrapConnectionRefresh;
+
+//--------------------------------------------------
+// Net address translation and conversion routines.
+//--------------------------------------------------
+
+// (The NetHToNS, NetHToNL, NetNToHS, and NetNToHL macros which used to be
+// defined here are now defined in NetBitUtils.h. They can still be used
+// by #including <NetMgr.h> (this file), because <NetBitUtils.h> is
+// unconditionally included below.)
+
+// convert host Int16 to network Int16
+function NetHToNS(x: Int16): Int16;
+
+// convert host long to network long
+function NetHToNL(x: Int32): Int32;
+
+// convert network Int16 to host Int16
+function NetNToHS(x: Int16): Int16;
+
+// convert network long to host long
+function NetNToHL(x: Int32): Int32;
+
+// 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.
+function NetLibAddrINToA(libRefnum: UInt16; inet: NetIPAddr; spaceP: PChar): PChar; syscall netLibTrapAddrINToA;
+
+// Convert a dotted decimal ascii string format of an IP address into
+// a 32-bit value.
+function NetLibAddrAToIN(libRefnum: UInt16; const a: PChar): NetIPAddr; syscall 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.
+function NetLibSocketOpen(libRefnum: UInt16; domain: NetSocketAddrEnum;
+ type_: NetSocketTypeEnum; protocol: Int16; timeout: Int32;
+ var errP: Err): NetSocketRef; syscall netLibTrapSocketOpen;
+
+// Close a socket.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+function NetLibSocketClose(libRefnum: UInt16; socket: NetSocketRef; timeout: Int32;
+ var errP: Err): Int16; syscall 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.
+function NetLibSocketOptionSet(libRefnum: UInt16; socket: NetSocketRef;
+ level: UInt16 {NetSocketOptLevelEnum}; option: UInt16 {NetSocketOptEnum};
+ optValueP: Pointer; optValueLen: UInt16;
+ timeout: Int32; var errP: Err): Int16; syscall netLibTrapSocketOptionSet;
+
+// Get a socket option.
+// Returns 0 on success, -1 on error. If error, *errP gets filled in with error code.
+function NetLibSocketOptionGet(libRefnum: UInt16; socket: NetSocketRef;
+ level: UInt16 {NetSocketOptLevelEnum}; option: UInt16 {NetSocketOptEnum};
+ optValueP: Pointer; var optValueLenP: UInt16;
+ timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibSocketBind(libRefnum: UInt16; socket: NetSocketRef;
+ sockAddrP: NetSocketAddrPtr; addrLen: Int16; timeout: Int32;
+ var errP: Err): Int16; syscall 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.
+function NetLibSocketConnect(libRefnum: UInt16; socket: NetSocketRef;
+ sockAddrP: NetSocketAddrPtr; addrLen: Int16; timeout: Int32;
+ var errP: Err): Int16; syscall 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.
+function NetLibSocketListen(libRefnum: UInt16; socket: NetSocketRef;
+ queueLen: UInt16; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibSocketAccept(libRefnum: UInt16; socket: NetSocketRef;
+ sockAddrP: NetSocketAddrPtr; var addrLenP: Int16; timeout: Int32;
+ var errP: Err): Int16; syscall 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.
+function NetLibSocketShutdown(libRefnum: UInt16; socket: NetSocketRef;
+ direction: Int16 {NetSocketDirEnum}; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibSocketAddr(libRefnum: UInt16; socketRef: NetSocketRef;
+ locAddrP: NetSocketAddrPtr; var locAddrLenP: Int16;
+ remAddrP: NetSocketAddrPtr; var remAddrLenP: Int16;
+ timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibSendPB(libRefNum: UInt16; socket: NetSocketRef;
+ pbP: NetIOParamPtr; flags: UInt16; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibSend(libRefNum: UInt16; socket: NetSocketRef;
+ bufP: Pointer; bufLen, flags: UInt16;
+ toAddrP: Pointer; toLen: UInt16; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibReceivePB(libRefNum: UInt16; socket: NetSocketRef;
+ pbP: NetIOParamPtr; flags: UInt16; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibReceive(libRefNum: UInt16; socket: NetSocketRef;
+ bufP: Pointer; bufLen, flags: UInt16;
+ fromAddrP: Pointer; var fromLenP: UInt16; timeout: Int32; var errP: Err): Int16; syscall 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.
+function NetLibDmReceive(libRefNum: UInt16; socket: NetSocketRef;
+ recordP: Pointer; recordOffset: UInt32; rcvLen, flags: UInt16;
+ fromAddrP: Pointer; var fromLenP: UInt16; timeout: Int32; var errP: Err): Int16; syscall netLibTrapDmReceive;
+
+//--------------------------------------------------
+// Name Lookups
+//--------------------------------------------------
+
+function NetLibGetHostByName(libRefNum: UInt16; const nameP: PChar; bufP: NetHostInfoBufPtr; timeout: Int32; var errP: Err): NetHostInfoPtr; syscall netLibTrapGetHostByName;
+
+
+function NetLibGetHostByAddr(libRefNum: UInt16; var addrP: UInt8; len, type_: UInt16;
+ bufP: NetHostInfoBufPtr; timeout: Int32; var errP: Err): NetHostInfoPtr; syscall netLibTrapGetHostByAddr;
+
+function NetLibGetServByName(libRefNum: UInt16; const servNameP: PChar;
+ const protoNameP: PChar; bufP: NetServInfoBufPtr;
+ timeout: Int32; var errP: Err): NetServInfoPtr; syscall 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.
+function NetLibGetMailExchangeByName(libRefNum: UInt16; mailNameP: PChar;
+ maxEntries: UInt16; hostNames: Pointer{Char hostNames[][netDNSMaxDomainName+1]};
+ priorities: Pointer{UInt16 priorities[]};
+ timeout: Int32; var errP: Err): Int16; syscall netLibTrapGetMailExchangeByName;
+
+//--------------------------------------------------
+// Interface setup
+//--------------------------------------------------
+
+function NetLibIFGet(libRefNum: UInt16; index: UInt16; var ifCreatorP: UInt32; var ifInstanceP: UInt16): Err; syscall netLibTrapIFGet;
+
+function NetLibIFAttach(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16; timeout: Int32): Err; syscall netLibTrapIFAttach;
+
+function NetLibIFDetach(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16; timeout: Int32): Err; syscall netLibTrapIFDetach;
+
+function NetLibIFUp(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16): Err; syscall netLibTrapIFUp;
+
+function NetLibIFDown(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16; timeout: Int32): Err; syscall netLibTrapIFDown;
+
+//--------------------------------------------------
+// Settings
+//--------------------------------------------------
+// General settings
+function NetLibSettingGet(libRefNum: UInt16; setting: UInt16 {NetSettingEnum}; valueP: Pointer; var valueLenP: UInt16): Err; syscall netLibTrapSettingGet;
+
+function NetLibSettingSet(libRefNum: UInt16; setting: UInt16 {NetSettingEnum}; valueP: Pointer; valueLen: UInt16): Err; syscall netLibTrapSettingSet;
+
+// Network interface specific settings.
+function NetLibIFSettingGet(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16;
+ setting: UInt16 {NetIFSettingEnum}; valueP: Pointer; var valueLenP: UInt16): Err; syscall netLibTrapIFSettingGet;
+
+function NetLibIFSettingSet(libRefNum: UInt16; ifCreator: UInt32; ifInstance: UInt16;
+ setting: UInt16 {NetIFSettingEnum}; valueP: Pointer; valueLen: UInt16): Err; syscall netLibTrapIFSettingSet;
+
+//--------------------------------------------------
+// System level
+//--------------------------------------------------
+
+function NetLibSelect(libRefNum: UInt16; width: UInt16; readFDs, writeFDs, exceptFDs: NetFDSetPtr;
+ timeout: Int32; var errP: Err): Int16; syscall netLibTrapSelect;
+
+//--------------------------------------------------
+// Debugging support
+//--------------------------------------------------
+
+function NetLibMaster(libRefNum: UInt16; cmd: UInt16; pbP: NetMasterPBPtr;
+ timeout: Int32): Err; syscall netLibTrapMaster;
+
+{!!!
+function NetLibTracePrintF(libRefNum: UInt16; const formatStr: PChar; ...): Err; syscall netLibTrapTracePrintF;
+!!!}
+
+function NetLibTracePutS(libRefNum: UInt16; strP: PChar): Err; syscall netLibTrapTracePutS;
+
+//--------------------------------------------------
+// Configuration Calls
+//--------------------------------------------------
+
+function NetLibOpenConfig(refNum: UInt16; configIndex: UInt16; openFlags: UInt32;
+ var netIFErrP: UInt16): Err; syscall netLibOpenConfig_;
+
+function NetLibConfigMakeActive(refNum: UInt16; configIndex: UInt16): Err; syscall netLibConfigMakeActive_;
+
+function NetLibConfigList(refNum: UInt16; nameArray: Pointer {NetConfigNameType nameArray[]};
+ var arrayEntriesP: UInt16): Err; syscall netLibConfigList_;
+
+function NetLibConfigIndexFromName(refNum: UInt16; nameP: NetConfigNamePtr;
+ var indexP: UInt16): Err; syscall netLibConfigIndexFromName_;
+
+function NetLibConfigDelete(refNum: UInt16; index: UInt16): Err; syscall netLibConfigDelete_;
+
+function NetLibConfigSaveAs(refNum: UInt16; nameP: NetConfigNamePtr): Err; syscall netLibConfigSaveAs_;
+
+function NetLibConfigRename(refNum: UInt16; index: UInt16; newNameP: NetConfigNamePtr): Err; syscall netLibConfigRename_;
+
+function NetLibConfigAliasSet(refNum: UInt16; configIndex, aliasToIndex: UInt16): Err; syscall netLibConfigAliasSet_;
+
+function NetLibConfigAliasGet(refNum: UInt16; aliasIndex: UInt16; var indexP: UInt16; var isAnotherAliasP: Boolean): Err; syscall netLibConfigAliasGet_;
+
+implementation
+
+uses SystemMgr, TimeMgr;
+
+function NetNow: UInt32;
+begin
+ NetNow := TimGetTicks * 1000 div sysTicksPerSecond;
+end;
+
+procedure netFDSet(n: UInt8; var p: NetFDSetType);
+begin
+ p := p or (1 shl n);
+end;
+
+procedure nnetFDClr(n: UInt8; var p: NetFDSetType);
+begin
+ p := p and not (1 shl n);
+end;
+
+function nnetFDIsSet(n: UInt8; var p: NetFDSetType): Boolean;
+begin
+ nnetFDIsSet := (p and (1 shl n)) <> 0;
+end;
+
+procedure nnetFDZero(var p: NetFDSetType);
+begin
+ p := 0;
+end;
+
+// convert host Int16 to network Int16
+function NetHToNS(x: Int16): Int16;
+begin
+ NetHToNS := x;
+end;
+
+// convert host long to network long
+function NetHToNL(x: Int32): Int32;
+begin
+ NetHToNL := x;
+end;
+
+// convert network Int16 to host Int16
+function NetNToHS(x: Int16): Int16;
+begin
+ NetNToHS := x;
+end;
+
+// convert network long to host long
+function NetNToHL(x: Int32): Int32;
+begin
+ NetNToHL := x;
+end;
+
+end.
diff --git a/packages/palmunits/src/notifymgr.pp b/packages/palmunits/src/notifymgr.pp
new file mode 100644
index 0000000000..3de470951f
--- /dev/null
+++ b/packages/palmunits/src/notifymgr.pp
@@ -0,0 +1,397 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: NotifyMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Notification Manager
+ *
+ * History:
+ * 6/15/98 JED - Created by Jesse Donaldson
+ * 12/23/99 jmp - Fix <> vs. "" problem.
+ * 10/19/00 PPL - Change cncNotifyCurrentConfigurationChange 'conf'
+ * to cncNotifyProfileEvent 'cncp'
+ *
+ *****************************************************************************)
+
+unit notifymgr;
+
+interface
+
+uses palmos, coretraps, datamgr, localemgr, systemresources;
+
+type
+ SysNotifyParamType = record
+ notifyType: UInt32; // What type of event occurred?
+ broadcaster: UInt32; // normally creator code of broadcasting app
+ notifyDetailsP: Pointer; // ptr to notification-specific data, if any
+ userDataP: Pointer; // user specified ptr passed back with notification
+ handled: Boolean; // true if event is handled yet
+ reserved2: UInt8;
+ end;
+
+type
+ SysNotifyProc = function (var notifyParamsP: SysNotifyParamType): Err;
+ SysNotifyProcPtr = SysNotifyProc;
+
+const
+ sysNotifyNormalPriority = 0; // clients should use this priority
+
+ sysNotifyBroadcasterCode = sysFileCSystem; // broadcaster code for events broadcast by the system
+
+ sysNotifyNoDatabaseID = $FFFFFFFF; // for system use only!!!
+
+ sysNotifyVersionNum = 1; // version of the NotifyMgr, obtained from the feature
+
+// The queue is much smaller in debug builds so that we aren't tempted to overflow it
+// (and larger for release builds so that when we do, it will work).
+
+ sysNotifyDefaultQueueSize = 30;
+
+(*
+ Notify Manager Events:
+
+ Note that in general, for notifications regarding the creation of information
+ (e.g. sysNotifyDBAddedEvent) the broadcast goes out AFTER the fact (e.g.,
+ after the database has been created) and that notifications regarding
+ the deletion of information are broadcast BEFORE the fact. A notable and
+ unfortunate exception to this rule is the database deleted notification, which
+ is sent out after the fact.
+
+ The sleep & wake notifications require a little special attention. These
+ notifications are _not_ guaranteed to always be broadcast, and hence are unsuitable
+ for applications where syscall hardware must be shut off to conserve power when
+ we go to sleep. For example, the sleep notification will not be broadcast when
+ we do an emergency shutdown due to low battery conditions. Also note that any
+ sort of prolonged activity (especially displaying UI sich as a dialog) in response
+ to these noticfications can complicate things immensely. UI is very tricky because
+ these notifications are broadcast from SysHandleEvent. The result is that you may
+ receive more than one sleep notification if one of the notification clients puts up
+ a dialog or something, and it remains there long enough for another AutoOff event
+ to come through. There are also possible problems with reentrancy and stack space
+ usage since the notification is broadcast from SysHandleEvent inside an application's
+ event loop.
+*)
+
+ sysNotifySyncStartEvent = Rsc('hots');
+ // Sent at the start of a hotsync.
+ // Always sent from UI thread.
+ // param: none
+
+ sysNotifySyncFinishEvent = Rsc('sync');
+ // Sent at the end of a hotsync.
+ // Always sent from UI thread.
+ // param: none
+
+ sysNotifyAntennaRaisedEvent = Rsc('tena');
+ // Sent when the antenna is raised on a
+ // Palm VII series device.
+ // Always sent from UI thread.
+ // param: none
+
+ sysNotifyResetFinishedEvent = Rsc('rstf');
+ // Broadcast after all app launchcodes
+ // are sent after a reset.
+ // Always sent from UI thread.
+ // param: none
+
+ sysNotifyForgotPasswordEvent = Rsc('bozo');
+ // Broadcast when the user presses the
+ // 'Forgotten Password' button in the
+ // security app, just before every database's
+ // private records are deleted.
+
+ sysNotifyTimeChangeEvent = Rsc('time');
+ // Broadcast when the time is changed by the user.
+ // param: Int32*, ptr to time change delta in
+ // seconds (e.g., a value of 100 means that the
+ // user set the clock ahead 100 seconds).
+
+ sysNotifySleepRequestEvent = Rsc('slpq');
+ // A "Sleep Request Event" is broadcast when the device
+ // is about to go to sleep, and is a chance for clients
+ // to do perform an action or even delay going to sleep
+ // for a little while. This may be broadcast multiple
+ // times if one or more clients defer the sleep. Parameter
+ // is a pointer to a SleepEventParamType. See below
+ // details on this structure. Note that this event is
+ // NOT guaranteed to be broadcast. See the big comment
+ // at the top of this list for important detials & warnings.
+ // Always sent from UI thread.
+
+ sysNotifySleepNotifyEvent = Rsc('slp!');
+ // A "Sleep Notify Event" is broadcast when the device is
+ // definitely going to sleep as soon as the broadcast
+ // is finished. Parameter is unused.
+ // Note that this event is NOT guaranteed to be broadcast.
+ // See the big comment at the top of this list for
+ // important detials & warnings.
+ // Always sent from UI thread.
+
+ sysNotifyEarlyWakeupEvent = Rsc('worm');
+ // ...the early bird gets the worm...
+ // Broadcast just after the device wakes up
+ // at the early stage where the screen may
+ // still be turned off and we may quickly go
+ // back to sleep after handling an alarm or
+ // charger event.
+ // Always sent from UI thread.
+
+ sysNotifyLateWakeupEvent = Rsc('lazy');
+ // Broadcast after the device wakes up
+ // at the later stage of the wakeup
+ // process after we turn the screen on,
+ // broadcast from EvtResetAutoOffEvent
+ // the first time it is called implying
+ // that the device will remain awake
+ // for at least a little while.
+ // Always sent from UI thread.
+
+ sysNotifyDisplayChangeEvent = Rsc('scrd');
+ // Sent when the display depth is
+ // changed, notifyDetailsP has old/new depth
+ // see SysNotifyDisplayChangeDetailsType
+
+ sysNotifyMenuCmdBarOpenEvent = Rsc('cbar');
+ // Sent by FormHandleEvent when a menuCmdBarOpenEvent
+ // passes through. The system will not open the toolbar
+ // if the 'handled' field is set in the parameter block,
+ // so most clients should not set it. The notification
+ // is provided so that Hack-like entities can catch
+ // it and add their own buttons to the bar. These
+ // buttons will show up to the left of cut/copy/paste/undo and
+ // to the right of everything else. Without this
+ // notification, people would hack SysHandleEvent... ick.
+
+ cncNotifyProfileEvent = Rsc('cncp');
+ // sent by the Connection Panel to inform its clients
+ // that the current configuration has change
+ // void * notifyDetailsP : has to be casted as UInt32
+ // to get the Broadcasted Profile ID user specified ptr
+ // passed back with notification
+ // void * userDataP : has to be casted as UInt16
+ // to get the device kind of the Broadcasted Profile ID
+
+ syssyscallConnectorAttachEvent = Rsc('ecna');
+ // Broadcast when anything is attached to
+ // the syscall connector.
+
+ syssyscallConnectorDetachEvent = Rsc('ecnd');
+ // Broadcast when anything is detached from
+ // the syscall connector.
+
+ sysNotifyCardInsertedEvent = Rsc('crdi');
+ // Broadcast when an ExpansionMgr card is
+ // inserted into a slot, and the slot driver
+ // calls ExpCardInserted. Always broadcast
+ // from UI task.
+ // ExpansionMgr will play a sound & attempt to
+ // mount a volume unless the corresponding
+ // bits in the 'handled' field are set by a
+ // notification handler (see ExpansionMgr.h).
+ // PARAMETER: slot number cast as void*
+
+ sysNotifyCardRemovedEvent = Rsc('crdo');
+ // Broadcast when an ExpansionMgr card is
+ // removed from a slot, and the slot driver
+ // calls ExpCardRemoved. Always broadcast
+ // from UI task.
+ // ExpansionMgr will play a sound & attempt to
+ // unmount a volume unless the corresponding
+ // bits in the 'handled' field are set by a
+ // notification handler (see ExpansionMgr.h).
+ // PARAMETER: slot number cast as void*
+
+ sysNotifyVolumeMountedEvent = Rsc('volm');
+ // Broadcast when a VFSMgr volume is
+ // mounted, Always broadcast from UI task.
+ // VFSMgr will run start.prc (if present),
+ // and SysUIAppSwitch to it or the Launcher
+ // unless the appropriate bits in the 'handled'
+ // field are set by a notification handler.
+ // PARAMETER: VFSAnyMountParamPtr cast as void*
+
+ sysNotifyVolumeUnmountedEvent = Rsc('volu');
+ // Broadcast AFTER a VFSMgr volume is
+ // unmounted, Always broadcast from UI task.
+ // VFSMgr will delete start.prc (if it was loaded).
+ // The volume ref number for the unmounted volume is
+ // NO LONGER VALID, so don't bother trying to use it.
+ // PARAMETER: volume refNum cast as void*
+
+ sysNotifyHelperEvent = Rsc('hlpr');
+ // Sent by Address Book (or any
+ // 3rd party application) to
+ // communicate with Phone Apps
+
+ sysNotifyPOSEMountEvent = Rsc('pose');
+ // Sent by HostFS to communicate with itself,
+ // saving on stack depth.
+
+ sysNotifyLocaleChangedEvent = Rsc('locc');
+ // Notify apps/panel that the system locale
+ // has changed.
+ // This is broadcast by the language picker after it
+ // has changed the locale.
+ // Always sent from UI thread.
+ // param: ptr to SysNotifyLocaleChangedType
+
+ sysNotifyRetryEnqueueKey = Rsc('retk');
+ // An EvtEnqueueKey failed, so retry.
+
+ sysNotifyGotUsersAttention = Rsc('attn');
+ // Got users attention.
+
+ sysNotifyDBDeletedEvent = Rsc('dbs-');
+ // broadcast AFTER a database is removed from the device.
+ // Note that the database ID in the parameter block is
+ // NO LONGER VALID, and you WILL CRASH the device if you
+ // try to pass it to any DataMgr routines.
+ // notifyDetailsP: ptr to SysNotifyDBDeletedType.
+
+ sysNotifyDeviceUnlocked = Rsc('unlk');
+ // Broadcasted by the Security app After the device is
+ //unlocked.
+ //notifyDetailsP: none
+
+ sysNotifyPhoneEvent = Rsc('fone');
+ // Sent by third-party applications to communicate
+ // with built-in or syscall phones.
+ // NOTE THAT THIS EVENT IS FOR FUTURE USE
+
+ sysNotifyNetLibIFMediaEvent = Rsc('neti');
+ // Broadcasted by NetLib to communicate its interfaces media Up and Down requests
+ // to registered Apps.
+ // notifyDetailsP: ptr to SysNotifyNetLibIFMediaType.
+
+ sysNotifyDeleteProtectedEvent = Rsc('-pdb');
+ // Broadcast BEFORE a database is removed from the device when a user
+ // or installer application wants to remove a protected database. This
+ // will ONLY be issued from the UI task and should be issued before each
+ // user driven deletion that targets a protected database that the app
+ // running does not own (i.e. needs to request be unprotected).
+ // This gives the unlucky client a chance to do any required
+ // cleanup work. Note that if an application has multiple protected
+ // databases, this notification may be sent out more than once.
+ // notifyDetailsP: ptr to SysNotifyDBInfoType.
+
+ sysNotifyIrDASniffEvent = Rsc('irda');
+ // Sent by IrDA sniffing code when an incomming IrDA frame is detected
+
+// for sysNotifyDisplayChangeEvent
+type
+ SysNotifyDisplayChangeDetailsTag = record
+ oldDepth: UInt32;
+ newDepth: UInt32;
+ end;
+ SysNotifyDisplayChangeDetailsType = SysNotifyDisplayChangeDetailsTag;
+
+// For sysNotifyLocaleChangedEvent
+type
+ SysNotifyLocaleChangedTag = record
+ oldLocale: LmLocaleType;
+ newLocale: LmLocaleType;
+ end;
+ SysNotifyLocaleChangedType = SysNotifyLocaleChangedTag;
+
+// Possible values for the sleep-reason for the sysNotifySleepEvent
+const
+ sysSleepPowerButton = 0;
+ sysSleepAutoOff = 1;
+ sysSleepResumed = 2;
+ sysSleepUnknown = 3;
+
+// for sysNotifySleepRequestEvent
+type
+ SleepEventParamTag = record
+ reason: UInt16; // contains the reason we are going to sleep. See above list for possible values.
+ deferSleep: UInt16; // Only used for the sysNotifySleepRequestEvent, this should be incremented by
+ // clients that want to defer the sleep. They are then responsible for enqueing
+ // a resumeSleepChr in the event queue.
+ end;
+ SleepEventParamType = SleepEventParamTag;
+
+// for sysNotifyDeleteProtectedEvent, and possibly others...
+type
+ SysNotifyDBInfoTag = record
+ dbID: LocalID; // database ID of dabatase
+ cardNo: UInt16; // card number that dabatase resides on
+ attributes: UInt16; // database attributes
+ dbName: array [0..dmDBNameLength-1] of Char; // name of database
+ creator: UInt32; // creator code of dabatase
+ type_: UInt32; // type of dabatase
+ end;
+ SysNotifyDBInfoType = SysNotifyDBInfoTag;
+
+// for sysNotifyDBDeletedEvent
+type
+ SysNotifyDBDeletedTag = record
+ oldDBID: LocalID; // old database ID of dabatase, no longer valid
+ cardNo: UInt16; // card number that dabatase resides on
+ attributes: UInt16; // database attributes
+ dbName: array [0..dmDBNameLength-1] of Char; // name of database
+ creator: UInt32; // creator code of dabatase
+ type_: UInt32; // type code of dabatase
+ end;
+ SysNotifyDBDeletedType = SysNotifyDBDeletedTag;
+
+(*
+Possible event types to be added in the future:
+NOTE that these are NOT implemented yet!!!!
+
+ sysNotifyDBAddedEvent = Rsc('dbs+');
+ // Broadcast after a database is added to the device
+ // param: ptr to SysNotifyDBInfoType.
+
+ sysNotifyInitializeEvent = Ord('helo');
+ // broadcast to an app after its installed
+ // so it can do any necessary initalization
+ // This event is always broadcast.
+ // param: ptr to SysNotifyDBInfoType.
+
+ sysNotifyCleanupEvent = Ord('gbye');
+ // broadcast to an app just before its deleted
+ // so it can do any necessary cleanup work.
+ // This event is always broadcast.
+ // The database's type will have been set to
+ // sysFileTTemp so that if case the handler
+ // crashes, the DB will be deleted on reset.
+ // param: ptr to SysNotifyDBInfoType.
+
+ sysNotifyCardChangedEvent = Ord('card');
+ // broadcast when the owner's business card
+ // has changed, allowing apps to adjust for that.
+ // param: ptr to new owner data.
+*)
+
+function SysNotifyRegister(cardNo: UInt16; dbID: LocalID; notifyType: UInt32;
+ callbackP: SysNotifyProcPtr; priority: Int8; userDataP: Pointer): Err; syscall sysTrapSysNotifyRegister;
+
+function SysNotifyUnregister(cardNo: UInt16; dbID: LocalID; notifyType: UInt32; priority: Int8): Err; syscall sysTrapSysNotifyUnregister;
+
+(*
+ * WARNING: Never call SysNotifyBroadcast from a background task
+ * (or from any code that might be called from a BG task)
+ * with the memory semaphore reserved. Deadlock will
+ * result when the broadcast is deferred and the UI task
+ * tries to acquire the mem semaphore in order to send it out.
+ *)
+function SysNotifyBroadcast(var notify: SysNotifyParamType): Err; syscall sysTrapSysNotifyBroadcast;
+
+function SysNotifyBroadcastDeferred(var notify: SysNotifyParamType; paramSize: Int16): Err; syscall sysTrapSysNotifyBroadcastDeferred;
+
+// Kick off a notification from an interrupt handler.
+// Note: non-interrupt code should use SysNotifyBroadcast
+function SysNotifyBroadcastFromInterrupt(notifyType: UInt32; broadcaster: UInt32;
+ notifyDetailsP: Pointer): Err; syscall sysTrapSysNotifyBroadcastFromInterrupt;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/overlaymgr.pp b/packages/palmunits/src/overlaymgr.pp
new file mode 100644
index 0000000000..0cd1ed0de4
--- /dev/null
+++ b/packages/palmunits/src/overlaymgr.pp
@@ -0,0 +1,270 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: OverlayMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Public header for routines that support overlays.
+ *
+ * History:
+ * 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
+ * ===== Palm OS 3.5 Released =====
+ * 03/12/00 kwk Fixed comment for omOverlayKindHide.
+ * 05/18/00 kwk Added omFtrDefaultLocale feature selector.
+ * Added OmGetNextSystemLocale routine. Changed OmLocaleType
+ * to LmLocaleType. Deleted omOverlayDBType (use sysFileTOverlay).
+ * Moved more private stuff into OverlayPrv.h.
+ * 07/29/00 kwk Added note about using OmGetNextSystemLocale vs OmGetIndexedLocale.
+ * 09/14/00 kwk Added didNoOverlaySystem & foundSystem to OmSearchStateType,
+ * plus 6 more reserved bytes for future expansion.
+ * 09/18/00 kwk Added omErrNoNextSystemLocale.
+ *
+ *****************************************************************************)
+
+unit overlaymgr;
+
+interface
+
+uses palmos, coretraps, errorbase, datamgr, localemgr;
+
+(***********************************************************************
+ * Overlay Manager constants
+ **********************************************************************)
+
+const
+ omOverlayRscType_ = Rsc('ovly'); // Overlay desc resource type
+ omOverlayRscID = 1000; // Overlay desc resource ID
+
+ omFtrCreator = Rsc('ovly'); // For get/set of Overlay features.
+ omFtrShowErrorsFlag = 0; // Boolean - True => display overlay errors.
+ omFtrDefaultLocale = 1; // LmLocaleType record => default locale to
+ // try with stripped bases & no valid overlay.
+
+// OmFindOverlayDatabase called with stripped base, and no appropriate overlay was found.
+ omErrBaseRequiresOverlay = omErrorClass or 1;
+
+// OmOverlayDBNameToLocale or OmLocaleToOverlayDBName were passed an unknown locale.
+ mErrUnknownLocale = omErrorClass or 2;
+
+// OmOverlayDBNameToLocale was passed a poorly formed string.
+ mErrBadOverlayDBName = omErrorClass or 3;
+
+// OmGetIndexedLocale was passed an invalid index.
+ mErrInvalidLocaleIndex = omErrorClass or 4;
+
+// OmSetSystemLocale was passed an invalid locale (doesn't correspond to available
+// system overlay).
+
+ mErrInvalidLocale = omErrorClass or 5;
+
+// OmSetSystemLocale was passed a locale that referenced an invalid system overlay
+// (missing one or more required resources)
+
+ mErrInvalidSystemOverlay = omErrorClass or 6;
+
+// OmGetNextSystemLocale was called, but there were no more valid system
+// locales to return.
+ omErrNoNextSystemLocale = omErrorClass or 7;
+
+(***********************************************************************
+ * Selectors & macros used for calling Overlay Manager routines
+ **********************************************************************)
+
+// Selectors used for getting to the right Overlay Manager routine via
+// the OmDispatch trap.
+
+type
+ OmSelector = WordEnum;
+
+const
+ omInit = 0;
+ omOpenOverlayDatabase = Succ(omInit);
+ omLocaleToOverlayDBName_ = Succ(omOpenOverlayDatabase);
+ omOverlayDBNameToLocale_ = Succ(omLocaleToOverlayDBName_);
+ omGetCurrentLocale_ = Succ(omOverlayDBNameToLocale_);
+ omGetIndexedLocale_ = Succ(omGetCurrentLocale_);
+ omGetSystemLocale_ = Succ(omGetIndexedLocale_);
+ omSetSystemLocale_ = Succ(omGetSystemLocale_);
+ omGetRoutineAddress_ = Succ(omSetSystemLocale_);
+ omGetNextSystemLocale_ = Succ(omGetRoutineAddress_);
+
+ omMaxSelector = omGetNextSystemLocale_;
+
+(***********************************************************************
+ * Overlay Manager types
+ **********************************************************************)
+
+// DOLATER kwk - decide how to deprecate this.
+type
+ OmLocaleType = LmLocaleType;
+
+// Structure passed to OmGetNextSystemLocale.
+type
+ OmSearchStateType = record
+ searchState: DmSearchStateType;
+ systemDBRef: DmOpenRef;
+ systemDBCard: UInt16;
+ systemDBName: array [0..dmDBNameLength-1] of Char;
+ systemDBNameLen: Int16;
+ curLocale: LmLocaleType;
+ didNoOverlaySystem: Boolean;
+ foundSystem: Boolean;
+ reserved: array [0..5] of UInt8;
+ end;
+
+(***********************************************************************
+ * Overlay Manager routines
+ **********************************************************************)
+
+// 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.
+
+function OmLocaleToOverlayDBName(const baseDBName: PChar; {const} var targetLocale: LmLocaleType;
+ overlayDBName: PChar): Err;
+
+// 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.
+
+function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
+
+// Return the current locale in <currentLocale>. This may not be the same as
+// the system locale, which will take effect after the next reset.
+
+procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
+
+// Return the nth valid system locale in <theLocale>. Indexes are zero-based,
+// and omErrInvalidLocaleIndex will be returned if <localeIndex> is out of
+// bounds. Note that OmGetNextSystemLocale should be used on Palm OS 4.0 or
+// later, since OmGetIndexedLocale can be slow on ROMs with more than few
+// valid system locales.
+
+function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
+
+// Return the system locale in <systemLocale>. This may not be the same as
+// the current locale. WARNING!!! This routine should only be used in very
+// special situations; typically OmGetCurrentLocale should be used to determine
+// the "active" locale.
+
+procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
+
+// Set the post-reset system locale to be <systemLocale>. Return omErrInvalidLocale if
+// the passed locale doesnÕ´ correspond to a valid System.prc overlay.
+
+function OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err;
+
+// Return back the address of the routine indicated by <inSelector>. If
+// <inSelector> isn't a valid routine selector, return back NULL.
+
+function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
+
+// NEW in 4.0. Return back the next valid system locale in <oLocaleP>. The first
+// time the routine is called, <iNewSearch> must be true. When there are no more
+// valid system locales, omErrInvalidLocaleIndex will be returned. This routine
+// should be used in place of OmGetIndexedLocale on Palm OS 4.0 or later, since
+// it's much faster.
+
+function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
+
+implementation
+
+function __OmLocaleToOverlayDBName(const baseDBName: PChar; {const} var targetLocale: LmLocaleType;
+ overlayDBName: PChar): Err; syscall sysTrapOmDispatch;
+function __OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
+procedure __OmGetCurrentLocale(var currentLocale: LmLocaleType); syscall sysTrapOmDispatch;
+function __OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
+procedure __OmGetSystemLocale(var systemLocale: LmLocaleType); syscall sysTrapOmDispatch;
+function __OmSetSystemLocale({const} var systemLocale: LmLocaleType): Err; syscall sysTrapOmDispatch;
+function __OmGetRoutineAddress(inSelector: OmSelector): Pointer; syscall sysTrapOmDispatch;
+function __OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err; syscall sysTrapOmDispatch;
+
+function OmLocaleToOverlayDBName(const baseDBName: PChar; var targetLocale: LmLocaleType;
+ overlayDBName: PChar): Err;
+begin
+ asm
+ move.l #$omLocaleToOverlayDBName_,D2;
+ end;
+ OmLocaleToOverlayDBName := __OmLocaleToOverlayDBName(baseDBName, targetLocale, overlayDBName);
+end;
+
+function OmOverlayDBNameToLocale(const overlayDBName: PChar; var overlayLocale: LmLocaleType): Err;
+begin
+ asm
+ move.l #$omOverlayDBNameToLocale_,D2;
+ end;
+ OmOverlayDBNameToLocale := __OmOverlayDBNameToLocale(overlayDBName, overlayLocale);
+end;
+
+procedure OmGetCurrentLocale(var currentLocale: LmLocaleType);
+begin
+ asm
+ move.l #$omGetCurrentLocale_,D2;
+ end;
+ __OmGetCurrentLocale(currentLocale);
+end;
+
+function OmGetIndexedLocale(localeIndex: UInt16; var theLocale: LmLocaleType): Err;
+begin
+ asm
+ move.l #$omGetIndexedLocale_,D2;
+ end;
+ OmGetIndexedLocale := __OmGetIndexedLocale(localeIndex, theLocale);
+end;
+
+procedure OmGetSystemLocale(var systemLocale: LmLocaleType);
+begin
+ asm
+ move.l #$omGetSystemLocale_,D2;
+ end;
+ __OmGetSystemLocale(systemLocale);
+end;
+
+function OmSetSystemLocale(var systemLocale: LmLocaleType): Err;
+begin
+ asm
+ move.l #$omSetSystemLocale_,D2;
+ end;
+ OmSetSystemLocale := __OmSetSystemLocale(systemLocale);
+end;
+
+function OmGetRoutineAddress(inSelector: OmSelector): Pointer;
+begin
+ asm
+ move.l #$omGetRoutineAddress_,D2;
+ end;
+ OmGetRoutineAddress := __OmGetRoutineAddress(inSelector);
+end;
+
+function OmGetNextSystemLocale(iNewSearch: Boolean; var ioStateInfoP: OmSearchStateType; var oLocaleP: LmLocaleType): Err;
+begin
+ asm
+ move.l #$omGetNextSystemLocale_,D2;
+ end;
+ OmGetNextSystemLocale := __OmGetNextSystemLocale(iNewSearch, ioStateInfoP, oLocaleP);
+end;
+
+
+end.
diff --git a/packages/palmunits/src/palmcompatibility.pp b/packages/palmunits/src/palmcompatibility.pp
new file mode 100644
index 0000000000..523b1761a0
--- /dev/null
+++ b/packages/palmunits/src/palmcompatibility.pp
@@ -0,0 +1,255 @@
+{$MACRO ON}
+
+{$define Rsc := }
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PalmCompatibility.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Type & macro definitions for compile-time compatibility between
+ * old and new header files.
+ *
+ * History:
+ * 4/26/99 BRM Created.
+ * 99-10-22 jwm Added old-style data types.
+ * 10/23/99 jmp Added more win-to-scr-oriented aliases.
+ * 99-10-26 jwm Added old-style nWORD_INLINE macros.
+ * 11/23/99 jmp Added ScrDisplayModeOperation-to-WinScreenModeOperation
+ * definitions by request from Tool team.
+ * 05/03/00 CS Added LanguageType..countryCount, which have been
+ * subsumed by typedefs and #defines in new Locale Manager.
+ * 05/16/00 CS LmCountryType/LmLanguageType are now back to
+ * CountryType/LanguageType.
+ * CS Added #defines for deprecated countryNameLength,
+ * currencyNameLength, and currencySymbolLength,
+ * although nobody seems to be using them anyway.
+ * 05/30/00 kwk Added missing #ifndef __PALMCOMPATIBILITY_H__
+ * 05/31/00 CS Redefined languageFirst..countryCount so that they'll
+ * take on their original values, rather than the new
+ * ISO sets, which don't all correspond to entries in
+ * either the old country or new locale settings resources.
+ * 10/04/00 kwk Fixed up countryCount macro - countryLast was countrylast.
+ * 11/13/00 sjm Added deprecated expansion manager names.
+ *
+ *****************************************************************************)
+
+unit palmcompatibility;
+
+interface
+
+uses palmos, localemgr, palmlocale, window, fslib;
+
+// The data types Byte, Word, DWord and so on are now deprecated. We
+// recommend that you use the corresponding new data types: for example,
+// use Int16 instead of SWord and UInt32 instead of DWord. In particular,
+// the unfortunate distinction between Handle/VoidHand has been fixed:
+// use MemHandle instead.
+
+type
+ SByte = Int8;
+
+ SWord = Int16;
+ Word = UInt16;
+
+ SDWord = Int32;
+ DWord = UInt32;
+
+// Logical data types
+ SChar= Int8;
+ UChar = UInt8;
+
+ Short = Int16;
+ UShort = UInt16;
+
+ Int = Int16;
+ UInt = UInt16;
+
+ Long = Int32;
+ ULong = UInt32;
+
+// Pointer Types
+ VoidPtr = MemPtr;
+ VoidHand = MemHandle;
+
+ Ptr = MemPtr;
+ Handle = MemHandle;
+
+// Because "const BytePtr" means "const pointer to Byte" rather than "pointer
+// to const Byte", all these XXXXPtr types are deprecated: you're better off
+// just using "Byte *" and so on. (Even better, use "UInt8 *"!)
+
+ SBytePtr = ^SByte;
+ BytePtr = ^Byte;
+
+ SWordPtr = ^SWord;
+ WordPtr = ^Word;
+ UInt16Ptr = ^UInt16;
+
+ SDWordPtr = ^SDWord;
+ DWordPtr = ^DWord;
+
+// Logical data types
+ BooleanPtr = ^Boolean;
+
+ CharPtr = ^Char;
+ SCharPtr = ^SChar;
+ UCharPtr = ^UChar;
+
+ WCharPtr = ^WChar;
+
+ ShortPtr = ^Short;
+ UShortPtr = ^UShort;
+
+ IntPtr = ^Int;
+ UIntPtr = ^UInt;
+
+ LongPtr = ^Long;
+ ULongPtr = ^ULong;
+
+// Instead of indexing through countries and languages, developers should call
+// the Locale Manager to index through known locales:
+const
+ languageFirst = lEnglish; // From Preferences.pas
+ languageLast = lDutch; // From Preferences.pas
+ languageCount = languageLast - languageFirst + 1; // From Preferences.pas
+ countryFirst = cAustralia; // From Preferences.pas
+ countryLast = cTaiwan; // From Preferences.pas
+ countryCount = countryLast - countryFirst + 1; // From Preferences.pas
+
+// Incorporated into the Locale Manager:
+ countryNameLength = kMaxCountryNameLen + 1; // From Preferences.pas
+ currencyNameLength = kMaxCurrencyNameLen + 1; // From Preferences.pas
+ currencySymbolLength = kMaxCurrencySymbolLen + 1; // From Preferences.pas
+
+(********************************************************************
+ *
+ * Deprecated screen stuff
+ *
+ ********************************************************************)
+
+const
+ scrCopy = winPaint;
+ scrAND = winErase;
+ scrANDNOT = winMask;
+ scrXOR = winInvert;
+ scrOR = winOverlay;
+ scrCopyNOT = winPaintInverse;
+
+ scrDisplayModeGetDefaults = winScreenModeGetDefaults;
+ scrDisplayModeGet = winScreenModeGet;
+ scrDisplayModeSetToDefaults = winScreenModeSetToDefaults;
+ scrDisplayModeSet = winScreenModeSet;
+ scrDisplayModeGetSupportedDepths = winScreenModeGetSupportedDepths;
+ scrDisplayModeGetSupportsColor = winScreenModeGetSupportsColor;
+
+// ScrOperation = WinDrawOperation;
+
+// ScrDisplayMode(op, widthP, heightP, depthP, enableColorP) WinScreenMode(op, widthP, heightP, depthP, enableColorP)
+
+// ScrInit() WinScreenInit()
+
+(********************************************************************
+ *
+ * Deprecated resource ids
+ *
+ ********************************************************************)
+
+// Resources with system ids (>= 10000) are subject to change, and
+// should _not_ be relied upon.
+
+// System date string resources. You should use DateTemplateToAscii
+// (Palm OS 3.5 or later) or DateGlueTemplateToAscii (backwards
+// compatible) instead of these resources.
+
+const
+ daysOfWeekStrID = 10000;
+ dayFullNamesStrID = 10001;
+ monthNamesStrID = 10002;
+ monthFullNamesStrID = 10003;
+
+// More system date string resources, introduced in Palm OS 3.5. If you use
+// these, you are limiting yourself to running on nothing earlier than 3.5,
+// so you likely might as well use DateTempalateToAscii instead.
+
+ daysOfWeekShortStrListID = 10200;
+ daysOfWeekStdStrListID = 10201;
+ daysOfWeekLongStrListID = 10202;
+ monthNamesShortStrListID = 10203;
+ monthNamesStdStrListID = 10204;
+ monthNamesLongStrListID = 10205;
+
+// The country table resource has changed between versions, and is
+// now completely obsolete. Use LmGetLocaleSetting (4.0 or later)
+// or LmGlueGetLocaleSetting instead of this resource.
+
+ sysResTCountries = Rsc('cnty');
+ sysResIDCountries = 10000;
+
+(********************************************************************
+ *
+ * Deprecated Expansion Manager names
+ *
+ ********************************************************************)
+
+// Expansion Manager
+{!!!
+ invalidSlotRefNum = expInvalidSlotRefNum;
+ expErrInvalidSlotRefNumber = expErrInvalidSlotRefNum;
+ ExpMediaType_Any = expMediaType_Any;
+ ExpMediaType_MemoryStick = expMediaType_MemoryStick;
+ ExpMediaType_CompactFlash = expMediaType_CompactFlash;
+ ExpMediaType_SecureDigital = expMediaType_SecureDigital;
+ ExpMediaType_MultiMediaCard = expMediaType_MultiMediaCard;
+ ExpMediaType_SmartMedia = expMediaType_SmartMedia;
+ ExpMediaType_RAMDisk = expMediaType_RAMDisk;
+ ExpMediaType_PoserHost = expMediaType_PoserHost;
+ ExpMediaType_MacSim = expMediaType_MacSim;
+
+// VFS Manager:
+// VFSMountClass_SlotDriver = vfsMountClass_SlotDriver;
+// VFSMountClass_Simulator = vfsMountClass_Simulator;
+ fsOriginBeginning = vfsOriginBeginning;
+ fsOriginCurrent = vfsOriginCurrent;
+ fsOriginEnd = vfsOriginEnd;
+ fsFilesystemType_VFAT = vfsFilesystemType_VFAT;
+ fsFilesystemType_FAT = vfsFilesystemType_FAT;
+ fsFilesystemType_NTFS = vfsFilesystemType_NTFS;
+ fsFilesystemType_HFSPlus = vfsFilesystemType_HFSPlus;
+ fsFilesystemType_HFS = vfsFilesystemType_HFS;
+ fsFilesystemType_MFS = vfsFilesystemType_MFS;
+ fsFilesystemType_EXT2 = vfsFilesystemType_EXT2;
+ fsFilesystemType_FFS = vfsFilesystemType_FFS;
+ fsFilesystemType_NFS = vfsFilesystemType_NFS;
+ fsFilesystemType_AFS = vfsFilesystemType_AFS;
+ fsFilesystemType_Novell = vfsFilesystemType_Novell;
+ fsFilesystemType_HPFS = vfsFilesystemType_HPFS;
+ VFSFileAttributesGet = VFSFileGetAttributes;
+ VFSFileAttributesSet = VFSFileSetAttributes;
+ VFSFileDateGet = VFSFileGetDate;
+ VFSFileDateSet = VFSFileSetDate;
+ VFSVolumeLabelGet = VFSVolumeGetLabel;
+ VFSVolumeLabelSet = VFSVolumeSetLabel;
+
+// FSLib:
+ FS_LIB_APIVersion = fsLibAPIVersion;
+ FSFileAttributesGet = FSFileGetAttributes;
+ FSFileAttributesSet = FSFileSetAttributes;
+ FSFileDateGet = FSFileGetDate;
+ FSFileDateSet = FSFileSetDate;
+ FSVolumeLabelGet = FSVolumeGetLabel;
+ FSVolumeLabelSet = FSVolumeSetLabel;
+
+// SlotDrvrLib:
+ SlotDrvr_LIB_APIVersion = slotDrvrAPIVersion;
+ Slot_SECTOR_SIZE = slotSectorSize;
+}
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/palmlocale.pp b/packages/palmunits/src/palmlocale.pp
new file mode 100644
index 0000000000..0cb459e9bc
--- /dev/null
+++ b/packages/palmunits/src/palmlocale.pp
@@ -0,0 +1,618 @@
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PalmLocale.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit palmlocale;
+
+interface
+
+uses localemgr, textmgr;
+
+// Names of the known encodings.
+const
+ encodingNameAscii = 'us-ascii';
+ encodingNameISO8859_1 = 'ISO-8859-1';
+ encodingNameCP1252 = 'Windows-1252';
+ encodingNameShiftJIS = 'Shift_JIS';
+ encodingNameCP932 = 'Windows-31J';
+ encodingNameUTF8 = 'UTF-8';
+ encodingNameUCS2 = 'ISO-10646-UCS-2';
+
+// Maximum length of any encoding name.
+
+const
+ maxEncodingNameLength = 40;
+
+(***********************************************************************
+ * 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
+*)
+
+// Leave the following line unchanged before 1st #define to be copied to rez section:
+// TAG SOURCE START
+
+const
+ lEnglish = LanguageType(0); // EN
+ lFrench = LanguageType(1); // FR
+ lGerman = LanguageType(2); // DE
+ lItalian = LanguageType(3); // IT
+ lSpanish = LanguageType(4); // ES
+ lUnused = LanguageType(5); // Reserved
+
+// New in 3.1
+ lJapanese = LanguageType(6); // JA (Palm calls this jp)
+ lDutch = LanguageType(7); // NL
+
+// New in 4.0
+ lAfar = LanguageType(8); // AA
+ lAbkhazian = LanguageType(9); // AB
+ lAfrikaans = LanguageType(10); // AF
+ lAmharic = LanguageType(11); // AM
+ lArabic = LanguageType(12); // AR
+ lAssamese = LanguageType(13); // AS
+ lAymara = LanguageType(14); // AY
+ lAzerbaijani = LanguageType(15); // AZ
+ lBashkir = LanguageType(16); // BA
+ lByelorussian = LanguageType(17); // BE
+ lBulgarian = LanguageType(18); // BG
+ lBihari = LanguageType(19); // BH
+ lBislama = LanguageType(20); // BI
+ lBengali = LanguageType(21); // BN (Bangla)
+ lTibetan = LanguageType(22); // BO
+ lBreton = LanguageType(23); // BR
+ lCatalan = LanguageType(24); // CA
+ lCorsican = LanguageType(25); // CO
+ lCzech = LanguageType(26); // CS
+ lWelsh = LanguageType(27); // CY
+ lDanish = LanguageType(28); // DA
+ lBhutani = LanguageType(29); // DZ
+ lGreek = LanguageType(30); // EL
+ lEsperanto = LanguageType(31); // EO
+ lEstonian = LanguageType(32); // ET
+ lBasque = LanguageType(33); // EU
+ lPersian = LanguageType(34); // FA (Farsi)
+ lFinnish = LanguageType(35); // FI
+ lFiji = LanguageType(36); // FJ
+ lFaroese = LanguageType(37); // FO
+ lFrisian = LanguageType(38); // FY
+ lIrish = LanguageType(39); // GA
+ lScotsGaelic = LanguageType(40); // GD
+ lGalician = LanguageType(41); // GL
+ lGuarani = LanguageType(42); // GN
+ lGujarati = LanguageType(43); // GU
+ lHausa = LanguageType(44); // HA
+ lHindi = LanguageType(45); // HI
+ lCroatian = LanguageType(46); // HR
+ lHungarian = LanguageType(47); // HU
+ lArmenian = LanguageType(48); // HY
+ lInterlingua = LanguageType(49); // IA
+ lInterlingue = LanguageType(50); // IE
+ lInupiak = LanguageType(51); // IK
+ lIndonesian = LanguageType(52); // IN
+ lIcelandic = LanguageType(53); // IS
+ lHebrew = LanguageType(54); // IW
+ lYiddish = LanguageType(55); // JI
+ lJavanese = LanguageType(56); // JW
+ lGeorgian = LanguageType(57); // KA
+ lKazakh = LanguageType(58); // KK
+ lGreenlandic = LanguageType(59); // KL
+ lCambodian = LanguageType(60); // KM
+ lKannada = LanguageType(61); // KN
+ lKorean = LanguageType(62); // KO
+ lKashmiri = LanguageType(63); // KS
+ lKurdish = LanguageType(64); // KU
+ lKirghiz = LanguageType(65); // KY
+ lLatin = LanguageType(66); // LA
+ lLingala = LanguageType(67); // LN
+ lLaothian = LanguageType(68); // LO
+ lLithuanian = LanguageType(69); // LT
+ lLatvian = LanguageType(70); // LV (Lettish)
+ lMalagasy = LanguageType(71); // MG
+ lMaori = LanguageType(72); // MI
+ lMacedonian = LanguageType(73); // MK
+ lMalayalam = LanguageType(74); // ML
+ lMongolian = LanguageType(75); // MN
+ lMoldavian = LanguageType(76); // MO
+ lMarathi = LanguageType(77); // MR
+ lMalay = LanguageType(78); // MS
+ lMaltese = LanguageType(79); // MT
+ lBurmese = LanguageType(80); // MY
+ lNauru = LanguageType(81); // NA
+ lNepali = LanguageType(82); // NE
+ lNorwegian = LanguageType(83); // NO
+ lOccitan = LanguageType(84); // OC
+ lAfan = LanguageType(85); // OM (Oromo)
+ lOriya = LanguageType(86); // OR
+ lPunjabi = LanguageType(87); // PA
+ lPolish = LanguageType(88); // PL
+ lPashto = LanguageType(89); // PS (Pushto)
+ lPortuguese = LanguageType(90); // PT
+ lQuechua = LanguageType(91); // QU
+ lRhaetoRomance = LanguageType(92); // RM
+ lKurundi = LanguageType(93); // RN
+ lRomanian = LanguageType(94); // RO
+ lRussian = LanguageType(95); // RU
+ lKinyarwanda = LanguageType(96); // RW
+ lSanskrit = LanguageType(97); // SA
+ lSindhi = LanguageType(98); // SD
+ lSangho = LanguageType(99); // SG
+ lSerboCroatian = LanguageType(100); // SH
+ lSinghalese = LanguageType(101); // SI
+ lSlovak = LanguageType(102); // SK
+ lSlovenian = LanguageType(103); // SL
+ lSamoan = LanguageType(104); // SM
+ lShona = LanguageType(105); // SN
+ lSomali = LanguageType(106); // SO
+ lAlbanian = LanguageType(107); // SQ
+ lSerbian = LanguageType(108); // SR
+ lSiswati = LanguageType(109); // SS
+ lSesotho = LanguageType(110); // ST
+ lSudanese = LanguageType(111); // SU
+ lSwedish = LanguageType(112); // SV
+ lSwahili = LanguageType(113); // SW
+ lTamil = LanguageType(114); // TA
+ lTelugu = LanguageType(115); // TE
+ lTajik = LanguageType(116); // TG
+ lThai = LanguageType(117); // TH
+ lTigrinya = LanguageType(118); // TI
+ lTurkmen = LanguageType(119); // TK
+ lTagalog = LanguageType(120); // TL
+ lSetswana = LanguageType(121); // TN
+ lTonga = LanguageType(122); // TO
+ lTurkish = LanguageType(123); // TR
+ lTsonga = LanguageType(124); // TS
+ lTatar = LanguageType(125); // TT
+ lTwi = LanguageType(126); // TW
+ lUkrainian = LanguageType(127); // UK
+ lUrdu = LanguageType(128); // UR
+ lUzbek = LanguageType(129); // UZ
+ lVietnamese = LanguageType(130); // VI
+ lVolapuk = LanguageType(131); // VO
+ lWolof = LanguageType(132); // WO
+ lXhosa = LanguageType(133); // XH
+ lYoruba = LanguageType(134); // YO
+ lChinese = LanguageType(135); // ZH
+ lZulu = LanguageType(136); // ZU
+
+(* 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
+*)
+
+const
+ cAustralia = CountryType(0); // AU
+ cAustria = CountryType(1); // AT
+ cBelgium = CountryType(2); // BE
+ cBrazil = CountryType(3); // BR
+ cCanada = CountryType(4); // CA
+ cDenmark = CountryType(5); // DK
+ cFinland = CountryType(6); // FI
+ cFrance = CountryType(7); // FR
+ cGermany = CountryType(8); // DE
+ cHongKong = CountryType(9); // HK
+ cIceland = CountryType(10); // IS
+ cIreland = CountryType(11); // IE
+ cItaly = CountryType(12); // IT
+ cJapan = CountryType(13); // JP
+ cLuxembourg = CountryType(14); // LU
+ cMexico = CountryType(15); // MX
+ cNetherlands = CountryType(16); // NL
+ cNewZealand = CountryType(17); // NZ
+ cNorway = CountryType(18); // NO
+ cSpain = CountryType(19); // ES
+ cSweden = CountryType(20); // SE
+ cSwitzerland = CountryType(21); // CH
+ cUnitedKingdom = CountryType(22); // GB (UK)
+ cUnitedStates = CountryType(23); // US
+ cIndia = CountryType(24); // IN
+ cIndonesia = CountryType(25); // ID
+ cRepublicOfKorea = CountryType(26); // KR
+ cMalaysia = CountryType(27); // MY
+ cChina = CountryType(28); // CN
+ cPhilippines = CountryType(29); // PH
+ cSingapore = CountryType(30); // SG
+ cThailand = CountryType(31); // TH
+ cTaiwan = CountryType(32); // TW
+
+// New in 4.0
+ cAndorra = CountryType(33); // AD
+ cUnitedArabEmirates = CountryType(34); // AE
+ cAfghanistan = CountryType(35); // AF
+ cAntiguaAndBarbuda = CountryType(36); // AG
+ cAnguilla = CountryType(37); // AI
+ cAlbania = CountryType(38); // AL
+ cArmenia = CountryType(39); // AM
+ cNetherlandsAntilles = CountryType(40); // AN
+ cAngola = CountryType(41); // AO
+ cAntarctica = CountryType(42); // AQ
+ cArgentina = CountryType(43); // AR
+ cAmericanSamoa = CountryType(44); // AS
+ cAruba = CountryType(45); // AW
+ cAzerbaijan = CountryType(46); // AZ
+ cBosniaAndHerzegovina = CountryType(47); // BA
+ cBarbados = CountryType(48); // BB
+ cBangladesh = CountryType(49); // BD
+ cBurkinaFaso = CountryType(50); // BF
+ cBulgaria = CountryType(51); // BG
+ cBahrain = CountryType(52); // BH
+ cBurundi = CountryType(53); // BI
+ cBenin = CountryType(54); // BJ
+ cBermuda = CountryType(55); // BM
+ cBruneiDarussalam = CountryType(56); // BN
+ cBolivia = CountryType(57); // BO
+ cBahamas = CountryType(58); // BS
+ cBhutan = CountryType(59); // BT
+ cBouvetIsland = CountryType(60); // BV
+ cBotswana = CountryType(61); // BW
+ cBelarus = CountryType(62); // BY
+ cBelize = CountryType(63); // BZ
+ cCocosIslands = CountryType(64); // CC
+ cDemocraticRepublicOfTheCongo = CountryType(65); // CD
+ cCentralAfricanRepublic = CountryType(66); // CF
+ cCongo = CountryType(67); // CG
+ cIvoryCoast = CountryType(68); // CI
+ cCookIslands = CountryType(69); // CK
+ cChile = CountryType(70); // CL
+ cCameroon = CountryType(71); // CM
+ cColumbia = CountryType(72); // CO
+ cCostaRica = CountryType(73); // CR
+ cCuba = CountryType(74); // CU
+ cCapeVerde = CountryType(75); // CV
+ cChristmasIsland = CountryType(76); // CX
+ cCyprus = CountryType(77); // CY
+ cCzechRepublic = CountryType(78); // CZ
+ cDjibouti = CountryType(79); // DJ
+ cDominica = CountryType(80); // DM
+ cDominicanRepublic = CountryType(81); // DO
+ cAlgeria = CountryType(82); // DZ
+ cEcuador = CountryType(83); // EC
+ cEstonia = CountryType(84); // EE
+ cEgypt = CountryType(85); // EG
+ cWesternSahara = CountryType(86); // EH
+ cEritrea = CountryType(87); // ER
+ cEthiopia = CountryType(88); // ET
+ cFiji = CountryType(89); // FJ
+ cFalklandIslands = CountryType(90); // FK
+ cMicronesia = CountryType(91); // FM
+ cFaeroeIslands = CountryType(92); // FO
+ cMetropolitanFrance = CountryType(93); // FX
+ cGabon = CountryType(94); // GA
+ cGrenada = CountryType(95); // GD
+ cGeorgia = CountryType(96); // GE
+ cFrenchGuiana = CountryType(97); // GF
+ cGhana = CountryType(98); // GH
+ cGibraltar = CountryType(99); // GI
+ cGreenland = CountryType(100); // GL
+ cGambia = CountryType(101); // GM
+ cGuinea = CountryType(102); // GN
+ cGuadeloupe = CountryType(103); // GP
+ cEquatorialGuinea = CountryType(104); // GQ
+ cGreece = CountryType(105); // GR
+ cSouthGeorgiaAndTheSouthSandwichIslands = CountryType(106); // GS
+ cGuatemala = CountryType(107); // GT
+ cGuam = CountryType(108); // GU
+ cGuineaBisseu = CountryType(109); // GW
+ cGuyana = CountryType(110); // GY
+ cHeardAndMcDonaldIslands = CountryType(111); // HM
+ cHonduras = CountryType(112); // HN
+ cCroatia = CountryType(113); // HR
+ cHaiti = CountryType(114); // HT
+ cHungary = CountryType(115); // HU
+ cIsrael = CountryType(116); // IL
+ cBritishIndianOceanTerritory = CountryType(117); // IO
+ cIraq = CountryType(118); // IQ
+ cIran = CountryType(119); // IR
+ cJamaica = CountryType(120); // JM
+ cJordan = CountryType(121); // JO
+ cKenya = CountryType(122); // KE
+ cKyrgyzstan = CountryType(123); // KG (Kirgistan)
+ cCambodia = CountryType(124); // KH
+ cKiribati = CountryType(125); // KI
+ cComoros = CountryType(126); // KM
+ cStKittsAndNevis = CountryType(127); // KN
+ cDemocraticPeoplesRepublicOfKorea = CountryType(128); // KP
+ cKuwait = CountryType(129); // KW
+ cCaymanIslands = CountryType(130); // KY
+ cKazakhstan = CountryType(131); // KK
+ cLaos = CountryType(132); // LA
+ cLebanon = CountryType(133); // LB
+ cStLucia = CountryType(134); // LC
+ cLiechtenstein = CountryType(135); // LI
+ cSriLanka = CountryType(136); // LK
+ cLiberia = CountryType(137); // LR
+ cLesotho = CountryType(138); // LS
+ cLithuania = CountryType(139); // LT
+ cLatvia = CountryType(140); // LV
+ cLibya = CountryType(141); // LY
+ cMorrocco = CountryType(142); // MA
+ cMonaco = CountryType(143); // MC
+ cMoldova = CountryType(144); // MD
+ cMadagascar = CountryType(145); // MG
+ cMarshallIslands = CountryType(146); // MH
+ cMacedonia = CountryType(147); // MK
+ cMali = CountryType(148); // ML
+ cMyanmar = CountryType(149); // MM
+ cMongolia = CountryType(150); // MN
+ cMacau = CountryType(151); // MO
+ cNorthernMarianaIslands = CountryType(152); // MP
+ cMartinique = CountryType(153); // MQ
+ cMauritania = CountryType(154); // MR
+ cMontserrat = CountryType(155); // MS
+ cMalta = CountryType(156); // MT
+ cMauritius = CountryType(157); // MU
+ cMaldives = CountryType(158); // MV
+ cMalawi = CountryType(159); // MW
+ cMozambique = CountryType(160); // MZ
+ cNamibia = CountryType(161); // NA
+ cNewCaledonia = CountryType(162); // NC
+ cNiger = CountryType(163); // NE
+ cNorfolkIsland = CountryType(164); // NF
+ cNigeria = CountryType(165); // NG
+ cNicaragua = CountryType(166); // NI
+ cNepal = CountryType(167); // NP
+ cNauru = CountryType(168); // NR
+ cNiue = CountryType(169); // NU
+ cOman = CountryType(170); // OM
+ cPanama = CountryType(171); // PA
+ cPeru = CountryType(172); // PE
+ cFrenchPolynesia = CountryType(173); // PF
+ cPapuaNewGuinea = CountryType(174); // PG
+ cPakistan = CountryType(175); // PK
+ cPoland = CountryType(176); // PL
+ cStPierreAndMiquelon = CountryType(177); // PM
+ cPitcairn = CountryType(178); // PN
+ cPuertoRico = CountryType(179); // PR
+ cPortugal = CountryType(180); // PT
+ cPalau = CountryType(181); // PW
+ cParaguay = CountryType(182); // PY
+ cQatar = CountryType(183); // QA
+ cReunion = CountryType(184); // RE
+ cRomania = CountryType(185); // RO
+ cRussianFederation = CountryType(186); // RU
+ cRwanda = CountryType(187); // RW
+ cSaudiArabia = CountryType(188); // SA
+ cSolomonIslands = CountryType(189); // SB
+ cSeychelles = CountryType(190); // SC
+ cSudan = CountryType(191); // SD
+ cStHelena = CountryType(192); // SH
+ cSlovenia = CountryType(193); // SI
+ cSvalbardAndJanMayenIslands = CountryType(194); // SJ
+ cSlovakia = CountryType(195); // SK
+ cSierraLeone = CountryType(196); // SL
+ cSanMarino = CountryType(197); // SM
+ cSenegal = CountryType(198); // SN
+ cSomalia = CountryType(199); // SO
+ cSuriname = CountryType(200); // SR
+ cSaoTomeAndPrincipe = CountryType(201); // ST
+ cElSalvador = CountryType(202); // SV
+ cSyranArabRepublic = CountryType(203); // SY
+ cSwaziland = CountryType(204); // SZ
+ cTurksAndCaicosIslands = CountryType(205); // TC
+ cChad = CountryType(206); // TD
+ cFrenchSouthernTerritories = CountryType(207); // TF
+ cTogo = CountryType(208); // TG
+ cTajikistan = CountryType(209); // TJ
+ cTokelau = CountryType(210); // TK
+ cTurkmenistan = CountryType(211); // TM
+ cTunisia = CountryType(212); // TN
+ cTonga = CountryType(213); // TO
+ cEastTimor = CountryType(214); // TP
+ cTurkey = CountryType(215); // TR
+ cTrinidadAndTobago = CountryType(216); // TT
+ cTuvalu = CountryType(217); // TV
+ cTanzania = CountryType(218); // TZ
+ cUkraine = CountryType(219); // UA
+ cUganda = CountryType(220); // UG
+ cUnitedStatesMinorOutlyingIslands = CountryType(221); // UM
+ cUruguay = CountryType(222); // UY
+ cUzbekistan = CountryType(223); // UZ
+ cHolySee = CountryType(224); // VA
+ cStVincentAndTheGrenadines = CountryType(225); // VC
+ cVenezuela = CountryType(226); // VE
+ cBritishVirginIslands = CountryType(227); // VG
+ cUSVirginIslands = CountryType(228); // VI
+ cVietNam = CountryType(229); // VN
+ cVanuatu = CountryType(230); // VU
+ cWallisAndFutunaIslands = CountryType(231); // WF
+ cSamoa = CountryType(232); // WS
+ cYemen = CountryType(233); // YE
+ cMayotte = CountryType(234); // YT
+ cYugoslavia = CountryType(235); // YU
+ cSouthAfrica = CountryType(236); // ZA
+ cZambia = CountryType(237); // ZM
+ cZimbabwe = CountryType(238); // ZW
+
+(* 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.
+*)
+
+// Unknown to this version of PalmOS.
+ charEncodingUnknown = CharEncodingType(0);
+
+// Maximum character encoding _currently_ defined
+ charEncodingMax = CharEncodingType(77);
+
+// Latin Palm OS character encoding, and subsets.
+// PalmOS version of CP1252
+ charEncodingPalmLatin = CharEncodingType(3);
+// Windows variant of 8859-1
+ charEncodingCP1252 = CharEncodingType(7);
+// ISO 8859 Part 1
+ charEncodingISO8859_1 = CharEncodingType(2);
+// ISO 646-1991
+ charEncodingAscii = CharEncodingType(1);
+
+// Japanese Palm OS character encoding, and subsets.
+// PalmOS version of CP932
+ charEncodingPalmSJIS = CharEncodingType(5);
+// Windows variant of ShiftJIS
+ charEncodingCP932 = CharEncodingType(8);
+// Encoding for JIS 0208-1990 + 1-byte katakana
+ charEncodingShiftJIS = CharEncodingType(4);
+
+// Unicode character encodings
+ charEncodingUCS2 = CharEncodingType(9);
+ charEncodingUTF8 = CharEncodingType(6);
+ charEncodingUTF7 = CharEncodingType(24);
+ charEncodingUTF16 = CharEncodingType(75);
+ charEncodingUTF16BE = CharEncodingType(76);
+ charEncodingUTF16LE = CharEncodingType(77);
+
+// Latin character encodings
+ charEncodingCP850 = CharEncodingType(12);
+ charEncodingCP437 = CharEncodingType(13);
+ charEncodingCP865 = CharEncodingType(14);
+ charEncodingCP860 = CharEncodingType(15);
+ charEncodingCP861 = CharEncodingType(16);
+ charEncodingCP863 = CharEncodingType(17);
+ charEncodingCP775 = CharEncodingType(18);
+ charEncodingMacIslande = CharEncodingType(19);
+ charEncodingMacintosh = CharEncodingType(20);
+ charEncodingCP1257 = CharEncodingType(21);
+ charEncodingISO8859_3 = CharEncodingType(22);
+ charEncodingISO8859_4 = CharEncodingType(23);
+
+// Extended Latin character encodings
+ charEncodingISO8859_2 = CharEncodingType(26);
+ charEncodingCP1250 = CharEncodingType(27);
+ charEncodingCP852 = CharEncodingType(28);
+ charEncodingXKamenicky = CharEncodingType(29);
+ charEncodingMacXCroate = CharEncodingType(30);
+ charEncodingMacXLat2 = CharEncodingType(31);
+ charEncodingMacXRomania = CharEncodingType(32);
+
+// Japanese character encodings
+ charEncodingEucJp = CharEncodingType(25);
+ charEncodingISO2022Jp = CharEncodingType(10);
+ charEncodingXAutoJp = CharEncodingType(11);
+
+// Greek character encodings
+ charEncodingISO8859_7 = CharEncodingType(33);
+ charEncodingCP1253 = CharEncodingType(34);
+ charEncodingCP869 = CharEncodingType(35);
+ charEncodingCP737 = CharEncodingType(36);
+ charEncodingMacXGr = CharEncodingType(37);
+
+// Cyrillic character encodings
+ charEncodingCP1251 = CharEncodingType(38);
+ charEncodingISO8859_5 = CharEncodingType(39);
+ charEncodingKoi8R = CharEncodingType(40);
+ charEncodingKoi8 = CharEncodingType(41);
+ charEncodingCP855 = CharEncodingType(42);
+ charEncodingCP866 = CharEncodingType(43);
+ charEncodingMacCyr = CharEncodingType(44);
+ charEncodingMacUkraine = CharEncodingType(45);
+
+// Turkish character encodings
+ charEncodingCP1254 = CharEncodingType(46);
+ charEncodingISO8859_9 = CharEncodingType(47);
+ charEncodingCP857 = CharEncodingType(48);
+ charEncodingMacTurc = CharEncodingType(49);
+ charEncodingCP853 = CharEncodingType(50);
+
+// Arabic character encodings
+ charEncodingISO8859_6 = CharEncodingType(51);
+ charEncodingAsmo708 = CharEncodingType(52);
+ charEncodingCP1256 = CharEncodingType(53);
+ charEncodingCP864 = CharEncodingType(54);
+ charEncodingAsmo708Plus = CharEncodingType(55);
+ charEncodingAsmo708Fr = CharEncodingType(56);
+ charEncodingMacAra = CharEncodingType(57);
+
+// Chinese character encodings
+ charEncodingGB2312 = CharEncodingType(58);
+ charEncodingHZ = CharEncodingType(59);
+ charEncodingBig5 = CharEncodingType(60);
+
+// Vietnamese character encodings
+ charEncodingViscii = CharEncodingType(61);
+ charEncodingViqr = CharEncodingType(62);
+ charEncodingVncii = CharEncodingType(63);
+ charEncodingVietnet = CharEncodingType(65);
+ charEncodingCP1258 = CharEncodingType(66);
+
+// Korean character encodings
+ charEncodingKsc5601 = CharEncodingType(67);
+ charEncodingCP949 = CharEncodingType(68);
+ charEncodingISO2022Kr = CharEncodingType(69);
+
+// Hebrew character encodings
+ charEncodingISO8859_8I = CharEncodingType(70);
+ charEncodingISO8859_8 = CharEncodingType(71);
+ charEncodingCP1255 = CharEncodingType(72);
+ charEncodingCP1255V = CharEncodingType(73);
+
+// Thai character encodings
+ charEncodingTis620 = CharEncodingType(74);
+ charEncodingCP874 = CharEncodingType(64);
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/palmos.pp b/packages/palmunits/src/palmos.pp
new file mode 100644
index 0000000000..bf912fc67b
--- /dev/null
+++ b/packages/palmunits/src/palmos.pp
@@ -0,0 +1,62 @@
+unit palmos;
+
+interface
+
+(************************************************************
+ * Common constants
+ *************************************************************)
+type
+ Int8 = ShortInt;
+ Int16 = Integer;
+ Int32 = LongInt;
+
+ UInt8 = Byte;
+ UInt16 = Word;
+ UInt32 = LongWord;
+
+// Logical data types
+
+ WChar = UInt16; // 'wide' int'l character type.
+ Err = UInt16;
+ LocalID = UInt32; // local (card relative) chunk ID
+ Coord = Int16; // screen/window coordinate
+ MemPtr = Pointer; // global pointer
+ MemHandle = Pointer; // global handle
+
+ ProcPtr = function: Int32;
+
+const
+ NULL = 0;
+ bitsInByte = 8;
+
+(************************************************************
+ * Palm specific TRAP instruction numbers
+ *************************************************************)
+
+const
+ sysDbgBreakpointTrapNum = 0; // For soft breakpoints
+ sysDbgTrapNum = 8; // For compiled breakpoints
+ sysDispatchTrapNum = 15; // Trap dispatcher
+
+type
+ Enum = Byte;
+ WordEnum = Word;
+ LongEnum = LongWord;
+
+ Int8Ptr = ^Int8;
+ Int16Ptr = ^Int16;
+ Int32Ptr = ^Int32;
+
+ UInt8Ptr = ^UInt8;
+ UInt16Ptr = ^UInt16;
+ UInt32Ptr = ^UInt32;
+ PointerPtr = ^Pointer;
+
+ PCharPtr = ^PChar;
+ MemPtrPtr = ^MemPtr;
+ WCharPtr = ^WChar;
+ Smallint = Integer;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/password.pp b/packages/palmunits/src/password.pp
new file mode 100644
index 0000000000..011dc98e5e
--- /dev/null
+++ b/packages/palmunits/src/password.pp
@@ -0,0 +1,40 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Password.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Password include file
+ *
+ * History:
+ * 4/1/95 - created by Roger Flores
+ *
+ *****************************************************************************)
+
+unit password;
+
+interface
+
+uses coretraps;
+
+const
+ pwdLength = 32;
+ pwdEncryptionKeyLength = 64;
+
+function PwdExists: Boolean; syscall sysTrapPwdExists;
+
+function PwdVerify(Astring: PChar): Boolean; syscall sysTrapPwdVerify;
+
+procedure PwdSet(oldPassword, newPassword: PChar); syscall sysTrapPwdSet;
+
+procedure PwdRemove; syscall sysTrapPwdRemove;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/pdiconst.pp b/packages/palmunits/src/pdiconst.pp
new file mode 100644
index 0000000000..1cc97ce329
--- /dev/null
+++ b/packages/palmunits/src/pdiconst.pp
@@ -0,0 +1,289 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm Computing, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PdiConst.h
+ *
+ * Description:
+ * PDI Library constants
+ *
+ * History:
+ * Created by ABa (PdiMakeDictionary tool)
+ *
+ *****************************************************************************)
+
+(******************************************************************************
+ * Property fields access
+ *****************************************************************************)
+
+unit pdiconst;
+
+interface
+
+uses palmos;
+
+const
+ kPdiPVF_ADR_POST_OFFICE = UInt8(0);
+ kPdiPVF_ADR_EXTENDED = UInt8(1);
+ kPdiPVF_ADR_STREET = UInt8(2);
+ kPdiPVF_ADR_LOCALITY = UInt8(3);
+ kPdiPVF_ADR_REGION = UInt8(4);
+ kPdiPVF_ADR_POSTAL_CODE = UInt8(5);
+ kPdiPVF_ADR_COUNTRY = UInt8(6);
+ kPdiPVF_GEO_LATITUDE = UInt8(0);
+ kPdiPVF_GEO_LONGITUDE = UInt8(1);
+ kPdiPVF_N_FAMILY = UInt8(0);
+ kPdiPVF_N_GIVEN = UInt8(1);
+ kPdiPVF_N_ADDITIONAL = UInt8(2);
+ kPdiPVF_N_PREFIXES = UInt8(3);
+ kPdiPVF_N_SUFFIXES = UInt8(4);
+
+(******************************************************************************
+ * Properties constants
+ ******************************************************************************)
+
+ kPdiPRN_FREEBUSY = UInt16(988);
+ kPdiPRN_X_PALM_CUSTOM = UInt16(1044);
+ kPdiPRN_METHOD = UInt16(1108);
+ kPdiPRN_ORG = UInt16(1236);
+ kPdiPRN_X_PALM_CATEGORY = UInt16(1250);
+ kPdiPRN_TITLE = UInt16(1488);
+ kPdiPRN_ORGANIZER = UInt16(1528);
+ kPdiPRN_TZ = UInt16(1566);
+ kPdiPRN_VERSION = UInt16(1682);
+ kPdiPRN_TZID = UInt16(1722);
+ kPdiPRN_CLASS = UInt16(1814);
+ kPdiPRN_TZURL = UInt16(1832);
+ kPdiPRN_EXDATE = UInt16(1886);
+ kPdiPRN_EXRULE = UInt16(1906);
+ kPdiPRN_PRODID = UInt16(1926);
+ kPdiPRN_TZNAME = UInt16(1946);
+ kPdiPRN_GEO = UInt16(1966);
+ kPdiPRN_UID = UInt16(1980);
+ kPdiPRN_PROFILE = UInt16(1994);
+ kPdiPRN_PRIORITY = UInt16(2032);
+ kPdiPRN_ROLE = UInt16(2056);
+ kPdiPRN_TZOFFSET = UInt16(2072);
+ kPdiPRN_AALARM = UInt16(2160);
+ kPdiPRN_TZOFFSETTO = UInt16(2180);
+ kPdiPRN_TZOFFSETFROM = UInt16(2244);
+ kPdiPRN_SOUND = UInt16(2312);
+ kPdiPRN_ACTION = UInt16(2410);
+ kPdiPRN_SOURCE = UInt16(2430);
+ kPdiPRN_ADR = UInt16(2472);
+ kPdiPRN_COMMENT = UInt16(2486);
+ kPdiPRN_CONTACT = UInt16(2530);
+ kPdiPRN_NICKNAME = UInt16(2568);
+ kPdiPRN_COMPLETED = UInt16(2620);
+ kPdiPRN_RRULE = UInt16(2646);
+ kPdiPRN_ATTACH = UInt16(2692);
+ kPdiPRN_SORT_STRING = UInt16(2728);
+ kPdiPRN_ATTENDEE = UInt16(2776);
+ kPdiPRN_LOGO = UInt16(2800);
+ kPdiPRN_EMAIL = UInt16(2832);
+ kPdiPRN_END = UInt16(2852);
+ kPdiPRN_BDAY = UInt16(2866);
+ kPdiPRN_CALSCALE = UInt16(2882);
+ kPdiPRN_LOCATION = UInt16(2906);
+ kPdiPRN_PERCENT_COMPLETE = UInt16(2930);
+ kPdiPRN_PHOTO = UInt16(2970);
+ kPdiPRN_RDATE = UInt16(2988);
+ kPdiPRN_CATEGORIES = UInt16(3026);
+ kPdiPRN_CREATED = UInt16(3074);
+ kPdiPRN_REV = UInt16(3096);
+ kPdiPRN_LABEL = UInt16(3226);
+ kPdiPRN_BEGIN = UInt16(3244);
+ kPdiPRN_END_VCARD = UInt16(3262);
+ kPdiPRN_END_VTODO = UInt16(3288);
+ kPdiPRN_AGENT = UInt16(3314);
+ kPdiPRN_DALARM = UInt16(3372);
+ kPdiPRN_FN = UInt16(3392);
+ kPdiPRN_REPEAT = UInt16(3404);
+ kPdiPRN_END_VEVENT = UInt16(3424);
+ kPdiPRN_END_VJOURNAL = UInt16(3560);
+ kPdiPRN_END_VCALENDAR = UInt16(3694);
+ kPdiPRN_RESOURCES = UInt16(3728);
+ kPdiPRN_END_VFREEBUSY = UInt16(3754);
+ kPdiPRN_END_VTIMEZONE = UInt16(3788);
+ kPdiPRN_STATUS = UInt16(3870);
+ kPdiPRN_RELATED_TO = UInt16(3890);
+ kPdiPRN_TRANSP = UInt16(3918);
+ kPdiPRN_KEY = UInt16(3938);
+ kPdiPRN_BEGIN_VCARD = UInt16(3952);
+ kPdiPRN_BEGIN_VTODO = UInt16(3982);
+ kPdiPRN_TRIGGER = UInt16(4012);
+ kPdiPRN_NOTE = UInt16(4034);
+ kPdiPRN_BEGIN_VEVENT = UInt16(4050);
+ kPdiPRN_N = UInt16(4118);
+ kPdiPRN_LAST_MODIFIED = UInt16(4128);
+ kPdiPRN_RECURRENCE_ID = UInt16(4162);
+ kPdiPRN_MAILER = UInt16(4216);
+ kPdiPRN_REQUEST_STATUS = UInt16(4236);
+ kPdiPRN_BEGIN_VJOURNAL = UInt16(4272);
+ kPdiPRN_SUMMARY = UInt16(4366);
+ kPdiPRN_BEGIN_VCALENDAR = UInt16(4388);
+ kPdiPRN_URL = UInt16(4426);
+ kPdiPRN_BEGIN_VFREEBUSY = UInt16(4440);
+ kPdiPRN_BEGIN_VTIMEZONE = UInt16(4478);
+ kPdiPRN_SEQUENCE = UInt16(4594);
+ kPdiPRN_DTEND = UInt16(4660);
+ kPdiPRN_DTSTART = UInt16(4678);
+ kPdiPRN_DUE = UInt16(4700);
+ kPdiPRN_TEL = UInt16(4714);
+ kPdiPRN_DTSTAMP = UInt16(4744);
+ kPdiPRN_NAME = UInt16(4800);
+ kPdiPRN_DURATION = UInt16(4954);
+ kPdiPRN_DESCRIPTION = UInt16(5270);
+
+(******************************************************************************
+ * Parameters constants
+ *****************************************************************************)
+
+ kPdiPAN_DELEGATED_TO = UInt16(1012);
+ kPdiPAN_X = UInt16(1098);
+ kPdiPAN_DELEGATED_FROM = UInt16(1128);
+ kPdiPAN_MEMBER = UInt16(1164);
+ kPdiPAN_UTC_OFFSET = UInt16(1186);
+ kPdiPAN_DIR = UInt16(1350);
+ kPdiPAN_TYPE = UInt16(1428);
+ kPdiPAN_TIME = UInt16(1446);
+ kPdiPAN_PARTSTAT = UInt16(1738);
+ kPdiPAN_ROLE = UInt16(2056);
+ kPdiPAN_CN = UInt16(2208);
+ kPdiPAN_SOUND = UInt16(2312);
+ kPdiPAN_RANGE = UInt16(2330);
+ kPdiPAN_CONTEXT = UInt16(2508);
+ kPdiPAN_RSVP = UInt16(2816);
+ kPdiPAN_ENCODE = UInt16(3054);
+ kPdiPAN_ENCODING = UInt16(3166);
+ kPdiPAN_FMTTYPE = UInt16(3452);
+ kPdiPAN_RELATED = UInt16(3474);
+ kPdiPAN_RELTYPE = UInt16(3496);
+ kPdiPAN_LANGUAGE = UInt16(3618);
+ kPdiPAN_STATUS = UInt16(3870);
+ kPdiPAN_CUTYPE = UInt16(4308);
+ kPdiPAN_SENT_BY = UInt16(4556);
+ kPdiPAN_URI = UInt16(4580);
+ kPdiPAN_VALUE = UInt16(4852);
+ kPdiPAN_ALTREP = UInt16(5200);
+ kPdiPAN_FBTYPE = UInt16(5220);
+ kPdiPAN_CHARSET = UInt16(5300);
+
+(******************************************************************************
+ * Parameter pairs constants
+ *****************************************************************************)
+
+ kPdiPAV_TYPE_HOME = UInt16(0);
+ kPdiPAV_VALUE_VCARD = UInt16(2);
+ kPdiPAV_TYPE_VCARD = UInt16(4);
+ kPdiPAV_VALUE_UTC_OFFSET = UInt16(6);
+ kPdiPAV_TYPE_POSTAL = UInt16(8);
+ kPdiPAV_RELTYPE_SIBLING = UInt16(10);
+ kPdiPAV_TYPE_INTL = UInt16(12);
+ kPdiPAV_CUTYPE_GROUP = UInt16(14);
+ kPdiPAV_ROLE_OPT_PARTICIPANT = UInt16(16);
+ kPdiPAV_VALUE_INTEGER = UInt16(18);
+ kPdiPAV_VALUE_TIME = UInt16(20);
+ kPdiPAV_TYPE_INTERNET = UInt16(22);
+ kPdiPAV_TYPE_PAGER = UInt16(24);
+ kPdiPAV_ROLE_ORGANIZER = UInt16(26);
+ kPdiPAV_ENCODING_Q = UInt16(28);
+ kPdiPAV_CUTYPE_INDIVIDUAL = UInt16(30);
+ kPdiPAV_PARTSTAT_IN_PROCESS = UInt16(32);
+ kPdiPAV_RELTYPE_PARENT = UInt16(34);
+ kPdiPAV_TYPE_PARCEL = UInt16(36);
+ kPdiPAV_TYPE_PREF = UInt16(38);
+ kPdiPAV_RANGE_THISANDPRIOR = UInt16(40);
+ kPdiPAV_ENCODING_8BIT = UInt16(42);
+ kPdiPAV_RANGE_THISANDFUTURE = UInt16(44);
+ kPdiPAV_TYPE_PCS = UInt16(46);
+ kPdiPAV_CUTYPE_ROOM = UInt16(48);
+ kPdiPAV_PARTSTAT_NEEDS_ACTION = UInt16(50);
+ kPdiPAV_STATUS_NEEDS_ACTION = UInt16(52);
+ kPdiPAV_ENCODING_B = UInt16(54);
+ kPdiPAV_VALUE_BOOLEAN = UInt16(56);
+ kPdiPAV_TYPE_X400 = UInt16(58);
+ kPdiPAV_TYPE_ISDN = UInt16(60);
+ kPdiPAV_ROLE_OWNER = UInt16(62);
+ kPdiPAV_TYPE_VIDEO = UInt16(64);
+ kPdiPAV_ENCODING_BASE64 = UInt16(66);
+ kPdiPAV_VALUE_PERIOD = UInt16(68);
+ kPdiPAV_TYPE_BBS = UInt16(70);
+ kPdiPAV_PARTSTAT_ACCEPTED = UInt16(72);
+ kPdiPAV_STATUS_ACCEPTED = UInt16(74);
+ kPdiPAV_PARTSTAT_COMPLETED = UInt16(76);
+ kPdiPAV_STATUS_COMPLETED = UInt16(78);
+ kPdiPAV_STATUS_CONFIRMED = UInt16(80);
+ kPdiPAV_TYPE_CAR = UInt16(82);
+ kPdiPAV_TYPE_DOM = UInt16(84);
+ kPdiPAV_ROLE_ATTENDEE = UInt16(86);
+ kPdiPAV_RELATED_END = UInt16(88);
+ kPdiPAV_VALUE_FLOAT = UInt16(90);
+ kPdiPAV_CUTYPE_UNKNOWN = UInt16(92);
+ kPdiPAV_VALUE_CAL_ADDRESS = UInt16(94);
+ kPdiPAV_FBTYPE_BUSY = UInt16(96);
+ kPdiPAV_VALUE_DATE = UInt16(98);
+ kPdiPAV_VALUE_RECUR = UInt16(100);
+ kPdiPAV_TYPE_MODEM = UInt16(102);
+ kPdiPAV_ENCODING_QUOTED_PRINTABLE = UInt16(104);
+ kPdiPAV_CUTYPE_RESOURCE = UInt16(106);
+ kPdiPAV_RSVP_TRUE = UInt16(108);
+ kPdiPAV_VALUE_PHONE_NUMBER = UInt16(110);
+ kPdiPAV_RELATED_START = UInt16(112);
+ kPdiPAV_VALUE_DATE_TIME = UInt16(114);
+ kPdiPAV_TYPE_CELL = UInt16(116);
+ kPdiPAV_STATUS_SENT = UInt16(118);
+ kPdiPAV_TYPE_VOICE = UInt16(120);
+ kPdiPAV_FBTYPE_BUSY_TENTATIVE = UInt16(122);
+ kPdiPAV_ROLE_REQ_PARTICIPANT = UInt16(124);
+ kPdiPAV_VALUE_URI = UInt16(126);
+ kPdiPAV_FBTYPE_BUSY_UNAVAILABLE = UInt16(128);
+ kPdiPAV_TYPE_FAX = UInt16(130);
+ kPdiPAV_TYPE_MSG = UInt16(132);
+ kPdiPAV_TYPE_WORK = UInt16(134);
+ kPdiPAV_VALUE_TEXT = UInt16(136);
+ kPdiPAV_CONTEXT_WORD = UInt16(138);
+ kPdiPAV_RSVP_FALSE = UInt16(140);
+ kPdiPAV_VALUE_BINARY = UInt16(142);
+ kPdiPAV_ROLE_NON_PARTICIPANT = UInt16(144);
+ kPdiPAV_VALUE_DURATION = UInt16(146);
+ kPdiPAV_X_X_PALM_N = UInt16(148);
+ kPdiPAV_X_X_IRMC_N = UInt16(150);
+ kPdiPAV_FBTYPE_FREE = UInt16(152);
+ kPdiPAV_PARTSTAT_DECLINED = UInt16(154);
+ kPdiPAV_STATUS_DECLINED = UInt16(156);
+ kPdiPAV_PARTSTAT_TENTATIVE = UInt16(158);
+ kPdiPAV_STATUS_TENTATIVE = UInt16(160);
+ kPdiPAV_PARTSTAT_DELEGATED = UInt16(162);
+ kPdiPAV_STATUS_DELEGATED = UInt16(164);
+ kPdiPAV_RELTYPE_CHILD = UInt16(166);
+ kPdiPAV_ROLE_CHAIR = UInt16(168);
+ kPdiPAV_X_X_PALM_ORG = UInt16(170);
+ kPdiPAV_X_X_IRMC_ORG = UInt16(172);
+ kPdiPAV_X_X_PALM_MAIN = UInt16(174);
+
+(******************************************************************************
+ * Properties types constants
+ *****************************************************************************)
+
+ kPdiType_DATE_TIME = kPdiPAV_VALUE_DATE_TIME;
+ kPdiType_TEXT = kPdiPAV_VALUE_TEXT;
+ kPdiType_CAL_ADDRESS = kPdiPAV_VALUE_CAL_ADDRESS;
+ kPdiType_DURATION = kPdiPAV_VALUE_DURATION;
+ kPdiType_RECUR = kPdiPAV_VALUE_RECUR;
+ kPdiType_PERIOD = kPdiPAV_VALUE_PERIOD;
+ kPdiType_FLOAT = kPdiPAV_VALUE_FLOAT;
+ kPdiType_BINARY = kPdiPAV_VALUE_BINARY;
+ kPdiType_INTEGER = kPdiPAV_VALUE_INTEGER;
+ kPdiType_UTC_OFFSET = kPdiPAV_VALUE_UTC_OFFSET;
+ kPdiType_URI = kPdiPAV_VALUE_URI;
+ kPdiType_BOOLEAN = kPdiPAV_VALUE_BOOLEAN;
+ kPdiType_DATE = kPdiPAV_VALUE_DATE;
+ kPdiType_TIME = kPdiPAV_VALUE_TIME;
+ kPdiType_VCARD = kPdiPAV_VALUE_VCARD;
+ kPdiType_PHONE_NUMBER = kPdiPAV_VALUE_PHONE_NUMBER;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/pdilib.pp b/packages/palmunits/src/pdilib.pp
new file mode 100644
index 0000000000..0ba39e8e0f
--- /dev/null
+++ b/packages/palmunits/src/pdilib.pp
@@ -0,0 +1,264 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PdiLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Public API of versit lib
+ *
+ * History:
+ * Jan 19, 2000 Created by Alain BASTY
+ *
+ *****************************************************************************)
+
+unit pdilib;
+
+interface
+
+uses palmos, libtraps, errorbase, textmgr, udamgr, pdiconst;
+
+(*******************************************************************
+ * Unified data access types and macros
+ *******************************************************************)
+
+(*******************************************************************
+ * Pdi library built-in name constants (default dictionary)
+ *******************************************************************)
+
+// Constants for vObject Names id, (PR)operties (N)ames id
+// for (PA)rameters (N)ames id and (PA)rameters (V)alues id
+
+(*******************************************************************
+ * Internal library name which can be passed to SysLibFind()
+ *******************************************************************)
+
+const
+ kPdiLibName = 'Pdi.lib';
+
+(*******************************************************************
+ * Pdi Library function trap ID's
+ *******************************************************************)
+
+ PdiLibTrapReaderNew = sysLibTrapCustom;
+ PdiLibTrapReaderDelete = sysLibTrapCustom + 1;
+ PdiLibTrapWriterNew = sysLibTrapCustom + 2;
+ PdiLibTrapWriterDelete = sysLibTrapCustom + 3;
+ PdiLibTrapReadProperty = sysLibTrapCustom + 4;
+ PdiLibTrapReadPropertyField = sysLibTrapCustom + 5;
+ PdiLibTrapReadPropertyName = sysLibTrapCustom + 6;
+ PdiLibTrapReadParameter = sysLibTrapCustom + 7;
+ PdiLibTrapDefineResizing = sysLibTrapCustom + 8;
+ PdiLibTrapEnterObject = sysLibTrapCustom + 9;
+ PdiLibTrapWriteBeginObject = sysLibTrapCustom + 10;
+ PdiLibTrapWriteProperty = sysLibTrapCustom + 11;
+ PdiLibTrapWriteParameter = sysLibTrapCustom + 12;
+ PdiLibTrapWritePropertyValue = sysLibTrapCustom + 13;
+ PdiLibTrapWritePropertyFields = sysLibTrapCustom + 14;
+ PdiLibTrapWritePropertyBinaryValue = sysLibTrapCustom + 15;
+ PdiLibTrapSetEncoding = sysLibTrapCustom + 16;
+ PdiLibTrapSetCharset = sysLibTrapCustom + 17;
+ PdiLibTrapWritePropertyStr = sysLibTrapCustom + 18;
+ PdiLibTrapWriteParameterStr = sysLibTrapCustom + 19;
+ PdiLibTrapDefineReaderDictionary = sysLibTrapCustom + 20;
+ PdiLibTrapDefineWriterDictionary = sysLibTrapCustom + 21;
+
+(*******************************************************************
+ * Pdi Library result codes
+ *******************************************************************)
+
+ pdiErrRead = pdiErrorClass or 1;
+ pdiErrWrite = pdiErrorClass or 2;
+ pdiErrNoPropertyName = pdiErrorClass or 3;
+ pdiErrNoPropertyValue = pdiErrorClass or 4;
+ pdiErrMoreChars = pdiErrorClass or 5;
+ pdiErrNoMoreFields = pdiErrorClass or 6;
+ pdiErrOpenFailed = pdiErrorClass or 7;
+ pdiErrCloseFailed = pdiErrorClass or 8;
+
+(*******************************************************************
+ * Pdi library constants
+ *******************************************************************)
+
+ kPdiASCIIEncoding = 0; // consider ascii value
+ kPdiQPEncoding = kPdiPAV_ENCODING_QUOTED_PRINTABLE; // value must be QP encoded (write) or is QP encoded (read)
+ kPdiB64Encoding = kPdiPAV_ENCODING_BASE64; // value must be B64 encoded (write) or is B64 encoded (read)
+ kPdiBEncoding = kPdiPAV_ENCODING_B; // same as above but ENCODING=B in place of ENCODING=BASE64
+ kPdiEscapeEncoding = UInt16($8000); // special encoding where newline are backslashed
+ kPdiNoEncoding = UInt16($8001); // value must not be encoded (write)
+
+// Constants for structured property values
+ kPdiNoFields = UInt16(0); // Consider property value has just one field
+ kPdiCommaFields = UInt16(1); // Consider property value can have several fields comma separated
+ kPdiSemicolonFields = UInt16(2); // Consider property value can have several fields semicolon separated
+ kPdiDefaultFields = UInt16(4); // Accept default fields definition (dictionary information)
+ kPdiConvertComma = UInt16(8); // Consider property value has just one field, commas are converted to '\n'
+ kPdiConvertSemicolon = UInt16(16); // Consider property value has just one field, semicolons are converted to '\n'
+
+// Constants to manage parser/generator behavior
+
+// Generator behavior
+ kPdiEnableFolding = UInt16(1);
+ kPdiEnableQuotedPrintable = UInt16(2);
+ kPdiEscapeMultiFieldValues = UInt16(4); // Earlier PalmOS compatiblity
+ kPdiEnableB = UInt16(8); // New B encoding type (in place of base64)
+
+ kPdiPalmCompatibility = kPdiEscapeMultiFieldValues or kPdiEnableQuotedPrintable;
+
+// Parser behavior, currently the open parser is OK
+// Maybe future evolution will declare new constants
+ kPdiOpenParser = UInt16(16); // Generic parser
+
+// Constants to manage writting of values
+ kPdiWriteData = UInt16(0); // No charset computation (non text values)
+ kPdiWriteText = UInt16(8); // charset computation
+ kPdiWriteMultiline = UInt16(16); // if present: must encode else encoding is determinated by charset
+
+// Constant to manage growing buffers
+ kPdiResizableBuffer = UInt16($FFFF); // Special value to indicate a resizable buffer (handle based)
+ kPdiDefaultBufferMaxSize = UInt16($3FFF); // Maximum size of a resizable buffer non including terminal 0
+ kPdiDefaultBufferDeltaSize = UInt16($0010); // Delta (& minimum) size of resizable buffer
+
+// event mask of automata
+ kPdiEOFEventMask = UInt16(1);
+ kPdiGroupNameEventMask = UInt16(2); // A group name is found
+ kPdiPropertyNameEventMask = UInt16(4); // A property name is found
+ kPdiParameterNameEventMask = UInt16(8); // A parameter name is found
+ kPdiParameterValueEventMask = UInt16(16); // A parameter value is found
+ kPdiPropertyDefinedEventMask = UInt16(32); // A property definition is found (the ':' separator is reached)
+ kPdiPropertyValueEventMask = UInt16(64); // An entire property value is found
+ kPdiPropertyValueFieldEventMask = UInt16(128); // A value field is found (';' separated)
+ kPdiPropertyValueItemEventMask = UInt16(256); // A value item is found (',' separated)
+ kPdiPropertyValueMoreCharsEventMask = UInt16(512); // The application didn't provide a large enought buffer: more chars must be read
+ kPdiBeginObjectEventMask = UInt16(1024); // BEGIN reached
+ kPdiEndObjectEventMask = UInt16(2048); // END reached
+ kPdiPropertyValueCRLFEventMask = UInt16(4096); // A value item is found (',' separated)
+
+(*******************************************************************
+ * Public Data structures.
+ *******************************************************************)
+
+type
+ PdiDictionary = UInt8;
+ PdiDictionaryPtr = ^PdiDictionary;
+
+type
+ PdiReaderType = record
+ error: Err; // last error
+ encoding: UInt8; // Type of encoding of the property value
+ fieldNum: UInt8;
+ charset: CharEncodingType; // Charset of property value
+ written: UInt16; // Current number of chars already written in buffer
+ property_: UInt16; // ID of the current property
+ propertyValueType: UInt16; // type of property value
+ parameter: UInt16; // ID of the last parsed parameter name
+ parameterPairs: array [0..7] of UInt32; // set of bits of parsed parameter values
+ customFieldNumber: UInt16; // Value of X-PALM-CUSTOM (cutom fields)
+ appData: Pointer; // General usage app dependent field
+ pdiRefNum: UInt16; // The refNum of the Pdi library
+ events: UInt16; // Mask of events (see kPdiXXXXEventMask constants)
+ groupName: PChar;
+ propertyName: PChar;
+ parameterName: PChar;
+ parameterValue: PChar;
+ propertyValue: PChar;
+ end;
+ PdiReaderTag = PdiReaderType;
+ PdiReaderPtr = ^PdiReaderType;
+
+type
+ PdiWriterType = record
+ error: Err; // last error
+ encoding: UInt16; // Type of encoding of the property value
+ charset: CharEncodingType; // Charset of property value
+ appData: Pointer; // General usage app dependent field
+ pdiRefNum: UInt16; // The refNum of the Pdi library
+ end;
+ _PdiWriter = PdiWriterType;
+ PdiWriterPtr = ^PdiWriterType;
+
+(*******************************************************************
+ * Library Open & Close functions
+ *******************************************************************)
+
+function PdiLibOpen(libRefnum: UInt16): Err; syscall sysLibTrapOpen;
+
+function PdiLibClose(libRefnum: UInt16): Err; syscall sysLibTrapClose;
+
+(*******************************************************************
+ * Reader / Writer initialization & finalization functions
+ *******************************************************************)
+
+function PdiReaderNew(libRefnum: UInt16; input: UDAReaderPtr; version: UInt16): PdiReaderPtr; syscall PdiLibTrapReaderNew;
+
+procedure PdiReaderDelete(libRefnum: UInt16; ioReader: PdiReaderPtr); syscall PdiLibTrapReaderDelete;
+
+function PdiWriterNew(libRefnum: UInt16; output: UDAWriterPtr; version: UInt16): PdiWriterPtr; syscall PdiLibTrapWriterNew;
+
+procedure PdiWriterDelete(libRefnum: UInt16; ioWriter: PdiWriterPtr); syscall PdiLibTrapWriterDelete;
+
+(*******************************************************************
+ * Read functions group.
+ *******************************************************************)
+
+function PdiReadProperty(libRefnum: UInt16; ioReader: PdiReaderPtr): Err; syscall PdiLibTrapReadProperty;
+
+function PdiReadPropertyField(libRefnum: UInt16; ioReader: PdiReaderPtr; bufferPP: PCharPtr; bufferSize, readMode: UInt16): Err; syscall PdiLibTrapReadPropertyField;
+
+function PdiReadPropertyName(libRefnum: UInt16; ioReader: PdiReaderPtr): Err; syscall PdiLibTrapReadPropertyName;
+
+function PdiReadParameter(libRefnum: UInt16; ioReader: PdiReaderPtr): Err; syscall PdiLibTrapReadParameter;
+
+function PdiDefineResizing(libRefnum: UInt16; ioReader: PdiReaderPtr; deltaSize, maxSize: UInt16): Err; syscall PdiLibTrapDefineResizing;
+
+//!!!#define PdiParameterPairTest(reader, pair) \
+//!!! ((reader->parameterPairs[(pair) & 7] & ((UInt32) (1) << ((UInt8) (pair) >> 3))) != 0)
+
+(*******************************************************************
+ * Recursive objects functions group.
+ *******************************************************************)
+
+function PdiEnterObject(libRefnum: UInt16; ioReader: PdiReaderPtr): Err; syscall PdiLibTrapEnterObject;
+
+(*******************************************************************
+ * Write functions group.
+ *******************************************************************)
+
+function PdiWriteBeginObject(libRefnum: UInt16; ioWriter: PdiWriterPtr; objectNameID: UInt16): Err; syscall PdiLibTrapWriteBeginObject;
+
+function PdiWriteEndObject(libRefnum: UInt16; ioWriter: PdiWriterPtr; objectNameID: UInt16): Err; syscall PdiLibTrapWriteBeginObject;
+
+function PdiWriteProperty(libRefnum: UInt16; ioWriter: PdiWriterPtr; propertyNameID: UInt16): Err; syscall PdiLibTrapWriteProperty;
+
+function PdiWriteParameter(libRefnum: UInt16; ioWriter: PdiWriterPtr; parameter: UInt16; parameterName: Boolean): Err; syscall PdiLibTrapWriteParameter;
+
+function PdiWritePropertyValue(libRefnum:UInt16; ioWriter: PdiWriterPtr; buffer: PChar; options: UInt16): Err; syscall PdiLibTrapWritePropertyValue;
+
+function PdiWritePropertyFields(libRefnum: UInt16; ioWriter: PdiWriterPtr; fields: PCharPtr; fieldNumber, options: UInt16): Err; syscall PdiLibTrapWritePropertyFields;
+
+function PdiWritePropertyBinaryValue(libRefnum: UInt16; ioWriter: PdiWriterPtr; const buffer: PChar; size, options: UInt16): Err; syscall PdiLibTrapWritePropertyBinaryValue;
+
+function PdiSetEncoding(libRefnum: UInt16; ioWriter: PdiWriterPtr; encoding: UInt16): Err; syscall PdiLibTrapSetEncoding;
+
+function PdiSetCharset(libRefnum: UInt16; ioWriter: PdiWriterPtr; charset: CharEncodingType): Err; syscall PdiLibTrapSetCharset;
+
+function PdiWritePropertyStr(libRefnum: UInt16; ioWriter: PdiWriterPtr; const propertyName: PChar; writeMode, requiredFields: UInt8): Err; syscall PdiLibTrapWritePropertyStr;
+
+function PdiWriteParameterStr(libRefnum: UInt16; ioWriter: PdiWriterPtr; const parameterName, parameterValue: PChar): Err; syscall PdiLibTrapWriteParameterStr;
+
+(*******************************************************************
+ * Customisation functions group
+ *******************************************************************)
+
+function PdiDefineReaderDictionary(libRefnum: UInt16; ioReader: PdiReaderPtr; var dictionary: PdiDictionary; disableMainDictionary: Boolean): PdiDictionaryPtr; syscall PdiLibTrapDefineReaderDictionary;
+
+function PdiDefineWriterDictionary(libRefnum: UInt16; ioWriter: PdiWriterPtr; var dictionary: PdiDictionary; disableMainDictionary: Boolean): PdiDictionaryPtr; syscall PdiLibTrapDefineWriterDictionary;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/penmgr.pp b/packages/palmunits/src/penmgr.pp
new file mode 100644
index 0000000000..2ce5273c47
--- /dev/null
+++ b/packages/palmunits/src/penmgr.pp
@@ -0,0 +1,76 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PenMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Pen manager
+ *
+ * History:
+ * 6/5/96 Created by Ron Marianetti
+ *
+ *****************************************************************************)
+
+unit penmgr;
+
+interface
+
+uses palmos, coretraps, rect, errorbase;
+
+(********************************************************************
+ * Pen Manager Errors
+ * the constant serErrorClass is defined in ErrorBase.h
+ ********************************************************************)
+
+const
+ penErrBadParam = penErrorClass or 1;
+ penErrIgnorePoint = penErrorClass or 2;
+
+(********************************************************************
+ * Pen manager Routines
+ ********************************************************************)
+
+// Initializes the Pen Manager
+function PenOpen: Err; syscall sysTrapPenOpen;
+
+// Closes the Pen Manager and frees whatever memory it allocated
+function PenClose: Err; syscall sysTrapPenClose;
+
+
+// Put pen to sleep
+function PenSleep: Err; syscall sysTrapPenSleep;
+
+// Wake pen
+function PenWake: Err; syscall sysTrapPenWake;
+
+
+// Get the raw pen coordinates from the hardware.
+function PenGetRawPen(var penP: PointType): Err; syscall sysTrapPenGetRawPen;
+
+// Reset calibration in preparation for setting it again
+function PenResetCalibration: Err; syscall sysTrapPenResetCalibration;
+
+// Set calibration settings for the pen
+function PenCalibrate(var digTopLeftP, digBotRightP, scrTopLeftP, scrBotRightP: PointType): Err; syscall sysTrapPenCalibrate;
+
+// Scale a raw pen coordinate into screen coordinates
+function PenRawToScreen(var penP: PointType): Err; syscall sysTrapPenRawToScreen;
+
+// Scale a screen pen coordinate back into a raw coordinate
+function PenScreenToRaw(var penP: PointType): Err; syscall sysTrapPenScreenToRaw;
+
+(************************************************************
+ * Assembly Function Prototypes
+ *************************************************************)
+
+// _PenGetRawPen ASM_SYS_TRAP(sysTrapPenGetRawPen)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/phonelookup.pp b/packages/palmunits/src/phonelookup.pp
new file mode 100644
index 0000000000..757c5f1a6d
--- /dev/null
+++ b/packages/palmunits/src/phonelookup.pp
@@ -0,0 +1,33 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PhoneLookup.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines phone number lookup structures and routines.
+ *
+ * History:
+ * July 23, 1996 Created by Art Lamb
+ * March 24, 2000 Ludovic Ferrandis: Add custom API
+ *
+ *****************************************************************************)
+
+unit phonelookup;
+
+interface
+
+uses coretraps, field, applaunchcmd;
+
+procedure PhoneNumberLookup(var fldP: FieldType); syscall sysTrapPhoneNumberLookup;
+
+procedure PhoneNumberLookupCustom(var fldP: FieldType; params: AddrLookupParamsPtr; useClipboard: Boolean); syscall sysTrapPhoneNumberLookupCustom;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/preferences.pp b/packages/palmunits/src/preferences.pp
new file mode 100644
index 0000000000..1a3f9d4d85
--- /dev/null
+++ b/packages/palmunits/src/preferences.pp
@@ -0,0 +1,391 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Preferences.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit preferences;
+
+interface
+
+uses palmos, coretraps, datamgr, localemgr, datetime, localize, attentionmgr, systemmgr;
+
+(***********************************************************************
+ * Constants
+ ***********************************************************************)
+
+const
+ noPreferenceFound = -1;
+
+// Preference version constants
+ preferenceDataVer2 = 2; // Palm OS 2.0
+ preferenceDataVer3 = 3; // Palm OS 3.0
+ preferenceDataVer4 = 4; // Palm OS 3.1
+ preferenceDataVer5 = 5; // Palm OS 3.2a
+ preferenceDataVer6 = 6; // Palm OS 3.2b/3.3
+ preferenceDataVer8 = 8; // Palm OS 3.5
+ preferenceDataVer9 = 9; // Palm OS 4.0
+
+// Be SURE to update "preferenceDataVerLatest" when adding a new prefs version...
+ preferenceDataVerLatest = preferenceDataVer9;
+
+ defaultAutoOffDuration = 2; // minutes
+ defaultAutoOffDurationSecs = 2 * minutesInSeconds; // seconds
+
+ peggedAutoOffDuration = $FF; // minutes (UInt8)
+ peggedAutoOffDurationSecs = $FFFF; // seconds (UInt16)
+
+ defaultAutoLockType = 0; //!!!never; // Never auto lock device
+ defaultAutoLockTime = 0;
+ defaultAutoLockTimeFlag = 0;
+
+// Obsolete after V20
+{!!!
+ defaultSysSoundLevel = slOn;
+ defaultGameSoundLevel = slOn;
+ defaultAlarmSoundLevel = slOn;
+
+ defaultSysSoundVolume = sndMaxAmp;
+ defaultGameSoundVolume = sndMaxAmp;
+ defaultAlarmSoundVolume = sndMaxAmp;
+!!!}
+
+type
+ MeasurementSystemType = Enum;
+
+const
+ unitsEnglish = 0; // Feet, yards, miles, gallons, pounds, slugs, etc.
+ unitsMetric = Succ(unitsEnglish); // Meters, liters, grams, newtons, etc.
+
+// 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.
+
+type
+ SoundLevelTypeV20 = Enum;
+
+const
+ slOn = 0;
+ slOff = 1;
+
+// Device Automatic Locking options.
+type
+ SecurityAutoLockType = Enum;
+
+const
+ never = 0; // Auto-Lock disabled.
+ uponPowerOff = Succ(never); // Auto lock when the device powers off.
+ atPresetTime = Succ(uponPowerOff); // Auto lock at HH:MM every day.
+ afterPresetDelay = Succ(atPresetTime); // Auto lock after x minutes or hours.
+
+// The number format (thousands separator and decimal point). This defines
+// how numbers are formatted and not neccessarily currency numbers (i.e. Switzerland).
+type
+ AnimationLevelType = Enum;
+
+const
+ alOff = 0; // Never show an animation
+ alEventsOnly = Succ(alOff); // Show an animation for an event
+ alEventsAndRandom = Succ(alEventsOnly); // Also show random animation
+ alEventsAndMoreRandom = Succ(alEventsAndRandom); // Show random animations more frequently
+
+type
+ SystemPreferencesChoice = Enum;
+
+const
+ prefVersion = 0;
+ prefCountry = Succ(prefVersion);
+ prefDateFormat = Succ(prefCountry);
+ prefLongDateFormat = Succ(prefDateFormat);
+ prefWeekStartDay = Succ(prefLongDateFormat);
+ prefTimeFormat = Succ(prefWeekStartDay);
+ prefNumberFormat = Succ(prefTimeFormat);
+ prefAutoOffDuration = Succ(prefNumberFormat); // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes)
+ prefSysSoundLevelV20 = Succ(prefAutoOffDuration); // slOn or slOff - error beeps and other non-alarm/game sounds
+ prefGameSoundLevelV20 = Succ(prefSysSoundLevelV20); // slOn or slOff - game sound effects
+ prefAlarmSoundLevelV20 = Succ(prefGameSoundLevelV20); // slOn or slOff - alarm sound effects
+ prefHidePrivateRecordsV33 = Succ(prefAlarmSoundLevelV20);
+ prefDeviceLocked = Succ(prefHidePrivateRecordsV33);
+ prefLocalSyncRequiresPassword = Succ(prefDeviceLocked);
+ prefRemoteSyncRequiresPassword = Succ(prefLocalSyncRequiresPassword);
+ prefSysBatteryKind = Succ(prefRemoteSyncRequiresPassword);
+ prefAllowEasterEggs = Succ(prefSysBatteryKind);
+ prefMinutesWestOfGMT = Succ(prefAllowEasterEggs); // deprecated old unsigned minutes EAST of GMT
+ prefDaylightSavings = Succ(prefMinutesWestOfGMT); // deprecated old daylight saving time rule
+ prefRonamaticChar = Succ(prefDaylightSavings);
+ prefHard1CharAppCreator = Succ(prefRonamaticChar); // App creator for hard key #1
+ prefHard2CharAppCreator = Succ(prefHard1CharAppCreator); // App creator for hard key #2
+ prefHard3CharAppCreator = Succ(prefHard2CharAppCreator); // App creator for hard key #3
+ prefHard4CharAppCreator = Succ(prefHard3CharAppCreator); // App creator for hard key #4
+ prefCalcCharAppCreator = Succ(prefHard4CharAppCreator); // App creator for calculator soft key
+ prefHardCradleCharAppCreator = Succ(prefCalcCharAppCreator); // App creator for hard cradle key
+ prefLauncherAppCreator = Succ(prefHardCradleCharAppCreator); // App creator for launcher soft key
+ prefSysPrefFlags = Succ(prefLauncherAppCreator);
+ prefHardCradle2CharAppCreator = Succ(prefSysPrefFlags); // App creator for 2nd hard cradle key
+ prefAnimationLevel = Succ(prefHardCradle2CharAppCreator);
+
+ // Additions for PalmOS 3.0:
+ prefSysSoundVolume = Succ(prefAnimationLevel); // actual amplitude - error beeps and other non-alarm/game sounds
+ prefGameSoundVolume = Succ(prefSysSoundVolume); // actual amplitude - game sound effects
+ prefAlarmSoundVolume = Succ(prefGameSoundVolume); // actual amplitude - alarm sound effects
+ prefBeamReceive = Succ(prefAlarmSoundVolume); // not used - use ExgLibControl with ir(Get/Set)ScanningMode instead
+ prefCalibrateDigitizerAtReset = Succ(prefBeamReceive); // True makes the user calibrate at soft reset time
+ prefSystemKeyboardID = Succ(prefCalibrateDigitizerAtReset); // ID of the preferred keyboard resource
+ prefDefSerialPlugIn = Succ(prefSystemKeyboardID); // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ prefStayOnWhenPluggedIn = Succ(prefDefSerialPlugIn); // don't sleep after timeout when using line current
+ prefStayLitWhenPluggedIn = Succ(prefStayOnWhenPluggedIn); // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ prefAntennaCharAppCreator = Succ(prefStayLitWhenPluggedIn); // App creator for antenna key
+
+ // Additions for PalmOS 3.3:
+ prefMeasurementSystem = Succ(prefAntennaCharAppCreator); // English, Metric, etc.
+
+ // Additions for PalmOS 3.5:
+ prefShowPrivateRecords = Succ(prefMeasurementSystem); // returns privateRecordViewEnum
+ prefAutoOffDurationSecs = Succ(prefShowPrivateRecords); // auto-off duration in seconds
+
+ // Additions for PalmOS 4.0:
+ prefTimeZone = Succ(prefAutoOffDurationSecs); // GMT offset in minutes = Succ(); + for east of GMT = Succ(); - for west
+ prefDaylightSavingAdjustment = Succ(prefTimeZone); // current DST adjustment in minutes (typically 0 or 60)
+
+ prefAutoLockType = Succ(prefDaylightSavingAdjustment); // Never = Succ(); on poweroff = Succ(); after preset delay or at preset time.
+ prefAutoLockTime = Succ(prefAutoLockType); // Auto lock preset time or delay.
+ prefAutoLockTimeFlag = Succ(prefAutoLockTime); // For Minutes or Hours.
+
+ prefLanguage = Succ(prefAutoLockTimeFlag); // Language spoken in country selected via Setup app/Formats panel
+ prefLocale = Succ(prefLanguage); // Locale for country selected via Setup app/Formats panel
+
+ prefTimeZoneCountry = Succ(prefLocale); // Country used to specify time zone.
+
+ prefAttentionFlags = Succ(prefTimeZoneCountry); // User prefs for getting user's attention
+
+ prefDefaultAppCreator = Succ(prefAttentionFlags); // Default application launched on reset.
+
+type
+ SystemPreferencesTypeV10 = record
+ version: UInt16; // Version of preference info
+
+ // International preferences
+ country: CountryType; // Country the device is in
+ dateFormat: DateFormatType; // Format to display date in
+ longDateFormat: DateFormatType; // Format to display date in
+ weekStartDay: UInt8; // Sunday or Monday
+ timeFormat: TimeFormatType; // Format to display time in
+ numberFormat: NumberFormatType; // Format to display numbers in
+
+ // system preferences
+ autoOffDuration: UInt8; // Time period before shutting off (in minutes)
+ sysSoundLevel: SoundLevelTypeV20; // slOn or slOff - error beeps and other non-alarm sounds
+ alarmSoundLevel: SoundLevelTypeV20; // slOn or slOff - alarm only
+ hideSecretRecords: Boolean; // True to not display records with
+ // their secret bit attribute set
+ deviceLocked: Boolean; // Device locked until the system
+ // password is entered
+ reserved1: UInt8;
+ sysPrefFlags: UInt16; // 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.
+ reserved2: UInt8;
+ end;
+
+// 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.
+
+ SystemPreferencesType = record
+ version: UInt16; // Version of preference info
+
+ // International preferences
+ country: CountryType; // Country the device is in (see PalmLocale.pas)
+ dateFormat: DateFormatType; // Format to display date in
+ longDateFormat: DateFormatType; // Format to display date in
+ weekStartDay: Int8; // Sunday or Monday
+ timeFormat: TimeFormatType; // Format to display time in
+ numberFormat: NumberFormatType; // Format to display numbers in
+
+ // system preferences
+ autoOffDuration: UInt8; // Time period in minutes before shutting off (use autoOffDurationSecs instead).
+ sysSoundLevelV20: SoundLevelTypeV20; // slOn or slOff - error beeps and other non-alarm/game sounds
+ gameSoundLevelV20: SoundLevelTypeV20; // slOn or slOff - game sound effects
+ alarmSoundLevelV20: SoundLevelTypeV20; // slOn or slOff - alarm sound effects
+ hideSecretRecords: Boolean; // True to not display records with
+ // their secret bit attribute set
+ deviceLocked: Boolean; // Device locked until the system
+ // password is entered
+ localSyncRequiresPassword: Boolean; // User must enter password on Pilot
+ remoteSyncRequiresPassword: Boolean; // User must enter password on Pilot
+ sysPrefFlags: UInt16; // 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.
+ reserved1: UInt8;
+ minutesWestOfGMT: UInt32; // minutes west of Greenwich
+ daylightSavings: DaylightSavingsTypes; // Type of daylight savings correction
+ reserved2: UInt8;
+ ronamaticChar: UInt16; // character to generate from ronamatic stroke.
+ // Typically it popups the onscreen keyboard.
+ hard1CharAppCreator: UInt32; // creator of application to launch in response
+ // to the hard button #1. Used by SysHandleEvent.
+ hard2CharAppCreator: UInt32; // creator of application to launch in response
+ // to the hard button #2. Used by SysHandleEvent.
+ hard3CharAppCreator: UInt32; // creator of application to launch in response
+ // to the hard button #3. Used by SysHandleEvent.
+ hard4CharAppCreator: UInt32; // creator of application to launch in response
+ // to the hard button #4. Used by SysHandleEvent.
+ calcCharAppCreator: UInt32; // creator of application to launch in response
+ // to the Calculator icon. Used by SysHandleEvent.
+ hardCradleCharAppCreator: UInt32; // creator of application to launch in response
+ // to the Cradle button. Used by SysHandleEvent.
+ launcherCharAppCreator: UInt32; // creator of application to launch in response
+ // to the launcher button. Used by SysHandleEvent.
+ hardCradle2CharAppCreator: UInt32; // creator of application to launch in response
+ // to the 2nd Cradle button. Used by SysHandleEvent.
+ animationLevel: AnimationLevelType; // amount of animation to display
+
+ maskPrivateRecords: Boolean; // 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:
+ sysSoundVolume: UInt16; // system amplitude (0 - sndMaxAmp) - taps, beeps
+ gameSoundVolume: UInt16; // game amplitude (0 - sndMaxAmp) - explosions
+ alarmSoundVolume: UInt16; // alarm amplitude (0 - sndMaxAmp)
+ beamReceive: Boolean; // False turns off IR sniffing, sends still work.
+ calibrateDigitizerAtReset: Boolean; // True makes the user calibrate at soft reset time
+ systemKeyboardID: UInt16; // ID of the preferred keyboard resource
+ defSerialPlugIn: UInt32; // creator ID of the default serial plug-in
+
+ // Additions for PalmOS 3.1:
+ stayOnWhenPluggedIn: Boolean; // don't sleep after timeout when using line current
+ stayLitWhenPluggedIn: Boolean; // keep backlight on when not sleeping on line current
+
+ // Additions for PalmOS 3.2:
+ antennaCharAppCreator: UInt32; // creator of application to launch in response
+ // to the antenna key. Used by SysHandleEvent.
+
+ // Additions for PalmOS 3.5:
+ measurementSystem: MeasurementSystemType; // metric, english, etc.
+ reserved3: UInt8;
+ autoOffDurationSecs: UInt16; // Time period in seconds before shutting off.
+
+ // Additions for PalmOS 4.0:
+ timeZone: Int16; // minutes east of Greenwich
+ daylightSavingAdjustment: Int16; // current daylight saving correction in minutes
+ timeZoneCountry: CountryType; // country used to specify time zone.
+ autoLockType: SecurityAutoLockType; // Never, on power off, after preset delay or at preset time
+ autoLockTime: UInt32; // Auto lock preset time or delay.
+ autoLockTimeFlag: Boolean; // For Minutes or Hours.
+ language: LanguageType; // Language spoken in country selected via Setup app/Formats panel
+
+ attentionFlags: AttnFlagsType; // User prefs for getting user's attention
+
+ defaultAppCreator: UInt32; // Creator of the default "safe" app that is launched
+ // on a reset.
+ end;
+
+ SystemPreferencesPtr = ^SystemPreferencesType;
+
+// structure of the resource that holds hard/soft button defaults
+type
+ ButtonDefaultAppType = record
+ keyCode: UInt16; // virtual key code of the hard/soft button
+ creator: UInt32; // app creator code
+ end;
+
+type
+ ButtonDefaultListType = record
+ numButtons: UInt16; // number of default button assignments
+ button: array [0..0] of ButtonDefaultAppType; // array of button assignments
+ end;
+
+//-------------------------------------------------------------------
+// Preferences routines
+//-------------------------------------------------------------------
+
+function PrefOpenPreferenceDBV10: DmOpenRef; syscall sysTrapPrefOpenPreferenceDBV10;
+
+function PrefOpenPreferenceDB(saved: Boolean): DmOpenRef; syscall sysTrapPrefOpenPreferenceDB;
+
+procedure PrefGetPreferences(p: SystemPreferencesPtr); syscall sysTrapPrefGetPreferences;
+
+procedure PrefSetPreferences(p: SystemPreferencesPtr); syscall sysTrapPrefSetPreferences;
+
+function PrefGetPreference(choice: SystemPreferencesChoice): UInt32; syscall sysTrapPrefGetPreference;
+
+procedure PrefSetPreference(choice: SystemPreferencesChoice; value: UInt32); syscall sysTrapPrefSetPreference;
+
+function PrefGetAppPreferences(creator: UInt32; id: UInt16; prefs: Pointer;
+ var prefsSize: UInt16; saved: Boolean): Int16; syscall sysTrapPrefGetAppPreferences;
+
+function PrefGetAppPreferencesV10(type_: UInt32; version: Int16; prefs: Pointer; prefsSize: UInt16): Boolean; syscall sysTrapPrefGetAppPreferencesV10;
+
+procedure PrefSetAppPreferences(creator: UInt32; id: UInt16; version: Int16;
+ const prefs: Pointer; prefsSize: UInt16; saved: Boolean); syscall sysTrapPrefSetAppPreferences;
+
+procedure PrefSetAppPreferencesV10(creator: UInt32; version: Int16; prefs: Pointer; prefsSize: UInt16); syscall sysTrapPrefSetAppPreferencesV10;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/privaterecords.pp b/packages/palmunits/src/privaterecords.pp
new file mode 100644
index 0000000000..e2cc1b6136
--- /dev/null
+++ b/packages/palmunits/src/privaterecords.pp
@@ -0,0 +1,45 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: PrivateRecords.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This header file defines a generic private record maintainance dialogs, etc.
+ *
+ * History:
+ * 6/23/99. Created by Craig Skinner
+ *
+ *****************************************************************************)
+
+unit privaterecords;
+
+interface
+
+uses palmos, coretraps;
+
+// Defines needed for hidden record visual determination.
+type
+ privateRecordViewEnum = Enum;
+
+const
+ showPrivateRecords = $00;
+ maskPrivateRecords = Succ(showPrivateRecords);
+ hidePrivateRecords = Succ(maskPrivateRecords);
+
+//-----------------------------------------------------------------------
+// Prototypes
+//-----------------------------------------------------------------------
+
+function SecSelectViewStatus: privateRecordViewEnum; syscall sysTrapSecSelectViewStatus;
+
+function SecVerifyPW(newSecLevel: privateRecordViewEnum): Boolean; syscall sysTrapSecVerifyPW;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/progress.pp b/packages/palmunits/src/progress.pp
new file mode 100644
index 0000000000..2c24a1a9c3
--- /dev/null
+++ b/packages/palmunits/src/progress.pp
@@ -0,0 +1,251 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Progress.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This header file defines a generic progress dialog interface
+ *
+ * History:
+ * 6/4/97 from Ron Marianetti's net dialog stuff Created by Gavin Peacock
+ *
+ *****************************************************************************)
+
+unit progress;
+
+interface
+
+uses palmos, coretraps, control;
+
+const
+ progressMaxMessage = 128;
+ progressMaxTitle = 31; // max size for title of progress dialog
+ progressMaxButtonText = 7; // max size of text in OK/Cancel button
+
+// Progress callback function
+// The progress dialog will call this function to get the text to display for the
+// current status.
+// stage - the current stage of progess as defined by your app
+// message - text that can be sent from the protocol
+// cancel - true if the dialog is in cancel mode
+// error - current error (func should return an error message in this case...
+type
+ PrgCallbackData = record
+ stage: UInt16; // <= current stage
+ textP: PChar; // => buffer to hold text to display
+ textLen: UInt16; // <= length of text buffer
+ message: PChar; // <= additional text for display
+ error: Err; // <= current error
+ bitmapId: UInt16; // => resource ID of bitmap to display
+ Bits: UInt16;
+{
+ UInt16 canceled:1; // <= true if user has pressed the cancel button
+ UInt16 showDetails:1; // <= true if user pressed down arrow for more details
+ UInt16 textChanged:1; // => if true then update text (defaults to true)
+ UInt16 timedOut:1; // <= true if update caused by a timeout
+}
+ timeout: UInt32; // <> timeout in ticks to force next update (for animation)
+
+ //progress bar info (Not Implemented)
+ barMaxValue: UInt32; // the maximum value for the progress bar, if = 0 then the bar is
+ // not visible
+ barCurValue: UInt32; // the current value of the progress bar, the bar will be drawn
+ // filled the percentage of maxValue \ value
+ barMessage: PChar; // additional text for display below the progress bar.
+ barFlags: UInt16; // reserved for future use.
+
+ //
+ // *** The following fields were added in PalmOS 3.2 ***
+ //
+
+ delay_bits: UInt16;
+{
+ UInt16 delay:1; // => if true delay 1 second after updating form icon/msg
+}
+ userDataP: Pointer; // <= context pointer that caller passed to PrgStartDialog
+ end;
+
+ PrgCallbackDataPtr = ^PrgCallbackData;
+
+//typedef Boolean (*PrgCallbackFunc) (UInt16 stage,Boolean showDetails,Char *message,Boolean cancel,UInt16 error,Char *textP, UInt16 maxtextLen,UInt16 *bitmapID);
+
+ PrgCallbackFunc = function(cbP: PrgCallbackDataPtr): Boolean;
+
+//---------------------------------------------------------------------------
+// Structure of the Progress Info structure. This structure should be stored
+// in the interface's globals. Each of the routines in SerNetIFCommon.c
+// take a pointer to this structure.
+//---------------------------------------------------------------------------
+
+ ProgressType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_PROGRESS}
+
+ // This field contains a pointer to the open progress dialog
+ frmP: FormPtr; // Our progress dialog ptr
+
+ // This field is set a maximum time for the action to take place. A cancel
+ // will be generated if this timeout is reached
+ timeout: UInt32; // max time to wait in ticks
+
+
+ Bits: UInt16;
+{
+ // This boolean is set by either the protocol (through PrgUpdateDialog()) or UI
+ // task to inform the UI that it needs to update it's progress dialog with new
+ // information as stored in the error, stage, and message fields.
+ UInt16 needUpdate:1; // true if UI update required.
+
+
+ // The following boolean is set by the UI task when the user hits the cancel button.
+ // When the user cancels, the UI changes to display "Cancelling..." and then waits
+ // for the protocol task to notice the user cancel and set the error field to
+ // netErrUserCancel before disposing the dialog. The SerIFUserCancel() which is
+ // called from the protocol task checks this boolean.
+ UInt16 cancel:1; // true if cancelling
+
+
+ // This boolean is set by PrvCheckEvents() after we've displayed an error message
+ // in the progress dialog and changed the "cancel" button to an "OK" button.
+ // This tells the dialog event handling code in PrvCheckEvents() that it should
+ // dispose of the dialog on the next hit of the cancel/OK button.
+ UInt16 waitingForOK:1; // true if waiting for OK button hit.
+
+
+ // This boolean gets set if the user hits the down button while the UI is up. It
+ // causes more detailed progress to be shown
+ UInt16 showDetails:1; // show progress details.
+
+ // This is set to true whenever the message text is changed. This allows the
+ // display to be more efficient by not redrawing when not needed
+ UInt16 messageChanged: 1;
+}
+
+ //-----------------------------------------------------------------------
+ // The following fields are set by PrgUpdateDialog() and used by PrgHandleEvent()
+ // to figure out what to display in the progress dialog
+ //-----------------------------------------------------------------------
+
+ // This word is set by the protocol task (through PrgUpdateDialog()) when an
+ // error occurs during connection establishment. If this error is non-nil
+ // and not equal to netErrUserCancel, the UI task will display the appropriate
+ // error message and change the cancel button to an OK button, set the waitingForOK
+ // boolean and wait for the user to hit the OK button before disposing
+ // the dialog.
+ error: UInt16; // error set by interface
+
+ // This enum is set by the protocol task (through PrgUpdateDialog()) as it
+ // progresses through the connection establishment and is checked by
+ // PrgHandleEvent() when needUpate is true. It is used to determine what
+ // string to display in the progress dialog.
+ stage: UInt16; // which stage of the connection we're in
+
+
+ // This is an additional string that is displayed in the progress dialog for
+ // certain stages. The netConStageSending stage for example uses this string
+ // for holding the text string that it is sending. It is set by
+ // PrgUpdateDialog().
+ message: array [0..progressMaxMessage] of Char; // connection stage message.
+
+ reserved1: UInt8;
+
+ // Used to cache current icon number so we don't unnecessarily redraw it
+ lastBitmapID: UInt16;
+
+ // Text array used to hold control title for the OK/Cancel button. This
+ // must be kept around while the control is present in case of updates.
+ ctlLabel: array [0..progressMaxButtonText] of Char;
+
+ serviceNameP: PChar;
+
+ //progress bar stuff (Not implemented)
+ lastBarMaxValue: UInt32;
+ lastBarCurValue: UInt32;
+
+ // stuff for saving old window state
+ oldDrawWinH: WinHandle;
+ oldActiveWinH: WinHandle;
+ oldFrmP: FormPtr;
+ oldInsPtState: Boolean;
+ reserved2: UInt8;
+ oldInsPtPos: PointType;
+
+ textCallback: PrgCallbackFunc;
+
+ title: array [0..progressMaxTitle] of Char;
+
+ //
+ // *** The following field was added in PalmOS 3.2 ***
+ //
+
+ userDataP: Pointer;
+ {$else}
+ opaque1: UInt32;
+ opaque2: UInt32;
+ Bits: UInt16;
+
+ {!!!
+ UInt16 opaque3:1;
+
+ // The following boolean is set by the UI task when the user hits the cancel button.
+ // When the user cancels, the UI changes to display "Cancelling..." and then waits
+ // for the protocol task to notice the user cancel and set the error field to
+ // netErrUserCancel before disposing the dialog. The SerIFUserCancel() which is
+ // called from the protocol task checks this boolean.
+ UInt16 cancel:1; // true if cancelling
+
+ UInt16 opaque4:14;
+ !!!}
+ // This word is set by the protocol task (through PrgUpdateDialog()) when an
+ // error occurs during connection establishment. If this error is non-nil
+ // and not equal to netErrUserCancel, the UI task will display the appropriate
+ // error message and change the cancel button to an OK button, set the waitingForOK
+ // boolean and wait for the user to hit the OK button before disposing
+ // the dialog.
+ error: UInt16; // error set by interface
+
+ // This enum is set by the protocol task (through PrgUpdateDialog()) as it
+ // progresses through the connection establishment and is checked by
+ // PrgHandleEvent() when needUpate is true. It is used to determine what
+ // string to display in the progress dialog.
+ stage: UInt16; // which stage of the connection we're in
+ {$endif}
+ end;
+
+ ProgressPtr = ^ProgressType;
+
+// Warning: In the future, the ProgressType will be opaque. So, please don't
+// write code that depends on its internals; you'll just pass it around as a
+// "cookie," and that's how you should be treating it now.
+
+// macro to test if the user has canceled
+
+function PrgUserCancel(prgP: ProgressPtr): Boolean;
+
+//-----------------------------------------------------------------------
+// Prototypes
+//-----------------------------------------------------------------------
+
+function PrgStartDialogV31(const title: PChar; textCallback: PrgCallbackFunc): ProgressPtr; syscall sysTrapPrgStartDialogV31;
+
+function PrgStartDialog(const title: PChar; textCallback: PrgCallbackFunc; userDataP: Pointer): ProgressPtr; syscall sysTrapPrgStartDialog;
+
+procedure PrgStopDialog(prgP: ProgressPtr; force: Boolean); syscall sysTrapPrgStopDialog;
+
+procedure PrgUpdateDialog(prgGP: ProgressPtr; err, stage: UInt16; const messageP: PChar; updateNow: Boolean); syscall sysTrapPrgUpdateDialog;
+
+function PrgHandleEvent(prgGP: ProgressPtr; eventP: EventPtr): Boolean; syscall sysTrapPrgHandleEvent;
+
+implementation
+
+function PrgUserCancel(prgP: ProgressPtr): Boolean;
+begin
+ PrgUserCancel := (prgP^.Bits and $4000) <> 0; // cancel
+end;
+
+end.
diff --git a/packages/palmunits/src/rect.pp b/packages/palmunits/src/rect.pp
new file mode 100644
index 0000000000..dd4f7759be
--- /dev/null
+++ b/packages/palmunits/src/rect.pp
@@ -0,0 +1,63 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Rect.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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
+ *
+ *****************************************************************************)
+{$MACRO ON}
+
+unit rect;
+
+interface
+
+uses palmos, coretraps;
+
+type
+ AbsRectType = record
+ left: Coord;
+ top: Coord;
+ right: Coord;
+ bottom: Coord;
+ end;
+
+ PointType = record
+ x: Coord;
+ y: Coord;
+ end;
+ PointPtr = ^PointType;
+
+ RectangleType = record
+ topLeft: PointType;
+ extent: PointType;
+ end;
+
+ RectanglePtr = ^RectangleType;
+
+procedure RctSetRectangle(var rP: RectangleType; left, top, width, height: Coord); syscall sysTrapRctSetRectangle;
+
+procedure RctCopyRectangle({const} var srcRectP: RectangleType; var dstRectP: RectangleType); syscall sysTrapRctCopyRectangle;
+
+procedure RctInsetRectangle(var rP: RectangleType; insetAmt: Coord); syscall sysTrapRctInsetRectangle;
+
+procedure RctOffsetRectangle(var rP: RectangleType; deltaX, deltaY: Coord); syscall sysTrapRctOffsetRectangle;
+
+function RctPtInRectangle(x, y: Coord; {const} var rP: RectangleType): Boolean; syscall sysTrapRctPtInRectangle;
+
+procedure RctGetIntersection({const} var r1P, r2P: RectangleType; var r3P: RectangleType); syscall sysTrapRctGetIntersection;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/scrollbar.pp b/packages/palmunits/src/scrollbar.pp
new file mode 100644
index 0000000000..570e9682d0
--- /dev/null
+++ b/packages/palmunits/src/scrollbar.pp
@@ -0,0 +1,76 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: ScrollBar.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines scroll bar structures and routines.
+ *
+ * History:
+ * Feb 6, 1996 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit scrollbar;
+
+interface
+
+uses palmos, coretraps, control;
+
+type
+ ScrollBarRegionType = Enum;
+
+const
+ sclUpArrow = 0;
+ sclDownArrow = Succ(sclUpArrow);
+ sclUpPage = Succ(sclDownArrow);
+ sclDownPage = Succ(sclUpPage);
+ sclCar = Succ(sclDownPage);
+
+type
+ ScrollBarAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 usable :1; // Set if part of ui
+ UInt16 visible :1; // Set if drawn, used internally
+ UInt16 hilighted :1; // Set if region is hilighted
+ UInt16 shown :1; // Set if drawn and maxValue > minValue
+ UInt16 activeRegion :4; // ScrollBarRegionType
+ UInt16 reserved :8; // Reserved for future use
+}
+ {$endif}
+ end;
+ ScrollBarAttrTag = ScrollBarAttrType;
+
+ ScrollBarType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_SCROLLBARS} // These fields will not be available in the next OS release!
+ bounds: RectangleType;
+ id: UInt16;
+ attr: ScrollBarAttrType;
+ value: Int16;
+ minValue: Int16;
+ maxValue: Int16;
+ pageSize: Int16;
+ penPosInCar: Int16;
+ savePos: Int16;
+ {$endif}
+ end;
+
+ ScrollBarPtr = ^ScrollBarType;
+
+procedure SclGetScrollBar(const bar: ScrollBarPtr; var valueP, minP, maxP, pageSizeP: Int16); syscall sysTrapSclGetScrollBar;
+
+procedure SclSetScrollBar(bar: ScrollBarPtr; value: Int16; const min, max, pageSize: Int16); syscall sysTrapSclSetScrollBar;
+
+procedure SclDrawScrollBar(bar: ScrollBarPtr); syscall sysTrapSclDrawScrollBar;
+
+function SclHandleEvent(bar: ScrollBarPtr; const event: EventPtr): Boolean; syscall sysTrapSclHandleEvent;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/selday.pp b/packages/palmunits/src/selday.pp
new file mode 100644
index 0000000000..bae36d1b1c
--- /dev/null
+++ b/packages/palmunits/src/selday.pp
@@ -0,0 +1,37 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SelDay.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines the date picker month object's structures
+ * and routines.
+ *
+ * History:
+ * November 10, 1994 Created by Roger Flores
+ *
+ *****************************************************************************)
+
+unit selday;
+
+interface
+
+uses palmos, coretraps, datetime, day;
+
+const
+ daySelectorMinYear = firstYear;
+ daySelectorMaxYear = lastYear;
+
+function SelectDayV10(var month, day, year: Int16; const title: PChar): Boolean; syscall sysTrapSelectDayV10;
+
+function SelectDay(const selectDayBy: SelectDayType; var month, day, year: Int16; const title: PChar): Boolean; syscall sysTrapSelectDay;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/seltime.pp b/packages/palmunits/src/seltime.pp
new file mode 100644
index 0000000000..9ae207b7aa
--- /dev/null
+++ b/packages/palmunits/src/seltime.pp
@@ -0,0 +1,50 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SelTime.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines select time structures and routines.
+ *
+ * History:
+ * December 6, 1994 Created by Roger Flores
+ * Nick Twyman 8/4/98. Added SelectOneTime trap
+ *
+ *****************************************************************************)
+
+unit seltime;
+
+interface
+
+uses palmos, coretraps, datetime;
+
+//-------------------------------------------------------------------
+// structures
+//-------------------------------------------------------------------
+
+type
+ HMSTime = record
+ hours: UInt8;
+ minutes: UInt8;
+ seconds: UInt8;
+ reserved: UInt8;
+ end;
+
+// This is slated to be deleted in the next version.
+function SelectTimeV33(var startTimeP, EndTimeP: TimeType; untimed: Boolean;
+ const titleP: PChar; startOfDay: Int16): Boolean; syscall sysTrapSelectTimeV33;
+
+function SelectTime(var startTimeP, EndTimeP: TimeType; untimed: Boolean; const titleP: PChar;
+ startOfDay, endOfDay, startOfDisplay: Int16): Boolean; syscall sysTrapSelectTime;
+
+function SelectOneTime(var hour, minute: Int16; const titleP: PChar): Boolean; syscall sysTrapSelectOneTime;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/seltimezone.pp b/packages/palmunits/src/seltimezone.pp
new file mode 100644
index 0000000000..d0a2d36214
--- /dev/null
+++ b/packages/palmunits/src/seltimezone.pp
@@ -0,0 +1,40 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SelTimeZone.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines select time zone structures and routines.
+ *
+ * History:
+ * 03/02/2000 peter Created by Peter Epstein.
+ * 08/02/2000 kwk Updated APIs to include country code.
+ * 08/21/2000 kwk Deleted obsolete SelectDaylightSavingAdjustment.
+ * 11/17/2000 CS Change SelectTimeZone's ioCountryInTimeZoneP parameter
+ * to ioLocaleInTimeZoneP, (and anyCountry to anyLocale,
+ * but that doesn't really matter), since CountryType is
+ * only a UInt8, and this may change someday.
+ * CS Change GetTimeZoneTriggerText's countryInTimeZone
+ * parameter to localeInTimeZoneP, since CountryType is
+ * only a UInt8, and this may change someday.
+ *
+ *****************************************************************************)
+
+unit seltimezone;
+
+interface
+
+uses palmos, coretraps, localemgr;
+
+function SelectTimeZone(var ioTimeZoneP: Int16; var ioLocaleInTimeZoneP: LmLocaleType;
+ {const} titleP: PChar; showTimes, anyLocale: Boolean): Boolean; syscall sysTrapSelectTimeZone;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/seriallinkmgr.pp b/packages/palmunits/src/seriallinkmgr.pp
new file mode 100644
index 0000000000..affd465532
--- /dev/null
+++ b/packages/palmunits/src/seriallinkmgr.pp
@@ -0,0 +1,249 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialLinkMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Source for Serial Link Routines on Pilot
+ *
+ * History:
+ * 2/6/95 replaces DSerial.h from Debugger
+ *
+ *****************************************************************************)
+
+unit seriallinkmgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+//*************************************************************************
+// Pre-defined, fixxed Socket ID's
+//*************************************************************************
+
+const
+ slkSocketDebugger = 0; // Debugger Socket
+ slkSocketConsole = 1; // Console Socket
+ slkSocketRemoteUI = 2; // Remote UI Socket
+ slkSocketDLP = 3; // Desktop Link Socket
+ slkSocketFirstDynamic = 4; // first dynamic socket ID
+
+//*************************************************************************
+// Packet Types
+//*************************************************************************
+
+const
+ slkPktTypeSystem = 0; // System packets
+ slkPktTypeUnused1 = 1; // used to be: Connection Manager packets
+ slkPktTypePAD = 2; // PAD Protocol packets
+ 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.
+//----------------------------------------------------------------------
+
+type
+ SlkPktHeaderChecksum = UInt8;
+
+ SlkPktHeaderType = record
+ signature1: UInt16; // X first 2 bytes of signature
+ signature2: UInt8; // X 3 and final byte of signature
+ dest: UInt8; // -> destination socket Id
+ src: UInt8; // -> src socket Id
+ type_: UInt8; // -> packet type
+ bodySize: UInt16; // X size of body
+ transId: UInt8; // -> transaction Id
+ // if 0 specified, it will be replaced
+ checksum: SlkPktHeaderChecksum; // X check sum of header
+ end;
+
+ SlkPktHeaderPtr = ^SlkPktHeaderType;
+
+const
+ slkPktHeaderSignature1 = $BEEF;
+ slkPktHeaderSignature2 = $ED;
+
+ slkPktHeaderSigFirst = $BE; // First byte
+ slkPktHeaderSigSecond = $EF; // second byte
+ slkPktHeaderSigThird = $ED; // third byte
+
+//----------------------------------------------------------------------
+// packet footer
+//----------------------------------------------------------------------
+
+type
+ SlkPktFooterType = record
+ crc16: UInt16; // header and body crc
+ end;
+
+ SlkPktFooterPtr = ^SlkPktFooterType;
+
+//*************************************************************************
+//
+// 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.
+//
+//*************************************************************************
+
+ SlkWriteDataType = record
+ size: UInt16; // last one has size of 0
+ dataP: Pointer; // pointer to data
+ end;
+
+ SlkWriteDataPtr = ^SlkWriteDataType;
+
+(*******************************************************************
+ * Serial Link Manager Errors
+ * the constant slkErrorClass is defined in SystemMgr.h
+ *******************************************************************)
+
+const
+ slkErrChecksum = slkErrorClass or 1;
+ slkErrFormat = slkErrorClass or 2;
+ slkErrBuffer = slkErrorClass or 3;
+ slkErrTimeOut = slkErrorClass or 4;
+ slkErrHandle = slkErrorClass or 5;
+ slkErrBodyLimit = slkErrorClass or 6;
+ slkErrTransId = slkErrorClass or 7;
+ slkErrResponse = slkErrorClass or 8;
+ slkErrNoDefaultProc = slkErrorClass or 9;
+ slkErrWrongPacketType = slkErrorClass or 10;
+ slkErrBadParam = slkErrorClass or 11;
+ slkErrAlreadyOpen = slkErrorClass or 12;
+ slkErrOutOfSockets = slkErrorClass or 13;
+ slkErrSocketNotOpen = slkErrorClass or 14;
+ slkErrWrongDestSocket = slkErrorClass or 15;
+ slkErrWrongPktType = slkErrorClass or 16;
+ slkErrBusy = slkErrorClass or 17; // called while sending a packet
+ // only returned on single-threaded
+ // emulation implementations
+ slkErrNotOpen = slkErrorClass or 18;
+
+(*******************************************************************
+ * Type definition for a Serial Link Socket Listener
+ *
+ *******************************************************************)
+
+type
+ SlkSocketListenerProcPtr = procedure(headerP: SlkPktHeaderPtr; bodyP: Pointer);
+
+ SlkSocketListenType = record
+ listenerP: SlkSocketListenerProcPtr;
+ headerBufferP: SlkPktHeaderPtr; // App allocated buffer for header
+ bodyBufferP: Pointer; // App allocated buffer for body
+ bodyBufferSize: UInt32;
+ end;
+
+ SlkSocketListenPtr = ^SlkSocketListenType;
+
+(*******************************************************************
+ * Prototypes
+ *******************************************************************)
+
+//-------------------------------------------------------------------
+// Initializes the Serial Link Manager
+//-------------------------------------------------------------------
+
+function SlkOpen: Err; syscall sysTrapSlkOpen;
+
+//-------------------------------------------------------------------
+// Close down the Serial Link Manager
+//-------------------------------------------------------------------
+
+function SlkClose: Err; syscall sysTrapSlkClose;
+
+//-------------------------------------------------------------------
+// Open up another Serial Link socket. The caller must have already
+// opened the comm library and set it to the right settings.
+//-------------------------------------------------------------------
+
+function SlkOpenSocket(portID: UInt16; var socketP: UInt16; staticSocket: Boolean): Err; syscall 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).
+//-------------------------------------------------------------------
+
+function SlkCloseSocket(socket: UInt16): Err; syscall sysTrapSlkCloseSocket;
+
+//-------------------------------------------------------------------
+// Get the library refNum for a particular Socket
+//-------------------------------------------------------------------
+
+function SlkSocketPortID(socket: UInt16; var portIDP: UInt16): Err; syscall sysTrapSlkSocketRefNum;
+
+//-------------------------------------------------------------------
+// Set the in-packet timeout for a socket
+//-------------------------------------------------------------------
+
+function SlkSocketSetTimeout(socket: UInt16; timeout: Int32): Err; syscall sysTrapSlkSocketSetTimeout;
+
+//-------------------------------------------------------------------
+// Flush a Socket
+//-------------------------------------------------------------------
+
+function SlkFlushSocket(socket: UInt16; timeout: Int32): Err; syscall sysTrapSlkFlushSocket;
+
+//-------------------------------------------------------------------
+// Set up a Socket Listener
+//-------------------------------------------------------------------
+
+function SlkSetSocketListener(socket: UInt16; socketP: SlkSocketListenPtr): Err; syscall 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
+//-------------------------------------------------------------------
+
+function SlkSendPacket(headerP: SlkPktHeaderPtr; writeList: SlkWriteDataPtr): Err; syscall sysTrapSlkSendPacket;
+
+//-------------------------------------------------------------------
+// Receives and validates an entire packet.
+// errors returned: dseHandle, dseParam, dseLine, dseIO, dseFormat,
+// dseChecksum, dseBuffer, dseBodyLimit, dseTimeOut,
+// dseOther
+//-------------------------------------------------------------------
+
+function SlkReceivePacket(socket: UInt16; andOtherSockets: Boolean;
+ headerP: SlkPktHeaderPtr; bodyP: Pointer; bodySize: UInt16;
+ timeout: Int32): Err; syscall sysTrapSlkReceivePacket;
+
+//-------------------------------------------------------------------
+// Do Default processing of a System packet
+//-------------------------------------------------------------------
+
+function SlkSysPktDefaultResponse(headerP: SlkPktHeaderPtr; bodyP: Pointer): Err; syscall sysTrapSlkSysPktDefaultResponse;
+
+//-------------------------------------------------------------------
+// Do RPC call
+//-------------------------------------------------------------------
+
+function SlkProcessRPC(headerP: SlkPktHeaderPtr; bodyP: Pointer): Err; syscall sysTrapSlkProcessRPC;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/serialmgr.pp b/packages/palmunits/src/serialmgr.pp
new file mode 100644
index 0000000000..4556f5acd1
--- /dev/null
+++ b/packages/palmunits/src/serialmgr.pp
@@ -0,0 +1,558 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Serial manager
+ *
+ * History:
+ * 1/14/98 SerialMgr.h created by Ben Manuto
+ *
+ *****************************************************************************)
+unit serialmgr;
+interface
+uses palmos, coretraps, errorbase, systemresources, systemmgr, netmgr;
+// New Serial manager feature numbers
+const
+ sysFtrNewSerialPresent = 1;
+ sysFtrNewSerialVersion = 2;
+ serMgrVersion = 2;
+(********************************************************************
+ * Serial Manager Errors
+ * the constant serErrorClass is defined in SystemMgr.h
+ ********************************************************************)
+ serErrBadParam = serErrorClass or 1;
+ serErrBadPort = serErrorClass or 2;
+ serErrNoMem = serErrorClass or 3;
+ serErrBadConnID = serErrorClass or 4;
+ serErrTimeOut = serErrorClass or 5;
+ serErrLineErr = serErrorClass or 6;
+ serErrAlreadyOpen = serErrorClass or 7;
+ serErrStillOpen = serErrorClass or 8;
+ serErrNotOpen = serErrorClass or 9;
+ serErrNotSupported = serErrorClass or 10; // functionality not supported
+ serErrNoDevicesAvail = serErrorClass or 11; // No serial devices were loaded or are available.
+ // New error codes for USB support
+ serErrConfigurationFailed = serErrorClass or 12;
+//
+// mask values for the lineErrors from SerGetStatus
+//
+ serLineErrorParity = $0001; // parity error
+ serLineErrorHWOverrun = $0002; // HW overrun
+ serLineErrorFraming = $0004; // framing error
+ serLineErrorBreak = $0008; // break signal asserted
+ serLineErrorHShake = $0010; // line hand-shake error
+ serLineErrorSWOverrun = $0020; // HW overrun
+ serLineErrorCarrierLost = $0040; // CD dropped
+(********************************************************************
+ * Serial Port Definitions
+ ********************************************************************)
+const
+ serPortLocalHotSync = $8000; // Use physical HotSync port
+ serPortCradlePort = $8000; // Cradle port. (Auto detect cradle type)
+ serPortIrPort = $8001; // Use available IR port.
+ serPortConsolePort = $8002; // Console port
+ serPortCradleRS232Port = $8003; // Cradle RS232 Port
+ serPortCradleUSBPort = $8004; // Cradle USB Port
+
+// This constant is used by the Serial Link Mgr only
+ serPortIDMask = $C000;
+(********************************************************************
+ * Serial Settings Descriptor
+ ********************************************************************)
+ srmSettingsFlagStopBitsM = $00000001; // mask for stop bits field
+ srmSettingsFlagStopBits1 = $00000000; // 1 stop bits
+ srmSettingsFlagStopBits2 = $00000001; // 2 stop bits
+ srmSettingsFlagParityOnM = $00000002; // mask for parity on
+ srmSettingsFlagParityEvenM = $00000004; // mask for parity even
+ srmSettingsFlagXonXoffM = $00000008; // (NOT IMPLEMENTED) mask for Xon/Xoff flow control
+ srmSettingsFlagRTSAutoM = $00000010; // mask to prevent UART input overflow using RTS (NOTE: this flag
+ // alone does not prevent software overruns from the serial input buffer)
+ srmSettingsFlagCTSAutoM = $00000020; // mask for CTS xmit flow control (see srmSettingsFlagFlowControlIn below)
+ srmSettingsFlagBitsPerCharM = $000000C0; // mask for bits/char
+ srmSettingsFlagBitsPerChar5 = $00000000; // 5 bits/char
+ srmSettingsFlagBitsPerChar6 = $00000040; // 6 bits/char
+ srmSettingsFlagBitsPerChar7 = $00000080; // 7 bits/char
+ srmSettingsFlagBitsPerChar8 = $000000C0; // 8 bits/char
+ srmSettingsFlagFlowControlIn = $00000100; // mask to prevent the serial input buffer overflow, using RTS. Use in
+ // conjunction with srmSettingsFlagRTSAutoM for a fully flow controlled input.
+ srmSettingsFlagRTSInactive = $00000200; // if set and srmSettingsFlagRTSAutoM==0, RTS is held in the inactive (flow off) state forever.
+// Default settings
+ srmDefaultSettings = srmSettingsFlagBitsPerChar8 or srmSettingsFlagStopBits1 or srmSettingsFlagRTSAutoM or srmSettingsFlagRTSInactive;
+ srmDefaultCTSTimeout = 5 * sysTicksPerSecond_;
+// Status bitfield constants
+ srmStatusCtsOn = $00000001;
+ srmStatusRtsOn = $00000002;
+ srmStatusDsrOn = $00000004;
+ srmStatusBreakSigOn = $00000008;
+//
+// Info fields describing serial HW capabilities.
+//
+ serDevCradlePort = $00000001; // Serial HW controls RS-232 serial from cradle connector of handheld.
+ serDevRS232Serial = $00000002; // Serial HW has RS-232 line drivers
+ serDevIRDACapable = $00000004; // Serial Device has IR line drivers and generates IRDA mode serial.
+ serDevModemPort = $00000008; // Serial deivce drives modem connection.
+ serDevCncMgrVisible = $00000010; // Serial device port name string to be displayed in Connection Mgr panel.
+ serDevConsolePort = $00000020; // Serial device is the default console port.
+ serDevUSBCapable = $00000040; // USB driver for USB hardware connected to the cradle connector of the handheld.
+type
+ DeviceInfoType = record
+ serDevCreator: UInt32; // Four Character creator type for serial driver ('sdrv')
+ serDevFtrInfo: UInt32; // Flags defining features of this serial hardware.
+ serDevMaxBaudRate: UInt32; // Maximum baud rate for this device.
+ serDevHandshakeBaud: UInt32; // HW Handshaking is reccomended for baud rates over this
+ serDevPortInfoStr: PChar; // Description of serial HW device or virtual device.
+ reserved: array [0..8-1] of UInt8; // Reserved.
+ end;
+ DeviceInfoPtr = ^DeviceInfoType;
+// Function IDs
+//
+// Standard set of function ids for the SrmOpen. Out of convenience, function ids
+// use the same namespace as creator ids. Custom functions can be defined by
+// using your app's creator id. The driver must have knowledge of that creator
+// id for it to be of any use. A driver should handle an unknown function id
+// gracefully, either use default functionality or return a serErrBadParam error.
+const
+ serFncUndefined = 0; // Undefined function
+ serFncPPPSession = netIFCreatorPPP; // NetLib PPP Interface
+ serFncSLIPSession = netIFCreatorSLIP; // NetLib SLIP Interface
+ serFncDebugger = sysFileCSystem; // PalmOS Debugger
+ serFncHotSync = sysFileCSync; // HotSync function
+ serFncConsole = sysFileCSystem; // PalmOS Console
+ serFncTelephony = sysFileCTelMgrLib; // Telephony Library
+//
+// Open Configuration Structure
+//
+type
+ SrmOpenConfigType = record
+ baud: UInt32; // Baud rate that the connection is to be opened at.
+ // Applications that use drivers that do not require
+ // baud rates can set this to zero or any other value.
+ // Drivers that do not require a baud rate should
+ // ignore this field
+ function_: UInt32; // Designates the function of the connection. A value
+ // of zero indictates default behavior for the protocol.
+ // Drivers that do not support multiple functions should
+ // ignore this field.
+ drvrDataP: MemPtr; // Pointer to driver specific data.
+ drvrDataSize: UInt16; // Size of the driver specific data block.
+ sysReserved1: UInt32; // System Reserved
+ sysReserved2: UInt32; // System Reserved
+ end;
+ SrmOpenConfigPtr = ^SrmOpenConfigType;
+(********************************************************************
+ * Transfer modes for USB
+ ********************************************************************)
+type
+ SrmTransferModeType = Enum;
+const
+ srmTransferFirstReserved = 0; // RESERVE 0
+ srmUSBInterruptMode = Succ(srmTransferFirstReserved);
+ srmUSBBulkMode = Succ(srmUSBInterruptMode);
+ srmUSBIsochronous = Succ(srmUSBBulkMode);
+(********************************************************************
+ * Type of a wakeup handler procedure which can be installed through the
+ * SerSetWakeupHandler() call.
+ ********************************************************************)
+type
+ WakeupHandlerProcPtr = procedure(refCon: UInt32);
+(********************************************************************
+ * 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.
+ ********************************************************************)
+ BlockingHookProcPtr = function(userRef: UInt32): Boolean;
+(********************************************************************
+ * Serial Library Control Enumerations (Pilot 2.0)
+ ********************************************************************)
+(********************************************************************
+ * Structure for specifying callback routines.
+ ********************************************************************)
+ SrmCallbackEntryType = record
+ funcP: BlockingHookProcPtr; // function pointer
+ userRef: UInt32; // ref value to pass to callback
+ end;
+ SrmCallbackEntryPtr = ^SrmCallbackEntryType;
+type
+ SrmCtlEnum = Enum;
+const
+ srmCtlFirstReserved = 0; // RESERVE 0
+ srmCtlSetBaudRate = Succ(srmCtlFirstReserved); // Sets the current baud rate for the HW.
+ // valueP = Pointer to Int32, valueLenP = Pointer to sizeof(Int32)
+ srmCtlGetBaudRate = Succ(srmCtlSetBaudRate); // Gets the current baud rate for the HW.
+ srmCtlSetFlags = Succ(srmCtlGetBaudRate); // Sets the current flag settings for the serial HW.
+ srmCtlGetFlags = Succ(srmCtlSetFlags); // Gets the current flag settings the serial HW.
+ srmCtlSetCtsTimeout = Succ(srmCtlGetFlags); // Sets the current Cts timeout value.
+ srmCtlGetCtsTimeout = Succ(srmCtlSetCtsTimeout); // Gets the current Cts timeout value.
+ srmCtlStartBreak = Succ(srmCtlGetCtsTimeout); // 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 = Succ(srmCtlStartBreak); // turn RS232 break signal off:
+ // valueP = 0, valueLenP = 0
+ srmCtlStartLocalLoopback = Succ(srmCtlStopBreak); // Start local loopback test
+ // valueP = 0, valueLenP = 0
+ srmCtlStopLocalLoopback = Succ(srmCtlStartLocalLoopback); // Stop local loopback test
+ // valueP = 0, valueLenP = 0
+ srmCtlIrDAEnable = Succ(srmCtlStopLocalLoopback); // Enable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+ srmCtlIrDADisable = Succ(srmCtlIrDAEnable); // Disable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+ srmCtlRxEnable = Succ(srmCtlIrDADisable); // enable receiver ( for IrDA )
+ srmCtlRxDisable = Succ(srmCtlRxEnable); // disable receiver ( for IrDA )
+ srmCtlEmuSetBlockingHook = Succ(srmCtlRxDisable); // Set a blocking hook routine FOR EMULATION
+ // MODE ONLY - NOT SUPPORTED ON THE PILOT
+ //PASS:
+ // valueP = Pointer to SerCallbackEntryType
+ // *valueLenP = sizeof(SerCallbackEntryType)
+ //RETURNS:
+ // the old settings in the first argument
+ srmCtlUserDef = Succ(srmCtlEmuSetBlockingHook); // 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 = Succ(srmCtlUserDef); // 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 = Pointer to UInt32 --> return optimal buf size
+ // ValueLenP = sizeof(UInt32)
+ srmCtlSetDTRAsserted = Succ(srmCtlGetOptimalTransmitSize); // Enable or disable DTR.
+ srmCtlGetDTRAsserted = Succ(srmCtlSetDTRAsserted); // Determine if DTR is enabled or disabled.
+ srmCtlSetYieldPortCallback = Succ(srmCtlGetDTRAsserted); // Set the yield port callback
+ srmCtlSetYieldPortRefCon = Succ(srmCtlSetYieldPortCallback); // Set the yield port refNum
+ // ***** ADD NEW ENTRIES BEFORE THIS ONE
+ srmCtlSystemReserved = $7000; // Reserve control op code space for system use.
+ srmCtlCustom = $8000; // Reserve control op code space for licensee use.
+ srmCtlLAST = Succ(srmCtlCustom);
+const
+ srmCtlSystemStart = $7000; // Start poitn for system op codes.
+ srmCtlCustomStart = $8000; // Start point for custom op codes.
+(********************************************************************
+ * Serial Hardware Library Routines
+ ********************************************************************)
+// *****************************************************************
+// * New Serial Manager trap selectors
+// *****************************************************************
+type
+ sysSerialSelector = Enum; // The order of this enum *MUST* match the sysSerialSelector in SerialMgr.c
+const
+ sysSerialInstall = 0;
+ sysSerialOpen = Succ(sysSerialInstall);
+ sysSerialOpenBkgnd = Succ(sysSerialOpen);
+ sysSerialClose = Succ(sysSerialOpenBkgnd);
+ sysSerialSleep = Succ(sysSerialClose);
+ sysSerialWake = Succ(sysSerialSleep);
+ sysSerialGetDeviceCount = Succ(sysSerialWake);
+ sysSerialGetDeviceInfo = Succ(sysSerialGetDeviceCount);
+ sysSerialGetStatus = Succ(sysSerialGetDeviceInfo);
+ sysSerialClearErr = Succ(sysSerialGetStatus);
+ sysSerialControl = Succ(sysSerialClearErr);
+ sysSerialSend = Succ(sysSerialControl);
+ sysSerialSendWait = Succ(sysSerialSend);
+ sysSerialSendCheck = Succ(sysSerialSendWait);
+ sysSerialSendFlush = Succ(sysSerialSendCheck);
+ sysSerialReceive = Succ(sysSerialSendFlush);
+ sysSerialReceiveWait = Succ(sysSerialReceive);
+ sysSerialReceiveCheck = Succ(sysSerialReceiveWait);
+ sysSerialReceiveFlush = Succ(sysSerialReceiveCheck);
+ sysSerialSetRcvBuffer = Succ(sysSerialReceiveFlush);
+ sysSerialRcvWindowOpen = Succ(sysSerialSetRcvBuffer);
+ sysSerialRcvWindowClose = Succ(sysSerialRcvWindowOpen);
+ sysSerialSetWakeupHandler = Succ(sysSerialRcvWindowClose);
+ sysSerialPrimeWakeupHandler = Succ(sysSerialSetWakeupHandler);
+ sysSerialOpenV4 = Succ(sysSerialPrimeWakeupHandler);
+ sysSerialOpenBkgndV4 = Succ(sysSerialOpenV4);
+ sysSerialCustomControl = Succ(sysSerialOpenBkgndV4);
+// Used by SerialMgrDispatch.c
+ maxSerialSelector = sysSerialCustomControl;
+function SerialMgrInstall: Err;
+function SrmOpen(port, baud: UInt32; var newPortIdP: UInt16): Err;
+function SrmExtOpen(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err;
+function SrmExtOpenBackground(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err;
+function SrmOpenBackground(port, baud: UInt32; var newPortIdP: UInt16): Err;
+function SrmClose(portId: UInt16): Err;
+function SrmSleep: Err;
+function SrmWake: Err;
+function SrmGetDeviceCount(var numOfDevicesP: UInt16): Err;
+function SrmGetDeviceInfo(deviceID: UInt32; var deviceInfoP: DeviceInfoType): Err;
+function SrmGetStatus(portId: UInt16; var statusFieldP: UInt32; var lineErrsP: UInt16): Err;
+function SrmClearErr(portId: UInt16): Err;
+function SrmControl(portId, op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err;
+function SrmCustomControl(portId, opCode: UInt16; creator: UInt32; valueP: Pointer; var valueLenP: UInt16): Err;
+function SrmSend(portId: UInt16; const bufP: Pointer; count: UInt32; var errP: Err): UInt32;
+function SrmSendWait(portId: UInt16): Err;
+function SrmSendCheck(portId: UInt16; var numBytesP: UInt32): Err;
+function SrmSendFlush(portId: UInt16): Err;
+function SrmReceive(portId: UInt16; rcvBufP: Pointer; count: UInt32; timeout: Int32; var errP: Err): UInt32;
+function SrmReceiveWait(portId: UInt16; bytes: UInt32; timeout: Int32): Err;
+function SrmReceiveCheck(portId: UInt16; var numBytesP: UInt32): Err;
+function SrmReceiveFlush(portId: UInt16; timeout: Int32): Err;
+function SrmSetReceiveBuffer(portId: UInt16; bufP: Pointer; bufSize: UInt16): Err;
+function SrmReceiveWindowOpen(portId: UInt16; var bufPP: UInt8Ptr; var sizeP: UInt32): Err;
+function SrmReceiveWindowClose(portId: UInt16; bytesPulled: UInt32): Err;
+function SrmSetWakeupHandler(portId: UInt16; procP: WakeupHandlerProcPtr; refCon: UInt32): Err;
+function SrmPrimeWakeupHandler(portId: UInt16; minBytes: UInt16): Err;
+//procedure SrmSelectorErrPrv(UInt16 serialSelector); // used only by SerialMgrDispatch.c
+implementation
+
+function __SerialMgrInstall: Err; syscall sysTrapSerialDispatch;
+function __SrmOpen(port, baud: UInt32; var newPortIdP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmExtOpen(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmExtOpenBackground(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmOpenBackground(port, baud: UInt32; var newPortIdP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmClose(portId: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmSleep: Err; syscall sysTrapSerialDispatch;
+function __SrmWake: Err; syscall sysTrapSerialDispatch;
+function __SrmGetDeviceCount(var numOfDevicesP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmGetDeviceInfo(deviceID: UInt32; var deviceInfoP: DeviceInfoType): Err; syscall sysTrapSerialDispatch;
+function __SrmGetStatus(portId: UInt16; var statusFieldP: UInt32; var lineErrsP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmClearErr(portId: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmControl(portId, op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmCustomControl(portId, opCode: UInt16; creator: UInt32; valueP: Pointer; var valueLenP: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmSend(portId: UInt16; const bufP: Pointer; count: UInt32; var errP: Err): UInt32; syscall sysTrapSerialDispatch;
+function __SrmSendWait(portId: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmSendCheck(portId: UInt16; var numBytesP: UInt32): Err; syscall sysTrapSerialDispatch;
+function __SrmSendFlush(portId: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmReceive(portId: UInt16; rcvBufP: Pointer; count: UInt32; timeout: Int32; var errP: Err): UInt32; syscall sysTrapSerialDispatch;
+function __SrmReceiveWait(portId: UInt16; bytes: UInt32; timeout: Int32): Err; syscall sysTrapSerialDispatch;
+function __SrmReceiveCheck(portId: UInt16; var numBytesP: UInt32): Err; syscall sysTrapSerialDispatch;
+function __SrmReceiveFlush(portId: UInt16; timeout: Int32): Err; syscall sysTrapSerialDispatch;
+function __SrmSetReceiveBuffer(portId: UInt16; bufP: Pointer; bufSize: UInt16): Err; syscall sysTrapSerialDispatch;
+function __SrmReceiveWindowOpen(portId: UInt16; var bufPP: UInt8Ptr; var sizeP: UInt32): Err; syscall sysTrapSerialDispatch;
+function __SrmReceiveWindowClose(portId: UInt16; bytesPulled: UInt32): Err; syscall sysTrapSerialDispatch;
+function __SrmSetWakeupHandler(portId: UInt16; procP: WakeupHandlerProcPtr; refCon: UInt32): Err; syscall sysTrapSerialDispatch;
+function __SrmPrimeWakeupHandler(portId: UInt16; minBytes: UInt16): Err; syscall sysTrapSerialDispatch;
+
+function SerialMgrInstall: Err;
+begin
+ asm
+ move.l #$sysSerialInstall,D2;
+ end;
+ SerialMgrInstall := __SerialMgrInstall;
+end;
+
+function SrmOpen(port, baud: UInt32; var newPortIdP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialOpen,D2;
+ end;
+ SrmOpen := __SrmOpen(port, baud, newPortIdP);
+end;
+
+function SrmExtOpen(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialOpenV4,D2;
+ end;
+ SrmExtOpen := __SrmExtOpen(port, configP, configSize, newPortIdP);
+end;
+
+function SrmExtOpenBackground(port: UInt32; var configP: SrmOpenConfigType; configSize: UInt16; var newPortIdP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialOpenBkgndV4,D2;
+ end;
+ SrmExtOpenBackground := __SrmExtOpenBackground(port, configP, configSize, newPortIdP);
+end;
+function SrmOpenBackground(port, baud: UInt32; var newPortIdP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialOpenBkgnd,D2;
+ end;
+ SrmOpenBackground := __SrmOpenBackground(port, baud, newPortIdP);
+end;
+
+function SrmClose(portId: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialClose,D2;
+ end;
+ SrmClose := __SrmClose(portId);
+end;
+
+function SrmSleep: Err;
+begin
+ asm
+ move.l #$sysSerialSleep,D2;
+ end;
+ SrmSleep := __SrmSleep;
+end;
+
+function SrmWake: Err;
+begin
+ asm
+ move.l #$sysSerialWake,D2;
+ end;
+ SrmWake := __SrmWake;
+end;
+
+function SrmGetDeviceCount(var numOfDevicesP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialGetDeviceCount,D2;
+ end;
+ SrmGetDeviceCount := __SrmGetDeviceCount(numOfDevicesP);
+end;
+
+function SrmGetDeviceInfo(deviceID: UInt32; var deviceInfoP: DeviceInfoType): Err;
+begin
+ asm
+ move.l #$sysSerialGetDeviceInfo,D2;
+ end;
+ SrmGetDeviceInfo := __SrmGetDeviceInfo(deviceID, deviceInfoP);
+end;
+
+function SrmGetStatus(portId: UInt16; var statusFieldP: UInt32; var lineErrsP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialGetStatus,D2;
+ end;
+ SrmGetStatus := __SrmGetStatus(portId, statusFieldP, lineErrsP);
+end;
+
+function SrmClearErr(portId: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialClearErr,D2;
+ end;
+ SrmClearErr := __SrmClearErr(portId);
+end;
+
+function SrmControl(portId, op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialControl,D2;
+ end;
+ SrmControl := __SrmControl(portId, op, valueP, valueLenP);
+end;
+
+function SrmCustomControl(portId, opCode: UInt16; creator: UInt32; valueP: Pointer; var valueLenP: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialCustomControl,D2;
+ end;
+ SrmCustomControl := __SrmCustomControl(portId, opCode, creator, valueP, valueLenP);
+end;
+
+function SrmSend(portId: UInt16; const bufP: Pointer; count: UInt32; var errP: Err): UInt32;
+begin
+ asm
+ move.l #$sysSerialSend,D2;
+ end;
+ SrmSend := __SrmSend(portId, bufP, count, errP);
+end;
+
+function SrmSendWait(portId: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialSendWait,D2;
+ end;
+ SrmSendwait := __SrmSendwait(portId);
+end;
+
+function SrmSendCheck(portId: UInt16; var numBytesP: UInt32): Err;
+begin
+ asm
+ move.l #$sysSerialSendCheck,D2;
+ end;
+ SrmSendCheck := __SrmSendCheck(portId, numBytesP);
+end;
+
+function SrmSendFlush(portId: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialSendFlush,D2;
+ end;
+ SrmSendFlush := __SrmSendFlush(portId);
+end;
+
+function SrmReceive(portId: UInt16; rcvBufP: Pointer; count: UInt32; timeout: Int32; var errP: Err): UInt32;
+begin
+ asm
+ move.l #$sysSerialReceive,D2;
+ end;
+ SrmReceive := __SrmReceive(portId, rcvBufP, count, timeout, errP);
+end;
+
+function SrmReceiveWait(portId: UInt16; bytes: UInt32; timeout: Int32): Err;
+begin
+ asm
+ move.l #$sysSerialReceiveWait,D2;
+ end;
+ SrmReceiveWait := __SrmReceiveWait(portId, bytes, timeout);
+end;
+
+function SrmReceiveCheck(portId: UInt16; var numBytesP: UInt32): Err;
+begin
+ asm
+ move.l #$sysSerialReceiveCheck,D2;
+ end;
+ SrmReceiveCheck := __SrmReceiveCheck(portId, numBytesP);
+end;
+
+function SrmReceiveFlush(portId: UInt16; timeout: Int32): Err;
+begin
+ asm
+ move.l #$sysSerialReceiveFlush,D2;
+ end;
+ SrmReceiveFlush := __SrmReceiveFlush(portId, timeout);
+end;
+
+function SrmSetReceiveBuffer(portId: UInt16; bufP: Pointer; bufSize: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialSetRcvBuffer,D2;
+ end;
+ SrmSetReceiveBuffer := __SrmSetReceiveBuffer(portId, bufP, bufSize);
+end;
+
+function SrmReceiveWindowOpen(portId: UInt16; var bufPP: UInt8Ptr; var sizeP: UInt32): Err;
+begin
+ asm
+ move.l #$sysSerialRcvWindowOpen,D2;
+ end;
+ SrmReceiveWindowOpen := __SrmReceiveWindowOpen(portId, bufPP, sizeP);
+end;
+
+function SrmReceiveWindowClose(portId: UInt16; bytesPulled: UInt32): Err;
+begin
+ asm
+ move.l #$sysSerialRcvWindowClose,D2;
+ end;
+ SrmReceiveWindowClose := __SrmReceiveWindowClose(portId, bytesPulled);
+end;
+
+function SrmSetWakeupHandler(portId: UInt16; procP: WakeupHandlerProcPtr; refCon: UInt32): Err;
+begin
+ asm
+ move.l #$sysSerialSetWakeupHandler,D2;
+ end;
+ SrmSetWakeupHandler := __SrmSetWakeupHandler(portId, procP, refcon);
+end;
+
+function SrmPrimeWakeupHandler(portId: UInt16; minBytes: UInt16): Err;
+begin
+ asm
+ move.l #$sysSerialPrimeWakeupHandler,D2;
+ end;
+ SrmPrimeWakeupHandler := __SrmPrimeWakeupHandler(portId, minBytes);
+end;
+
+end.
diff --git a/packages/palmunits/src/serialmgrold.pp b/packages/palmunits/src/serialmgrold.pp
new file mode 100644
index 0000000000..5933048476
--- /dev/null
+++ b/packages/palmunits/src/serialmgrold.pp
@@ -0,0 +1,306 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SerialMgrOld.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Serial manager
+ *
+ * History:
+ * 2/7/95 Created by Ron Marianetti
+ * 7/6/95 vmk added serDefaultSettings
+ * 1/28/98 scl added Serial Port Definitions
+ *
+ *****************************************************************************)
+
+unit serialmgrold;
+
+interface
+
+uses palmos, coretraps, libtraps, errorbase, systemmgr;
+
+(********************************************************************
+ * Serial Manager Errors
+ * the constant serErrorClass is defined in SystemMgr.h
+ ********************************************************************)
+
+const
+ serErrBadParam = serErrorClass or 1;
+ serErrBadPort = serErrorClass or 2;
+ serErrNoMem = serErrorClass or 3;
+ serErrBadConnID = serErrorClass or 4;
+ serErrTimeOut = serErrorClass or 5;
+ serErrLineErr = serErrorClass or 6;
+ serErrAlreadyOpen = serErrorClass or 7;
+ serErrStillOpen = serErrorClass or 8;
+ serErrNotOpen = serErrorClass or 9;
+ serErrNotSupported = serErrorClass or 10; // functionality not supported
+
+(********************************************************************
+ * Serial Port Definitions
+ ********************************************************************)
+
+const
+ serPortDefault = $0000; // Use prefDefSerialPlugIn
+ serPortLocalHotSync = $8000; // Use physical HotSync port
+ serPortMaskLocal = $7FFF; // Mask off HotSync "hint" (for SerialMgr)
+
+(********************************************************************
+ * Serial Settings Descriptor
+ ********************************************************************)
+
+type
+ SerSettingsType = record
+ baudRate: UInt32; // baud rate
+ flags: UInt32; // miscellaneous settings
+ ctsTimeout: Int32; // max # of ticks to wait for CTS to become asserted
+ // before transmitting; used only when
+ // configured with serSettingsFlagCTSAutoM.
+ end;
+ SerSettingsPtr = ^SerSettingsType;
+
+const
+ serSettingsFlagStopBitsM = $00000001; // mask for stop bits field
+ serSettingsFlagStopBits1 = $00000000; // 1 stop bits
+ serSettingsFlagStopBits2 = $00000001; // 2 stop bits
+ serSettingsFlagParityOnM = $00000002; // mask for parity on
+ serSettingsFlagParityEvenM = $00000004; // mask for parity even
+ serSettingsFlagXonXoffM = $00000008; // (NOT IMPLEMENTED) mask for Xon/Xoff flow control
+ serSettingsFlagRTSAutoM = $00000010; // mask for RTS rcv flow control
+ serSettingsFlagCTSAutoM = $00000020; // mask for CTS xmit flow control
+ serSettingsFlagBitsPerCharM = $000000C0; // mask for bits/char
+ serSettingsFlagBitsPerChar5 = $00000000; // 5 bits/char
+ serSettingsFlagBitsPerChar6 = $00000040; // 6 bits/char
+ serSettingsFlagBitsPerChar7 = $00000080; // 7 bits/char
+ serSettingsFlagBitsPerChar8 = $000000C0; // 8 bits/char
+
+// Default settings
+ serDefaultSettings = serSettingsFlagBitsPerChar8 or
+ serSettingsFlagStopBits1 or
+ serSettingsFlagRTSAutoM;
+
+//!!! serDefaultCTSTimeout = 5 * sysTicksPerSecond;
+
+//
+// mask values for the lineErrors from SerGetStatus
+//
+
+const
+ serLineErrorParity = $0001; // parity error
+ serLineErrorHWOverrun = $0002; // HW overrun
+ serLineErrorFraming = $0004; // framing error
+ serLineErrorBreak = $0008; // break signal asserted
+ serLineErrorHShake = $0010; // line hand-shake error
+ serLineErrorSWOverrun = $0020; // HW overrun
+ serLineErrorCarrierLost = $0040; // CD dropped
+
+(********************************************************************
+ * Type of a wakeup handler procedure which can be installed through the
+ * SerSetWakeupHandler() call.
+ ********************************************************************)
+
+type
+ SerWakeupHandler = procedure (refCon: UInt32);
+
+(********************************************************************
+ * 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.
+ ********************************************************************)
+
+type
+ SerBlockingHookHandler = function (userRef: UInt32): Boolean;
+
+(********************************************************************
+ * Serial Library Control Enumerations (Pilot 2.0)
+ ********************************************************************)
+
+(********************************************************************
+ * Structure for specifying callback routines.
+ ********************************************************************)
+
+type
+ SerCallbackEntryType = record
+ funcP: MemPtr; // function pointer
+ userRef: UInt32; // ref value to pass to callback
+ end;
+ SerCallbackEntryPtr = ^SerCallbackEntryType;
+
+// v2.0 extension
+type
+ SerCtlEnum = Enum;
+
+const
+ serCtlFirstReserved = 0; // RESERVE 0
+
+ serCtlStartBreak = Succ(serCtlFirstReserved); // turn RS232 break signal on:
+ // users are responsible for ensuring that the break is set
+ // long enough to genearate a valie BREAK!
+ // valueP = 0, valueLenP = 0
+
+ serCtlStopBreak = Succ(serCtlStartBreak); // turn RS232 break signal off:
+ // valueP = 0, valueLenP = 0
+
+ serCtlBreakStatus = Succ(serCtlStopBreak); // Get RS232 break signal status(on or off):
+ // valueP = pointer to UInt16 for returning status(0 = off, !0 = on)
+ // *valueLenP = sizeof(UInt16)
+
+ serCtlStartLocalLoopback = Succ(serCtlBreakStatus); // Start local loopback test
+ // valueP = 0, valueLenP = 0
+
+ serCtlStopLocalLoopback = Succ(serCtlStartLocalLoopback); // Stop local loopback test
+ // valueP = 0, valueLenP = 0
+
+ serCtlMaxBaud = Succ(serCtlStopLocalLoopback); // Get maximum supported baud rate:
+ // valueP = pointer to UInt32 for returned baud
+ // *valueLenP = sizeof(UInt32)
+
+ serCtlHandshakeThreshold = Succ(serCtlMaxBaud); // retrieve HW handshake threshold; this is the maximum baud rate
+ // which does not require hardware handshaking
+ // valueP = pointer to UInt32 for returned baud
+ // *valueLenP = sizeof(UInt32)
+
+ serCtlEmuSetBlockingHook = Succ(serCtlHandshakeThreshold); // Set a blocking hook routine FOR EMULATION
+ // MODE ONLY - NOT SUPPORTED ON THE PILOT
+ //PASS:
+ // valueP = pointer to SerCallbackEntryType
+ // *valueLenP = sizeof(SerCallbackEntryType)
+ //RETURNS:
+ // the old settings in the first argument
+
+
+ serCtlIrDAEnable = Succ(serCtlEmuSetBlockingHook); // Enable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ serCtlIrDADisable = Succ(serCtlIrDAEnable); // Disable IrDA connection on this serial port
+ // valueP = 0, valueLenP = 0
+
+ serCtlIrScanningOn = Succ(serCtlIrDADisable); // Start Ir Scanning mode
+
+ serCtlIrScanningOff = Succ(serCtlIrScanningOn); // Stop Ir Scanning mode
+
+ serCtlRxEnable = Succ(serCtlIrScanningOff); // enable receiver ( for IrDA )
+
+ serCtlRxDisable = Succ(serCtlRxEnable); // disable receiver ( for IrDA )
+
+ serCtlLAST = Succ(serCtlRxDisable); // ADD NEW ENTRIES BEFORE THIS ONE
+
+
+// Start of a custom op code range for licensees that wrote old serial
+// manager replacements. Note that the serial compatiblity library
+// does not pass these op codes to new serial manager plugins.
+const
+ serCtlFirstCustomEntry = $A800;
+
+(********************************************************************
+ * Serial Library Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+// Used by mac applications to map the pilot serial port to a particular
+// macintosh port.
+//!!!function SerSetMapPort(pilotPort, macPort: UInt16): UInt16;
+
+// Acquires and opens a serial port with given baud and default settings.
+function SerOpen(refNum: UInt16; port: UInt16; baud: UInt32): Err; syscall sysLibTrapOpen;
+
+// Used by debugger to re-initialize serial port if necessary
+//!!!function SerDbgAssureOpen(refNum: UInt16; port: UInt16; baud: UInt32): Err;
+
+// Closes the serial connection previously opened with SerOpen.
+function SerClose(refNum: UInt16): Err; syscall sysLibTrapClose;
+
+// Puts serial library to sleep
+function SerSleep(refNum: UInt16): Err; syscall sysLibTrapSleep;
+
+// Wake Serial library
+function SerWake(refNum: UInt16): Err; syscall sysLibTrapWake;
+
+// Get attributes of the serial connection
+function SerGetSettings(refNum: UInt16; settingsP: SerSettingsPtr): Err; syscall sysLibTrapCustom;
+
+// Set attributes of the serial connection
+function SerSetSettings(refNum: UInt16; settingsP: SerSettingsPtr): Err; syscall sysLibTrapCustom + 1;
+
+// Return status of serial connection
+function SerGetStatus(refNum: UInt16; var ctsOnP, dsrOnP: Boolean): UInt16; syscall sysLibTrapCustom + 2;
+
+// Reset error condition of serial connection
+function SerClearErr(refNum: UInt16): Err; syscall sysLibTrapCustom + 3;
+
+// Sends a buffer of data (may queue it up and return).
+function SerSend10(refNum: UInt16; const bufP: Pointer; size: UInt32): Err; syscall sysLibTrapCustom + 4;
+
+// Waits until the serial transmit buffer empties.
+// The timeout arg is ignored; CTS timeout is used
+function SerSendWait(refNum: UInt16; timeout: Int32): Err; syscall sysLibTrapCustom + 5;
+
+// Returns how many characters are left in the send queue waiting
+// for transmission
+function SerSendCheck(refNum: UInt16; var numBytesP: UInt32): Err; syscall sysLibTrapCustom + 6;
+
+// Flushes the data out of the transmit buffer
+function SerSendFlush(refNum: UInt16): Err; syscall sysLibTrapCustom + 7;
+
+// Receives a buffer of data of the given size.
+function SerReceive10(refNum: UInt16; bufP: Pointer; bytes, timeout: UInt32): Err; syscall sysLibTrapCustom + 8;
+
+// Waits for at least 'bytes' bytes of data to arrive at the serial input.
+// but does not read them in
+function SerReceiveWait(refNum: UInt16; bytes, timeout: UInt32): Err; syscall sysLibTrapCustom + 9;
+
+// Returns how many characters are in the receive queue
+function SerReceiveCheck(refNum: UInt16; var numBytesP: UInt32): Err; syscall sysLibTrapCustom + 10;
+
+// Flushes any data coming into the serial port, discarding the data.
+procedure SerReceiveFlush(refNum: UInt16; timeout: Int32); syscall sysLibTrapCustom + 11;
+
+// Specify a new input buffer. To restore the original buffer, pass
+// bufSize = 0.
+function SerSetReceiveBuffer(refNum: UInt16; bufP: Pointer; bufSize: UInt16): Err; syscall sysLibTrapCustom + 12;
+
+// The receive character interrupt service routine, called by kernel when
+// a UART interrupt is detected.
+function SerReceiveISP: Boolean; syscall sysTrapSerReceiveISP;
+
+// "Back Door" into the serial receive queue. Used by applications (like TCP Media layers)
+// that need faster access to received characters
+function SerReceiveWindowOpen(refNum: UInt16; var bufPP: UInt8Ptr; var sizeP: UInt32): Err; syscall sysLibTrapCustom + 13;
+
+function SerReceiveWindowClose(refNum: UInt16; bytesPulled: UInt32): Err; syscall sysLibTrapCustom + 14;
+
+// Can be called by applications that need an alternate wakeup mechanism
+// when characters get enqueued by the interrupt routine.
+function SerSetWakeupHandler(refNum: UInt16; procP: SerWakeupHandler; refCon: UInt32): Err; syscall sysLibTrapCustom + 15;
+
+// Called to prime wakeup handler
+function SerPrimeWakeupHandler(refNum: UInt16; minBytes: UInt16): Err; syscall sysLibTrapCustom + 16;
+
+// Called to perform a serial manager control operation
+// (v2.0 extension)
+function SerControl(refNum: UInt16; op: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall sysLibTrapCustom + 17;
+
+// Sends a buffer of data (may queue it up and return).
+function SerSend(refNum: UInt16; const bufP: Pointer; count: UInt32; var errP: Err): UInt32; syscall sysLibTrapCustom + 18;
+
+// Receives a buffer of data of the given size.
+function SerReceive(refNum: UInt16; bufP: Pointer; count: UInt32; timeout: Int32; var errP: Err): UInt32; syscall sysLibTrapCustom + 19;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/slotdrvrlib.pp b/packages/palmunits/src/slotdrvrlib.pp
new file mode 100644
index 0000000000..310dbc3d52
--- /dev/null
+++ b/packages/palmunits/src/slotdrvrlib.pp
@@ -0,0 +1,185 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SlotDrvrLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Sample Slot Driver library implementation.
+ *
+ * History:
+ * 02/25/00 Created by Steve Minns
+ * 09/15/00 lrt Updated CardMetricsType stucture to include more
+ * useful fields, inc'd API Version
+ *
+ *****************************************************************************)
+
+unit slotdrvrlib;
+
+interface
+
+uses palmos, libtraps, expansionmgr;
+
+const
+ slotDrvrAPIVersion = $00000002;
+
+// The number of bytes per sector is fixed
+ slotSectorSize = 512;
+
+(********************************************************************
+ * Card Metrics
+ * These structures contains all of the information about the physical
+ * structure of the card that may be needed by a filesystem in order
+ * to format volumes on the card.
+ ********************************************************************)
+
+ slotDrvrPartitionTypeFAT12 = $01;
+ slotDrvrPartitionTypeFAT16Under32MB = $04;
+ slotDrvrPartitionTypeFAT16Over32MB = $06;
+ slotDrvrBootablePartition = $80;
+ slotDrvrNonBootablePartition = $00;
+
+type
+ CardMetricsType = record
+ totalSectors: UInt32; // The total number of sectors accessable via SlotCardSector[Read/Write]
+ // (some media may contain extra sectors in case one goes bad,
+ // or for storing configuration information, but they are handled
+ // internally to the slot driver, and not accessable)
+ bytesPerSector: UInt16; // The number of bytes in one sector.
+ // currently for Palm, this must be the standard 512
+ sectorsPerHead: UInt16; // The number of Sectors per Head
+ // as given by guidelines in the specification for this media type
+ // even though all of our disks accesses are LBA,
+ // this is for compatibility when filling out MBRs and PBRs
+ // if the media guidelines don't care, this value is set to 0
+ headsPerCylinder: UInt16; // The number of Heads per Cylinder
+ // as given by guidelines in the specification for this media type
+ // even though all of our disks accesses are LBA,
+ // this is for compatibility when filling out MBRs and PBRs
+ // if the media guidelines don't care, this value is set to 0
+ reserved1: UInt16; // Reserved
+ sectorsPerBlock: UInt8; // A suggested number of Sectors per Block (Cluster)
+ // as given by guidelines in the specification for this media type
+ // if the media guidelines don't care, this value will be set to 0
+
+ partitionType: UInt8; // The suggested partition type (System ID) of the first partition
+ // as given by guidelines in the specification for this media type
+ // if the media guidelines don't care, this value will be set to 0
+ bootIndicator: UInt8; // The suggested bootability of the first partition
+ // as given by guidelines in the specification for this media type
+ // (generally, 0x80=bootable, default boot partition 0x00=not-bootable)
+ // if the media guidelines don't care, this value will be set to 0xFF
+ reserved2: UInt8; // Reserved
+ partitionStart: UInt32; // The suggested starting sector of the first partition
+ // as given by guidelines in the specification for this media type
+ // if this value is set to zero, and the partitionSize value is non-zero
+ // the media guidelines suggest to not use an MBR, and only use a PBR at sector 0
+ // if the media guidelines don't care, the partitionSize value will be set to 0
+
+ partitionSize: UInt32; // The suggested size of the first partition
+ // as given by guidelines in the specification for this media type
+ // if the media guidelines don't care, this value will be set to 0, and
+ // the partitionStart parameter is also ignored
+ end;
+ CardMetricsTag = CardMetricsType;
+ CardMetricsPtr = ^CardMetricsType;
+
+(********************************************************************
+ * SlotDrvr library function trap ID's. Each library call gets a trap number:
+ * SlotDrvrLibTrapXXXX 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!!! The order of these traps MUST match the order of the dispatch
+ * table in SlotDrvrLibDispatch.c!!!
+ ********************************************************************)
+
+const
+ SlotTrapLibAPIVersion = sysLibTrapCustom;
+ SlotTrapCustomControl = sysLibTrapCustom + 1;
+ SlotTrapCardPresent = sysLibTrapCustom + 2;
+ SlotTrapCardInfo = sysLibTrapCustom + 3;
+ SlotTrapCardMediaType = sysLibTrapCustom + 4;
+ SlotTrapCardIsFilesystemSupported = sysLibTrapCustom + 5;
+ SlotTrapCardMetrics = sysLibTrapCustom + 6;
+ SlotTrapCardLowLevelFormat = sysLibTrapCustom + 7;
+ SlotTrapCardSectorRead = sysLibTrapCustom + 8;
+ SlotTrapCardSectorWrite = sysLibTrapCustom + 9;
+ SlotTrapPowerCheck = sysLibTrapCustom + 10;
+ SlotTrapMediaType = sysLibTrapCustom + 11;
+ SlotTrapCardReserve = sysLibTrapCustom + 12;
+ SlotTrapCardRelease = sysLibTrapCustom + 13;
+ SlotTrapCardGetSerialPort = sysLibTrapCustom + 14;
+
+(********************************************************************
+ * API Prototypes
+ ********************************************************************)
+
+(********************************************************************
+ * Standard library open, close, sleep and wake functions
+ ********************************************************************)
+
+function SlotOpen(slotLibRefNum: UInt16): Err; syscall sysLibTrapOpen;
+
+function SlotClose(slotLibRefNum: UInt16): Err; syscall sysLibTrapClose;
+
+function SlotSleep(slotLibRefNum: UInt16): Err; syscall sysLibTrapSleep;
+
+function SlotWake(slotLibRefNum: UInt16): Err; syscall sysLibTrapWake;
+
+(********************************************************************
+ * Custom library API functions
+ ********************************************************************)
+
+function SlotLibAPIVersion(slotLibRefNum: UInt16):UInt32; syscall SlotTrapLibAPIVersion;
+
+function SlotCustomControl(slotLibRefNum: UInt16; apiCreator: UInt32; apiSelector: UInt16; valueP: Pointer; var valueLenP: UInt16): Err; syscall SlotTrapCustomControl;
+
+function SlotCardPresent(slotLibRefNum: UInt16; slotRefNum: UInt16): Err; syscall SlotTrapCardPresent;
+
+function SlotCardInfo(slotLibRefNum, slotRefNum: UInt16; var infoP: ExpCardInfoType): Err; syscall SlotTrapCardInfo;
+
+function SlotCardMediaType(slotLibRefNum, slotRefNum: UInt16; var mediaTypeP: UInt32): Err; syscall SlotTrapCardMediaType;
+
+function SlotCardReserve(slotLibRefNum, slotRefNum: UInt16): Err; syscall SlotTrapCardReserve;
+
+function SlotCardRelease(slotLibRefNum, slotRefNum: UInt16): Err; syscall SlotTrapCardRelease;
+
+function SlotCardGetSerialPort(slotLibRefNum, slotRefNum: UInt16; var portP: UInt32): Err; syscall SlotTrapCardGetSerialPort;
+
+(********************************************************************
+ * SlotDriver Formatting APIs:
+ ********************************************************************)
+
+function SlotCardIsFilesystemSupported(slotLibRefNum, slotRefNum: UInt16; filesystemType: UInt32): Boolean; syscall SlotTrapCardIsFilesystemSupported;
+
+function SlotCardMetrics(slotLibRefNum, slotRefNum: UInt16; cardMetricsP: CardMetricsPtr): Err; syscall SlotTrapCardMetrics;
+
+function SlotCardLowLevelFormat(slotLibRefNum, slotRefNum: UInt16): Err; syscall SlotTrapCardLowLevelFormat;
+
+(********************************************************************
+ * SlotDriver Logical Block Read/Write APIs:
+ ********************************************************************)
+
+function SlotCardSectorRead(slotLibRefNum, slotRefNum: UInt16; sectorNumber: UInt32; var bufferP: UInt8; var numSectorsP: UInt32): Err; syscall SlotTrapCardSectorRead;
+
+function SlotCardSectorWrite(slotLibRefNum, slotRefNum: UInt16; sectorNumber: UInt32; var bufferP: UInt8; var numSectorsP: UInt32): Err; syscall SlotTrapCardSectorWrite;
+
+(********************************************************************
+ * Power Mgmt APIs:
+ ********************************************************************)
+
+const
+ slotLibPowerFlag_WakeUp = $0001; // Add the power required to bring the slot hardware out of low-power mode
+ slotLibPowerFlag_FormatMedia = $0002; // Add the power required to perform a low-level format of the card media
+
+function SlotPowerCheck(slotLibRefNum, slotRefNum, operationFlags, readBlocks, writeBlocks: UInt16): Err; syscall SlotTrapPowerCheck;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/smslib.pp b/packages/palmunits/src/smslib.pp
new file mode 100644
index 0000000000..b7444ebed2
--- /dev/null
+++ b/packages/palmunits/src/smslib.pp
@@ -0,0 +1,316 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SmsLib.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for PalmOS SMS Library
+ *
+ * History:
+ * 1/26/00 Created by Hatem Oueslati
+ * 3/01/00 Ludovic Ferrandis - Add API
+ * 8/28/00 Ludovic Ferrandis - Update structure
+ *
+ *****************************************************************************)
+
+unit smslib;
+
+interface
+
+uses palmos, errorbase, exgmgr, telephonymgrui, telephonymgrtypes, telephonymgr;
+
+// The Sms library is used as an Exchange library. ExgLib.h defines all the
+// primary entrypoints into the library. The rest of this include file defines the
+// specials opCodes used in the ExgControl function and the structure used in the
+// socketRef field of the Exchange Manager Socket structure.
+
+(****************************************************************************
+ *
+ * ExgLibControl opcodes
+ *
+ ****************************************************************************)
+
+// Those Op codes take SmsPrefType as parameter
+const
+ exgLibSmsPrefGetOp = exgLibCtlSpecificOp or 1;
+ exgLibSmsPrefGetDefaultOp = exgLibCtlSpecificOp or 2;
+ exgLibSmsPrefSetOp = exgLibCtlSpecificOp or 3;
+
+// This Op code takes a network type constant as parameter kSmsNetworkXxx
+ exgLibSmsPrefDisplayOp = exgLibCtlSpecificOp or 4;
+
+// This Op code takes an UInt16 as parameter
+ exgLibSmsIncompleteGetCountOp = exgLibCtlSpecificOp or 5;
+
+// This OpCode takes a SmsID (UInt16) as parameter
+ exgLibSmsIncompleteDeleteOp = exgLibCtlSpecificOp or 6;
+
+(****************************************************************************
+ *
+ * Types and Constants
+ *
+ ****************************************************************************)
+
+const
+ kSmsLibName = 'SMS Library'; // name of Sms library
+
+// Feature Creators and numbers, for use with the FtrGet() call. This
+// feature can be obtained to get the current version of the Sms Library
+const
+ kSmsFtrNumVersion = UInt16(0);
+
+// $MMmfsbbb, 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: $01122003
+// V2.00a2 would be: $02001002
+// V1.01 would be: $01013000
+
+const
+ kSmsMessageRegExtensionType = 'sms';
+ kSmsReportRegExtensionType = 'rps';
+ kSmsExtensionTypeLength = 3;
+
+ kSmsScheme = '_sms';
+
+ kSmsMaxPhoneSize = kTelMaxPhoneNumberLen + 1; // Max length for Phone number
+
+ kSmsNBSConverter = UInt8(0); // NBS header will be add to the data
+ kSmsNoConverter = UInt8(1); // No header will be add to the data.
+
+ kSmsRowDataEncoding = UInt8(0); // 8 bit encoding scheme
+ kSmsTextEncoding = UInt8(1); // 7 bit compressed encoding scheme.
+
+ kSmsNetworkAuto = UInt8(-1);
+ kSmsNetworkCDMA = UInt8(kTelNwkCDMA);
+ kSmsNetworkGSM = UInt8(kTelNwkGSM);
+ kSmsNetworkTDMA = UInt8(kTelNwkTDMA);
+ kSmsNetworkPDC = UInt8(kTelNwkPDC);
+
+ kSmsMessageType = UInt8(0);
+ kSmsIncompleteType = UInt8(1);
+ kSmsReportType = UInt8(2);
+
+(****************************************************************************
+ *
+ * Sms Error
+ *
+ ****************************************************************************)
+
+const kSmsErrMaxSizeExceeded = smsErrorClass or $01; // Message exceeds maximum size supported by network
+
+(****************************************************************************
+ *
+ * Data Structures
+ *
+ ****************************************************************************)
+
+(****************************************************************************
+ * Report parameters
+ ****************************************************************************)
+
+(* Report Parameters Type
+ ---------------------- *)
+type
+ SmsReportParamsType = record
+ timeStamp: UInt32; // TimeStamp of the report (when delivered, or last attempt, ...)
+ index: UInt16; // SMS index on the phone storage
+ reportType: UInt8; // Delivery report type
+ report: UInt8; // Status report indicator
+ originatingAddress: PChar; // Phone number to which belong the report (was sent)
+ end;
+ SmsReportParamsTag = SmsReportParamsType;
+ SmsReportParamsPtr = ^SmsReportParamsType;
+
+(****************************************************************************
+ * Send parameters
+ ****************************************************************************)
+
+(* Advanced Parameters Type for TDMA & CDMA network
+ ------------------------------------------------ *)
+type
+ SmsSendCDMAParamsType = record
+ messageType: UInt8; // Message Type
+
+ deferredDate: TelSmsDateTimeType;
+
+ priority: UInt8;
+ privacy: UInt8;
+
+ bits: UInt8;
+{
+ alertOnDelivery: UInt8 ; //:1
+ manualAckRequest: UInt8; //:1
+ reserved: UInt8; //:6
+}
+ callbackNumber: PChar; // Address to reply
+ end;
+ SmsSendCDMAParamsTag = SmsSendCDMAParamsType;
+ SmsSendCDMAParamsPtr = ^SmsSendCDMAParamsType;
+
+ SmsSendTDMAParamsType = SmsSendCDMAParamsType;
+ SmsSendTDMAParamsPtr = ^SmsSendCDMAParamsType;
+
+(* Advanced Parameters Type for GSM network
+ ---------------------------------------- *)
+
+type
+ SmsSendGSMParamsType = record
+ protocolId: UInt16; // Reserved - not supported (Fax, paging, . . .)
+ serviceCenterNumber: PChar; // SMS Center number - Optionel
+
+ rejectDuplicated: Boolean; // Network must reject msg if the same exists
+ replyPath: Boolean; // Use reply specified path
+ end;
+ SmsSendGSMParamsTag = SmsSendGSMParamsType;
+ SmsSendGSMParamsPtr = ^SmsSendGSMParamsType;
+
+
+(* SMS Send Parameters Type
+ ------------------------ *)
+
+type
+ SmsSendParamsType = record
+ validityPeriod: TelSmsDateTimeType; // SMS validity Period
+ destinationAddress: PChar; // recipient number -> to send the sms to
+
+ bits: UInt8;
+{
+ networkDeliveryRequested: UInt8; // (:1) Sms report wanted
+ ignoreDefaultValue: UInt8; // (:1) If false, the field validityPeriod, ackRequested, reportRequested, smsCenter are ignored.
+ reserved: UInt8; // (:6)
+}
+ partCount: UInt16; // number of parts of the SMS (output)
+ lastPart: UInt16; // if error, the last part sent (output)
+
+ converter: UInt8; // How the data are going to be typed (0 = NBS, 1 = None)
+
+ case Integer of // union 'protocol'
+ 1: (gsm: SmsSendGSMParamsType);
+ 2: (cdma: SmsSendCDMAParamsType);
+ 3: (tdma: SmsSendTDMAParamsType);
+ end;
+ SmsSendParamsTag = SmsSendParamsType;
+ SmsSendParamsPtr = ^SmsSendParamsType;
+
+
+(****************************************************************************
+ * Receive parameters
+ ****************************************************************************)
+
+(* Advanced Parameters Type for TDMA & CDMA network
+ ----------------------------------------------- *)
+type
+ SmsReceiveCDMAParamsType = record
+ messageType: UInt8; // Delivery Message Type
+
+ validityPeriod: TelSmsDateTimeType;
+
+ priority: UInt8;
+ privacy: UInt8;
+
+ alertOnDeliveryRequest: Boolean;
+ manualAckRequest: Boolean;
+
+ voiceMessageNumber: UInt8;
+ languageIndicator: UInt8;
+
+ callbackNumberAddress: PChar; // Store callback address
+ end;
+ SmsReceiveCDMAParamsTag = SmsReceiveCDMAParamsType;
+ SmsReceiveCDMAParamsPtr = ^SmsReceiveCDMAParamsType;
+
+ SmsReceiveTDMAParamsType = SmsReceiveCDMAParamsType;
+ SmsReceiveTDMAParamsPtr = ^SmsReceiveCDMAParamsType;
+
+(* Advanced Parameters Type for GSM network
+ ---------------------------------------- *)
+type
+ SmsReceiveGSMParamsType = record
+ protocolId: UInt16; // reserved - not supported
+ serviceCenterNumber: PChar;
+
+ replyPath: Boolean; // Must use specified reply path
+ end;
+ SmsReceiveGSMParamsTag = SmsReceiveGSMParamsType;
+ SmsReceiveGSMParamsPtr = ^SmsReceiveGSMParamsType;
+
+(* SMS Receive Parameters Type
+ --------------------------- *)
+
+type
+ SmsReceiveParamsType = record
+ timeStamp: UInt32; // Palm
+ originatingAddress: PChar; // originating number -> to send the sms to
+
+ bits: UInt8;
+{
+ leaveOnPhone: UInt8 // (:1) Received messages won't be deleted on the phone (Input)
+ forceSlotMode: UInt8 // (:1) Force parsing methode to Slot Mode (default is Block mode) (Input)
+ reserved: UInt8 // (:6)
+}
+ index: UInt16; // Index of the storage in the mobile where the message is stored
+
+ otherToReceive: Boolean;
+ reportDeliveryIndicator: Boolean;
+
+ case Integer of // union 'protocol'
+ 1: (gsm: SmsReceiveGSMParamsType);
+ 2: (cdma: SmsReceiveCDMAParamsType);
+ 3: (tdma: SmsReceiveTDMAParamsType);
+ end;
+ SmsReceiveParamsTag = SmsReceiveParamsType;
+ SmsReceiveParamsPtr = ^SmsReceiveParamsType;
+
+(****************************************************************************
+ * Sms parameters
+ ****************************************************************************)
+(* SMS Parameters Type
+ ------------------- *)
+
+type
+ SmsParamsType = record
+ creator: UInt32; // MUST ALWAYS BE SET TO sysFileCSmsLib
+ smsID: UInt16; // ID of the SMS (output)
+
+ extension: PChar; // Extension type of the data - Optionel (Output)
+ mimeTypes: PChar; // Mime type of object - Optionel (Output)
+ appCreator: UInt32; // Application Creator of the target - Optionel (Output)
+
+ dataCodingScheme: UInt8; // How SMS are going to convert the data (0 = 8 bit, 1 = 7 bit)
+ networkType: UInt8; // Indicates the type of advanced parameters (input - output)
+ dataType: UInt8; // Indicates the kind of message: Sms, incomplete Sms, Report (Output)
+
+ nbsDestPort: UInt16; // NBS port to use to encode the data (input) - port used in received Sms (output)
+ nbsSrcPort: UInt16; // NBS port to use to encode the data (input) - port used in received Sms (output)
+
+ case Integer of // union 'data'
+ 1: (send: SmsSendParamsType);
+ 2: (receive: SmsReceiveParamsType);
+ 3: (report: SmsReportParamsType);
+ end;
+ SmsParamsTag = SmsParamsType;
+ SmsParamsPtr = ^SmsParamsType;
+
+(* Preferences Type
+ ------------------- *)
+
+type
+ SmsPrefType = record
+ validity: UInt32; // Validity period of SMS (relatif) in seconds
+ warnOver: UInt16; // Display an alert if sending more Sms than this value.
+ leave: Boolean; // Leave SMS on Phone
+ report: Boolean; // Ask for a network delivery report
+ autoSMSC: Boolean; // If set, don't use the value stored in smscNumber field
+ smscNumber: array [1..kSmsMaxPhoneSize] of Char; // SMS Service Center. Could be null
+ end;
+ SmsPrefTag = SmsPrefType;
+ SmsPrefPtr = ^SmsPrefType;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/soundmgr.pp b/packages/palmunits/src/soundmgr.pp
new file mode 100644
index 0000000000..c4b9ecf3fc
--- /dev/null
+++ b/packages/palmunits/src/soundmgr.pp
@@ -0,0 +1,306 @@
+{$MACRO ON}
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SoundMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Include file for Sound Manager
+ *
+ * History:
+ * 4/11/95 VMK - Created by Vitaly Kruglikov
+ *
+ *****************************************************************************)
+
+unit soundmgr;
+
+interface
+
+uses palmos, coretraps, errorbase, preferences;
+
+(************************************************************
+ * Sound Manager constants
+ *
+ *************************************************************)
+
+const
+// Sound Manager max and default volume levels
+ sndMaxAmp = 64;
+//sndVolumeMask = $ff;
+ sndDefaultAmp = sndMaxAmp;
+
+ sndMidiNameLength = 32; // MIDI track name length *including* NULL terminator
+
+(************************************************************
+ * Sound Manager data structures
+ *
+ *************************************************************)
+
+//
+// Command numbers for SndCommandType's cmd field
+//
+type
+ SndCmdIDType = Enum;
+
+const
+ 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 = Succ(sndCmdFreqDurationAmp); // 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 = Succ(sndCmdNoteOn); // 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 = Succ(sndCmdFrqOn); // stop current sound
+ // param1 = 0
+ // param2 = 0
+ // param3 = 0
+
+//
+// SndCommandType: used by SndDoCmd()
+//
+
+type
+ SndCommandType = record
+ cmd: SndCmdIDType; // command id
+ reserved: UInt8;
+ param1: Int32; // first parameter
+ param2: UInt16; // second parameter
+ param3: UInt16; // third parameter
+ end;
+
+ SndCommandPtr = ^SndCommandType;
+
+//
+// Beep numbers used by SndSysBeep()
+//
+
+type
+ SndSysBeepType = Enum;
+
+const
+ sndInfo = 1;
+ sndWarning = Succ(sndInfo);
+ sndError = Succ(sndWarning);
+ sndStartUp = Succ(sndError);
+ sndAlarm = Succ(sndStartUp);
+ sndConfirmation = Succ(sndAlarm);
+ sndClick = Succ(sndConfirmation);
+
+(************************************************************
+ * 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).
+
+const
+ sndMidiRecSignature = Rsc('PMrc');
+
+type
+ SndMidiRecHdrType = record
+ signature: UInt32; // set to sndMidiRecSignature
+ bDataOffset: UInt8; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ reserved: UInt8; // set to zero
+ end;
+
+ SndMidiRecType = record
+ hdr: SndMidiRecHdrType; // offset from the beginning of the record
+ // to the Standard Midi File data stream
+ name: array [0..2-1] of Char; // 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.
+ end;
+
+// Midi records found by SndCreateMidiList.
+ SndMidiListItemType = record
+ name: array [0..sndMidiNameLength-1] of Char; // including NULL terminator
+ uniqueRecID: UInt32;
+ dbID: LocalID;
+ cardNo: UInt16;
+ end;
+
+// Commands for SndPlaySmf
+ SndSmfCmdEnum = Enum;
+
+const
+ sndSmfCmdPlay = 1; // play the selection
+ sndSmfCmdDuration = Succ(sndSmfCmdPlay); // get the duration in milliseconds of the entire track
+
+type
+ SndComplFuncType = procedure(chanP: Pointer; dwUserData: UInt32);
+ SndComplFuncPtr = SndComplFuncType;
+
+// Return true to continue, false to abort
+ SndBlockingFuncType = function(chanP: Pointer; dwUserData: UInt32; sysTicksAvailable: Int32): Boolean;
+ SndBlockingFuncPtr = SndBlockingFuncType;
+
+type
+ SndCallbackInfoType = record
+ funcP: MemPtr; // pointer to the callback function (NULL = no function)
+ dwUserData: UInt32; // value to be passed in the dwUserData parameter of the callback function
+ end;
+
+ SndSmfCallbacksType = record
+ completion: SndCallbackInfoType; // completion callback function (see SndComplFuncType)
+ blocking: SndCallbackInfoType; // blocking hook callback function (see SndBlockingFuncType)
+ reserved: SndCallbackInfoType; // RESERVED -- SET ALL FIELDS TO ZERO BEFORE PASSING
+ end;
+ SndSmfCallbacksPtr = ^SndSmfCallbacksType;
+
+const
+ sndSmfPlayAllMilliSec = $FFFFFFFF;
+
+type
+ SndSmfOptionsType = record
+ // dwStartMilliSec and dwEndMilliSec are used as inputs to the function for sndSmfCmdPlay and as
+ // outputs for sndSmfCmdDuration
+ dwStartMilliSec: UInt32; // 0 = "start from the beginning"
+ dwEndMilliSec: UInt32; // 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
+ amplitude: UInt16; // 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
+
+ interruptible: Boolean; // 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
+
+ reserved1: UInt8;
+ reserved: UInt32; // RESERVED! -- MUST SET TO ZERO BEFORE PASSING
+ end;
+ SndSmfOptionsPtr = ^SndSmfOptionsType;
+
+ SndSmfChanRangeType = record
+ bFirstChan: UInt8; // first MIDI channel (0-15 decimal)
+ bLastChan: UInt8; // last MIDI channel (0-15 decimal)
+ end;
+ SndSmfChanRangePtr = ^SndSmfChanRangeType;
+
+(************************************************************
+ * Sound Manager result codes
+ * (sndErrorClass is defined in SystemMgr.h)
+ *************************************************************)
+
+const
+ sndErrBadParam = sndErrorClass or 1;
+ sndErrBadChannel = sndErrorClass or 2;
+ sndErrMemory = sndErrorClass or 3;
+ sndErrOpen = sndErrorClass or 4;
+ sndErrQFull = sndErrorClass or 5;
+ sndErrQEmpty = sndErrorClass or 6; // internal
+ sndErrFormat = sndErrorClass or 7; // unsupported data format
+ sndErrBadStream = sndErrorClass or 8; // invalid data stream
+ sndErrInterrupted = sndErrorClass or 9; // play was interrupted
+
+(********************************************************************
+ * Sound Manager Routines
+ * These are define as syscall calls only under emulation mode or
+ * under native mode from the module that actually installs the trap
+ * vectors
+ ********************************************************************)
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+// Initializes the Sound Manager. Should only be called by
+// Pilot initialization code.
+function SndInit: Err; syscall sysTrapSndInit;
+
+// Frees the Sound Manager.
+//procedure SndFree; syscall sysTrapSndFree;
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// Sets default sound volume levels
+//
+// Any parameter may be passed as NULL
+procedure SndSetDefaultVolume(var alarmAmpP, sysAmpP, defAmpP: UInt16); syscall sysTrapSndSetDefaultVolume;
+
+// Gets default sound volume levels
+//
+// Any parameter may be passed as NULL
+procedure SndGetDefaultVolume(var alarmAmpP, sysAmpP, masterAmpP: UInt16); syscall sysTrapSndGetDefaultVolume;
+
+// Executes a sound command on the given sound channel (pass
+// channelP = 0 to use the shared channel).
+function SndDoCmd({SndChanPtr} channelP: Pointer; cmdP: SndCommandPtr; noWait: Boolean): Err; syscall sysTrapSndDoCmd;
+
+// Plays one of several defined system beeps/sounds (see sndSysBeep...
+// constants).
+procedure SndPlaySystemSound(beepID: SndSysBeepType); syscall sysTrapSndPlaySystemSound;
+
+// NEW FOR v3.0
+// Performs an operation on a Standard MIDI File (SMF) Format #0
+function SndPlaySmf(chanP: Pointer; cmd: SndSmfCmdEnum; var smfP: UInt8; selP: SndSmfOptionsPtr;
+ chanRangeP: SndSmfChanRangePtr; callbacksP: SndSmfCallbacksPtr;
+ bNoWait: Boolean): Err; syscall sysTrapSndPlaySmf;
+
+// NEW FOR v3.0
+// Creates a list of all midi records. Useful for displaying in lists.
+// For creator wildcard, pass creator=0;
+function SndCreateMidiList(creator: UInt32; multipleDBs: Boolean; var wCountP: UInt16; var entHP: MemHandle): Boolean; syscall sysTrapSndCreateMidiList;
+
+// NEW FOR v3.2
+// Plays a MIDI sound which is read out of an open resource database
+function SndPlaySmfResource(resType: UInt32; resID: Int16; volumeSelector: SystemPreferencesChoice): Err; syscall sysTrapSndPlaySmfResource;
+
+
+// NEW FOR v4.0
+// Plays MIDI sounds regardless of the how the interruptible flag is set
+function SndPlaySmfIrregardless(chanP: Pointer; cmd: SndSmfCmdEnum; var smfP: UInt8;
+ var selP: SndSmfOptionsType; var chanRangeP: SndSmfChanRangeType;
+ var callbacksP: SndSmfCallbacksType; bNoWait: Boolean): Err; syscall sysTrapSndPlaySmfIrregardless;
+
+function SndPlaySmfResourceIrregardless(resType: UInt32; resID: Int16; volumeSelector: SystemPreferencesChoice): Err; syscall sysTrapSndPlaySmfResourceIrregardless;
+
+function SndInterruptSmfIrregardless: Err; syscall sysTrapSndInterruptSmfIrregardless;
+
+(************************************************************
+ * Sound Manager Macros
+ *
+ *************************************************************)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/stringmgr.pp b/packages/palmunits/src/stringmgr.pp
new file mode 100644
index 0000000000..88f9618e17
--- /dev/null
+++ b/packages/palmunits/src/stringmgr.pp
@@ -0,0 +1,78 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: StringMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * String manipulation functions
+ *
+ * History:
+ * 11/09/94 RM Created by Ron Marianetti
+ * 08/26/98 kwk Changed chr param in StrChr to WChar (was Int16)
+ * 07/16/99 kwk Added maxStrIToALen.
+ * 05/14/00 vsm Added StrCompareAscii.
+ * 08/18/00 kwk Added StrNCompareAscii.
+ *
+ *****************************************************************************)
+
+unit stringmgr;
+
+interface
+
+uses palmos,coretraps;
+
+// Max length of string returned by StrIToA, for -2147483647, plus space
+// for the terminating null.
+const
+ maxStrIToALen = 12;
+
+// String Manipulation routines
+function StrCopy(dst: PChar; const src: PChar): PChar; syscall sysTrapStrCopy;
+
+function StrNCopy(dst: PChar; const src: PChar; n: Int16): PChar; syscall sysTrapStrNCopy;
+
+function StrCat(dst: PChar; const src: PChar): PChar; syscall sysTrapStrCat;
+
+function StrNCat(dst: PChar; const src: PChar; n: Int16): PChar; syscall sysTrapStrNCat;
+
+function StrLen(const src: PChar): Int16; syscall sysTrapStrLen;
+
+function StrCompareAscii(const s1, s2: PChar): Int16; syscall sysTrapStrCompareAscii;
+
+function StrCompare(const s1, s2: PChar): Int16; syscall sysTrapStrCompare;
+
+function StrNCompareAscii(const s1, s2: PChar; n: Int32): Int16; syscall sysTrapStrNCompareAscii;
+
+function StrNCompare(const s1, s2: PChar;n: Int32): Int16; syscall sysTrapStrNCompare;
+
+function StrCaselessCompare(const s1, s2: PChar): Int16; syscall sysTrapStrCaselessCompare;
+
+function StrNCaselessCompare(const s1, s2: PChar; n: Int32): Int16; syscall sysTrapStrNCaselessCompare;
+
+function StrToLower(dst: PChar; const src: PChar): PChar; syscall sysTrapStrToLower;
+
+function StrIToA(s: PChar; i: Int32): PChar; syscall sysTrapStrIToA;
+
+function StrIToH(s: PChar; i: UInt32): PChar; syscall sysTrapStrIToH;
+
+function StrLocalizeNumber(s: PChar; thousandSeparator, decimalSeparator: Char): PChar; syscall sysTrapStrLocalizeNumber;
+
+function StrDelocalizeNumber(s: PChar; thousandSeparator, decimalSeparator: Char): PChar; syscall sysTrapStrDelocalizeNumber;
+
+function StrChr(const str: PChar; chr: WChar): PChar; syscall sysTrapStrChr;
+
+function StrStr(const str, token: PChar): PChar; syscall sysTrapStrStr;
+
+function StrAToI(const str: PChar): Int32; syscall sysTrapStrAToI;
+
+//function StrPrintF(s: PChar; const Char *formatStr, ...): Int16; syscall sysTrapStrPrintF;
+
+function StrVPrintF(s: PChar; const formatStr: PChar; arg: PChar): Int16; syscall sysTrapStrVPrintF;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/sysevent.pp b/packages/palmunits/src/sysevent.pp
new file mode 100644
index 0000000000..be62b8559a
--- /dev/null
+++ b/packages/palmunits/src/sysevent.pp
@@ -0,0 +1,153 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvent.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+unit sysevent;
+
+interface
+
+uses palmos, coretraps, rect, window;
+
+type
+ SysEventsEnum = WordEnum;
+
+const
+ sysEventNilEvent = 0;
+ sysEventPenDownEvent = Succ(sysEventNilEvent);
+ sysEventPenUpEvent = Succ(sysEventPenDownEvent);
+ sysEventPenMoveEvent = Succ(sysEventPenUpEvent);
+ sysEventKeyDownEvent = Succ(sysEventPenMoveEvent);
+ sysEventWinEnterEvent = Succ(sysEventKeyDownEvent);
+ sysEventWinExitEvent = Succ(sysEventWinEnterEvent);
+ sysEventAppStopEvent = 22;
+ sysEventTsmConfirmEvent = 35;
+ sysEventTsmFepButtonEvent = Succ(sysEventTsmConfirmEvent);
+ sysEventTsmFepModeEvent = Succ(sysEventTsmFepButtonEvent);
+ sysEventFrmTitleChangedEvent = Succ(sysEventTsmFepModeEvent);
+
+ // add future UI level events in this numeric space
+ // to save room for new system level events
+ sysEventNextUIEvent = $0800;
+
+ // <chg 2-25-98 RM> Equates added for library events
+ sysEventFirstINetLibEvent = $1000;
+ sysEventFirstWebLibEvent = $1100;
+
+ // <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 = $6000;
+ sysEventLastUserEvent = $7FFF;
+
+// keyDownEvent modifers
+const
+ shiftKeyMask = $0001;
+ capsLockMask = $0002;
+ numLockMask = $0004;
+ commandKeyMask = $0008;
+ optionKeyMask = $0010;
+ controlKeyMask = $0020;
+ autoRepeatKeyMask = $0040; // True if generated due to auto-repeat
+ doubleTapKeyMask = $0080; // True if this is a double-tap event
+ poweredOnKeyMask = $0100; // True if this is a double-tap event
+ appEvtHookKeyMask = $0200; // True if this is an app hook key
+ libEvtHookKeyMask = $0400; // True if this is a library hook key
+
+// define mask for all "virtual" keys
+ virtualKeyMask = appEvtHookKeyMask or libEvtHookKeyMask or commandKeyMask;
+
+// Event timeouts
+ evtWaitForever = -1;
+ evtNoWait = 0;
+
+type
+ _GenericEventType = record
+ datum: array [0..7] of UInt16;
+ end;
+
+ _PenUpEventType = record
+ start: PointType; // display coord. of stroke start
+ end_: PointType; // display coord. of stroke start
+ end;
+
+ _KeyDownEventType = record
+ chr: WChar; // ascii code
+ keyCode: UInt16; // virtual key code
+ modifiers: UInt16;
+ end;
+
+ _WinEnterEventType = record
+ enterWindow: WinHandle;
+ exitWindow: WinHandle;
+ end;
+
+ _WinExitEventType = record
+ enterWindow: WinHandle;
+ exitWindow: WinHandle;
+ end;
+
+ _TSMConfirmType = record
+ yomiText: PChar;
+ formID: UInt16;
+ end;
+
+ _TSMFepButtonType = record
+ buttonID: UInt16;
+ end;
+
+ _TSMFepModeEventType = record
+ mode: UInt16; // DOLATER kwk - use real type for mode?
+ end;
+
+// The event record.
+ SysEventType = record
+ eType: SysEventsEnum;
+ penDown: Boolean;
+ tapCount: UInt8;
+ screenX: Coord;
+ screenY: Coord;
+ case Integer of
+ 1: (generic: _GenericEventType);
+ 2: (penUp: _PenUpEventType);
+ 3: (keyDown: _KeyDownEventType);
+ 4: (winEnter: _WinEnterEventType);
+ 5: (winExit: _WinExitEventType);
+ 6: (tsmConfirm: _TSMConfirmType);
+ 7: (tsmFepButton: _TSMFepButtonType);
+ 8: (tsmFepMode: _TSMFepModeEventType);
+ end;
+
+// Events are stored in the event queue with some extra fields:
+ SysEventStoreType = record
+ event: SysEventType;
+ id: UInt32; // used to support EvtAddUniqueEvent
+ end;
+
+procedure PenGetPoint(var pScreenX, pScreenY: Int16; var pPenDown: Boolean); syscall sysTrapEvtGetPen;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/sysevtmgr.pp b/packages/palmunits/src/sysevtmgr.pp
new file mode 100644
index 0000000000..915e0752a3
--- /dev/null
+++ b/packages/palmunits/src/sysevtmgr.pp
@@ -0,0 +1,218 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysEvtMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit sysevtmgr;
+
+interface
+
+uses palmos, coretraps, rect, errorbase, sysevent;
+
+(************************************************************
+ * System Event Manager Errors
+ *************************************************************)
+
+const
+ evtErrParamErr = evtErrorClass or 1;
+ evtErrQueueFull = evtErrorClass or 2;
+ evtErrQueueEmpty = evtErrorClass or 3;
+
+(************************************************************
+ * Commands for EvtSetAutoOffTimer()
+ *************************************************************)
+type
+ EvtSetAutoOffCmd = Enum;
+
+const
+ SetAtLeast = 0; // turn off in at least xxx seconds
+ SetExactly = Succ(SetAtLeast); // turn off in xxx seconds
+ SetAtMost = Succ(SetExactly); // turn off in at most xxx seconds
+ SetDefault = Succ(SetAtMost); // change default auto-off timeout to xxx seconds
+ ResetTimer = Succ(SetDefault); // reset the timer to the default auto-off timeout
+
+(************************************************************
+ * 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.
+ *************************************************************)
+
+type
+ PenBtnInfoType = record
+ boundsR: RectangleType; // bounding rectangle of button
+ asciiCode: WChar; // ascii code for key event
+ keyCode: UInt16; // virtual key code for key event
+ modifiers: UInt16; // modifiers for key event
+ end;
+ PenBtnInfoPtr = ^PenBtnInfoType;
+
+type
+ PenBtnListType = record
+ numButtons: UInt16; // Count of number of buttons
+ buttons: array [0..0] of PenBtnInfoType; // Placeholder for one or more buttons
+ end;
+
+(************************************************************
+ * 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.
+
+const
+ silkscreenRectScreen = Rsc('scrn');
+ silkscreenRectGraffiti = Rsc('graf');
+
+// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti
+ alphaGraffitiSilkscreenArea = 0;
+ 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.
+
+type
+ SilkscreenAreaType = record
+ bounds: RectangleType;
+ areaType: UInt32; // four byte creator code.
+ index: UInt16;
+ end;
+ SilkscreenAreaPtr = ^SilkscreenAreaType;
+
+(************************************************************
+ * System Event Manager procedures
+ *************************************************************)
+
+//-----------------------------------------------------------------
+// High Level Calls
+//------------------------------------------------------------------
+
+function EvtSysInit: Err; syscall 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.
+procedure EvtGetSysEvent(var eventP: SysEventType; timeout: Int32); syscall sysTrapEvtGetSysEvent;
+
+// Return true if there is a low level system event (pen or key) available
+function EvtSysEventAvail(ignorePenUps: Boolean): Boolean; syscall sysTrapEvtSysEventAvail;
+
+// Translate a stroke in the silk screen area to a key event
+function EvtProcessSoftKeyStroke(var startPtP, endPtP: PointType): Err; syscall sysTrapEvtProcessSoftKeyStroke;
+
+//-----------------------------------------------------------------
+// Pen Queue Utilties
+//------------------------------------------------------------------
+
+// Replace current pen queue with another of the given size
+function EvtSetPenQueuePtr(penQueueP: MemPtr; size: UInt32): Err; syscall sysTrapEvtSetPenQueuePtr;
+
+// Return size of current pen queue in bytes
+function EvtPenQueueSize: UInt32; syscall sysTrapEvtPenQueueSize;
+
+// Flush the pen queue
+function EvtFlushPenQueue: Err; syscall 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
+function EvtEnqueuePenPoint(var ptP: PointType): Err; syscall 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
+function EvtDequeuePenStrokeInfo(var startPtP, endPtP: PointType): Err; syscall 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.
+function EvtDequeuePenPoint(var retP: PointType): Err; syscall sysTrapEvtDequeuePenPoint;
+
+// Flush the entire stroke from the pen queue and dispose it
+function EvtFlushNextPenStroke: Err; syscall 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
+function EvtSetKeyQueuePtr(keyQueueP: MemPtr; size: UInt32): Err; syscall sysTrapEvtSetKeyQueuePtr;
+
+// Return size of current key queue in bytes
+function EvtKeyQueueSize: UInt32; syscall sysTrapEvtKeyQueueSize;
+
+// Flush the key queue
+function EvtFlushKeyQueue: Err; syscall sysTrapEvtFlushKeyQueue;
+
+// Append a key to the key queue.
+function EvtEnqueueKey(ascii: WChar; keycode, modifiers: UInt16): Err; syscall sysTrapEvtEnqueueKey;
+
+// Return true of key queue empty.
+function EvtKeyQueueEmpty: Boolean; syscall 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.
+function EvtDequeueKeyEvent(var eventP: SysEventType; peek: UInt16): Err; syscall sysTrapEvtDequeueKeyEvent;
+
+//-----------------------------------------------------------------
+// Silkscreen information calls
+//------------------------------------------------------------------
+
+// Return pointer to the pen based button list
+function EvtGetPenBtnList(var numButtons: UInt16): PenBtnInfoPtr; syscall sysTrapEvtGetPenBtnList;
+
+// Return pointer to the silkscreen area list
+function EvtGetSilkscreenAreaList(var numAreas: UInt16): SilkscreenAreaPtr; syscall sysTrapEvtGetSilkscreenAreaList;
+
+//-----------------------------------------------------------------
+// General Utilities
+//------------------------------------------------------------------
+// Force the system to wake-up. This will result in a null event being
+// sent to the current app.
+function EvtWakeup: Err; syscall sysTrapEvtWakeup;
+
+// Force the system to wake-up. This will NOT result in a null event being
+// sent to the current app.
+function EvtWakeupWithoutNilEvent: Err; syscall sysTrapEvtWakeupWithoutNilEvent;
+
+// 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.
+function EvtResetAutoOffTimer: Err; syscall sysTrapEvtResetAutoOffTimer;
+
+function EvtSetAutoOffTimer(cmd: EvtSetAutoOffCmd; timeout: UInt16): Err; syscall sysTrapEvtSetAutoOffTimer;
+
+// Set Graffiti enabled or disabled.
+procedure EvtEnableGraffiti(enable: Boolean); syscall sysTrapEvtEnableGraffiti;
+
+// Force a NullEvent at or before tick
+function EvtSetNullEventTick(tick: UInt32): Boolean; syscall sysTrapEvtSetNullEventTick;
+
+(************************************************************
+ * Assembly Function Prototypes
+ *************************************************************)
+
+//#define _EvtEnqueuePenPoint ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint)
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/systemmgr.pp b/packages/palmunits/src/systemmgr.pp
new file mode 100644
index 0000000000..4bc8e19209
--- /dev/null
+++ b/packages/palmunits/src/systemmgr.pp
@@ -0,0 +1,1197 @@
+{$MACRO ON}
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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)
+ * 07/19/00 gap Added launch code sysAppLaunchCmdAttention for use by
+ * Attention Manager
+ * 7/26/00 jhl Integrate HSIMgr functionality
+ * 09/22/00 BGT Integrated sysAppLaunchNppiNoUI and sysAppLaunchNppiUI
+ *
+ *****************************************************************************)
+
+unit systemmgr;
+
+interface
+
+uses palmos, coretraps, libtraps, errorbase, bitmap, datamgr, systemresources, event_;
+
+(************************************************************
+ * System Constants
+ *************************************************************)
+
+// 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
+const
+ 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
+const
+ sysAppLaunchCmdNormalLaunch = 0; // Normal Launch
+
+ sysAppLaunchCmdFind = 1; // Find string
+
+ sysAppLaunchCmdGoTo = 2; // Launch and go to a particular record
+
+ 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.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ sysAppLaunchCmdCountryChange = 8; // The country has changed
+
+ sysAppLaunchCmdSyncRequestLocal = 9; // Sent to the HotSync application to request a
+ // local HotSync. ("HotSync" button was pressed.)
+
+ sysAppLaunchCmdSyncRequest = sysAppLaunchCmdSyncRequestLocal; // for backward compatibility
+
+ sysAppLaunchCmdSaveData = 10; // Sent to running app before sysAppLaunchCmdFind
+ // or other action codes that will cause data
+ // searches or manipulation.
+
+ 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.
+
+ sysAppLaunchCmdSyncCallApplicationV10 = 12; // Used by DesktopLink Server command "call application";
+ // Pilot v1.0 only!!!
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 2.0
+//------------------------------------------------------------------------
+
+ 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.
+
+ sysAppLaunchCmdReturnFromPanel = 14; // A panel returned to this app
+
+ sysAppLaunchCmdLookup = 15; // Lookup info managed by an app
+
+ sysAppLaunchCmdSystemLock = 16; // Lock the system until a password is entered.
+
+ sysAppLaunchCmdSyncRequestRemote = 17; // Sent to the HotSync application to request
+ // a remote HotSync. ("Remote HotSync" button
+ // was pressed.)
+
+ 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
+
+ sysAppLaunchCmdAddRecord = 19; // Add a record to an applications's database.
+
+//------------------------------------------------------------------------
+// Standard Service Panel launch codes (used by network panel, dialer panel, etc.)
+//------------------------------------------------------------------------
+
+ sysSvcLaunchCmdSetServiceID = 20;
+ sysSvcLaunchCmdGetServiceID = 21;
+ sysSvcLaunchCmdGetServiceList = 22;
+ sysSvcLaunchCmdGetServiceInfo = 23;
+
+ sysAppLaunchCmdFailedAppNotify = 24; // An app just switched to failed.
+ sysAppLaunchCmdEventHook = 25; // Application event hook callback
+ sysAppLaunchCmdExgReceiveData = 26; // Exg command for app to receive data.
+ sysAppLaunchCmdExgAskUser = 27; // Exg command sent before asking user.
+
+//------------------------------------------------------------------------
+// Standard Dialer Service launch codes (30 - 39 reserved)
+//------------------------------------------------------------------------
+
+// sysDialLaunchCmdDial: dials the modem(optionally displays dial progress UI), given service id
+// and serial library reference number
+ sysDialLaunchCmdDial = 30;
+// sysDialLaunchCmdHangUp: hangs up the modem(optionally displays disconnect progress UI), given service id
+// and serial library reference number
+ sysDialLaunchCmdHangUp = 31;
+ sysDialLaunchCmdLast = 39;
+
+//------------------------------------------------------------------------
+// Additional standard Service Panel launch codes (used by network panel, dialer panel, etc)
+// (40-49 reserved)
+//------------------------------------------------------------------------
+
+ sysSvcLaunchCmdGetQuickEditLabel = 40; // SvcQuickEditLabelInfoType
+ sysSvcLaunchCmdLast = 49;
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 3.x where x >= 1
+//------------------------------------------------------------------------
+
+ 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().
+
+ 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).
+
+ 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.
+
+ 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.
+
+ sysAppLaunchCmdGoToURL = 54; // Sent to Clipper to have it launch and display
+ // a given URL. cmdPBP points to the URL string.
+
+// Begin Change - BGT 03/21/2000
+
+//------------------------------------------------------------------------
+// New launch codes defined for Network panel plug-in
+//------------------------------------------------------------------------
+
+ sysAppLaunchNppiNoUI = 55; // Sent to network panel plug-in ("nppi") to have it launch
+ // without UI and load to netlib
+
+ sysAppLaunchNppiUI = 56; // Sent to network panel plug-in ("nppi") to have it launch
+ // with UI
+// End Change - BGT 03/21/2000
+
+//------------------------------------------------------------------------
+// New launch codes defined for PalmOS 4.x where x >= 0
+//------------------------------------------------------------------------
+
+ sysAppLaunchCmdExgPreview = 57; // Sent to an application by the Exchange Manager when the
+ // application needs to produce a preview.
+
+
+ sysAppLaunchCmdCardLaunch = 58; // Sent to an application by the Launcher when the
+ // application is being run from a card.
+
+ sysAppLaunchCmdExgGetData = 59; // Exg command for app to send data requested by an ExgGet
+
+ sysAppLaunchCmdAttention = 60; // sent to an application by the attention manager
+ // when the application needs to take action on an entry
+ // that has been submitted to the attention manager queue.
+
+ sysAppLaunchPnpsPreLaunch = 61; // pre-launch code for Pnps devices,
+ // cmdPBP points to SysAppLaunchCmdPnpsType
+
+// ***ADD NEW SYSTEM ACTION CODES BEFORE THIS COMMENT***
+
+//------------------------------------------------------------------------
+// Custom action code base (custom action codes begin at this value)
+//------------------------------------------------------------------------
+
+ sysAppLaunchCmdCustomBase = $8000;
+
+// Your custom launch codes can be defined like this:
+//
+// type
+// MyAppCustomActionCodes = WordEnum;
+// const
+// myAppCmdDoSomething = sysAppLaunchCmdCustomBase;
+// myAppCmdDoSomethingElse = Succ(myAppCmdDoSomething);
+// myAppCmdEtcetera = Succ(myAppCmdDoSomethingElse);
+
+//------------------------------------------------------------------------
+// SysAppLaunch flags (passed to PilotMain)
+//------------------------------------------------------------------------
+
+ sysAppLaunchFlagNewThread = $01; // create a new thread for application
+ // - implies sysAppLaunchFlagNewStack
+ sysAppLaunchFlagNewStack = $02; // create separate stack for application
+ sysAppLaunchFlagNewGlobals = $04; // create new globals world for application
+ // - implies new owner ID for Memory chunks
+ sysAppLaunchFlagUIApp = $08; // notifies launch routine that this is a UI app being
+ // launched.
+ sysAppLaunchFlagSubCall = $10; // 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.
+ sysAppLaunchFlagDataRelocated = $80; // 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
+ sysAppLaunchFlagPrivateSet = sysAppLaunchFlagSubCall or sysAppLaunchFlagDataRelocated;
+
+//-------------------------------------------------------------------
+// Parameter blocks for action codes
+// NOTE: The parameter block for the sysAppLaunchCmdFind and sysAppLaunchCmdGoTo
+// action codes are defined in "Find.h";
+//---------------------------------------------------------------------------
+
+// For sysAppLaunchCmdSaveData
+type
+ SysAppLaunchCmdSaveDataType = record
+ uiComing: Boolean; // true if system dialog will be put up
+ // before coming action code arrives.
+ reserved1: UInt8;
+ end;
+
+// For sysAppLaunchCmdSystemReset
+ SysAppLaunchCmdSystemResetType = record
+ hardReset: Boolean; // true if system was hardReset, false if soft-reset.
+ createDefaultDB: Boolean; // true if app should create default database.
+ end;
+
+// For sysAppLaunchCmdInitDatabase
+ SysAppLaunchCmdInitDatabaseType = record
+ dbP: DmOpenRef; // Handle of the newly-created database,
+ // already open for read/write access.
+ // IMPORTANT: The handler *MUST* leave
+ // this database handle open on return.
+ creator: UInt32; // Creator ID of the newly-created database
+ type_: UInt32; // Type ID of the newly-created database
+ version: UInt16; // Version number of the newly-created database
+ end;
+
+// For sysAppLaunchCmdSyncCallApplicationV10
+// This structure used on Pilot v1.0 only. See sysAppLaunchCmdHandleSyncCallApp
+// for later platforms.
+ SysAppLaunchCmdSyncCallApplicationTypeV10 = record
+ action: UInt16; // call action id (app-specific)
+ paramSize: UInt16; // parameter size
+ paramP: Pointer; // ptr to parameter
+ remoteSocket: UInt8; // remote socket id
+ tid: UInt8; // command transaction id
+ handled: Boolean; // if handled, MUST be set true by the app
+ reserved1: UInt8;
+ end;
+
+// For sysAppLaunchCmdHandleSyncCallApp (Pilot v2.0 and greater).
+// This structure replaces SysAppLaunchCmdSyncCallApplicationType
+// which was used in Pilot v1.0
+ SysAppLaunchCmdHandleSyncCallAppType = record
+ pbSize: UInt16; // this parameter block size (set to sizeof SysAppLaunchCmdHandleSyncCallAppType)
+ action: UInt16; // call action id (app-specific)
+ paramP: Pointer; // ptr to parameter
+ dwParamSize: UInt32; // parameter size
+ dlRefP: Pointer; // DesktopLink reference pointer for passing
+ // to DlkControl()'s dlkCtlSendCallAppReply code
+
+ handled: Boolean; // 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.
+
+ reserved1: UInt8;
+
+ replyErr: Err; // error from dlkCtlSendCallAppReply
+
+ // RESERVED FOR FUTURE EXTENSIONS
+ dwReserved1: UInt32; // RESERVED -- set to null!!!
+ dwReserved2: UInt32; // RESERVED -- set to null!!!
+
+ // Target executable creator and type for testing the mechanism
+ // in EMULATION MODE ONLY!!!
+// #if EMULATION_LEVEL != EMULATION_NONE
+// creator: UInt32;
+// type_: UInt32;
+// #endif
+ end;
+
+// For sysAppLaunchCmdFailedAppNotify
+ SysAppLaunchCmdFailedAppNotifyType = record
+ creator: UInt32;
+ type_: UInt32;
+ result: Err;
+ end;
+
+// For sysAppLaunchCmdOpenDB
+ SysAppLaunchCmdOpenDBType = record
+ cardNo: UInt16;
+ dbID: LocalID;
+ end;
+
+// For sysAppLaunchCmdCardLaunch
+type
+ SysAppLaunchCmdCardType = record
+ err: Err;
+ volRefNum: UInt16;
+ path: PChar;
+ startFlags: UInt16; // See vfsStartFlagXXX constants below
+ end;
+
+const
+ sysAppLaunchStartFlagAutoStart = $0001; // this bit in the 'startFlags' field is set for an app which is run automatically on card insertion
+ sysAppLaunchStartFlagNoUISwitch = $0002; // set this bit in the 'startFlags' field to prevent a UI switch to the start.prc app
+ sysAppLaunchStartFlagNoAutoDelete = $0004; // set this bit in the 'startFlags' field to prevent VFSMgr from deleting start.prc app on volume unmount
+
+//for launch code sysAppLaunchPnpsPreLaunch
+type
+ SysAppLaunchCmdPnpsType = record
+ error: Err; // an error code from the pre-launch application, set to errNone to prevent normal launching
+ volRefNum: UInt16; // Non-zero if an optional file system was mounted
+ slotLibRefNum: UInt16; // always valid for a slot driver call
+ slotRefNum: UInt16; // always valid for a slot driver call
+ end;
+
+(************************************************************
+ * 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
+ ****
+ *************************************************************)
+
+ SysAppInfoTag = record
+ cmd: Int16; // command code for app
+ cmdPBP: MemPtr; // cmd ParamBlock
+ launchFlags: UInt16; // launch flags
+
+ taskID: UInt32; // AMX task ID of task that app runs in
+ codeH: MemHandle; // code MemHandle of the main code segment
+ dbP: DmOpenRef; // Application database access MemPtr of App
+ stackP: ^UInt8; // stack chunk for the App
+ globalsChunkP: ^UInt8; // globals chunk for the App
+
+ memOwnerID: UInt16; // owner ID for Memory Manager chunks
+ dmAccessP: MemPtr; // pointer to linked list of opened DB's
+ dmLastErr: Err; // Last error from Data Manager
+ errExceptionP: MemPtr; // ErrTry,Catch exception list
+
+ // PalmOS v3.0 fields begin here
+ a5Ptr: ^UInt8; // A5 MemPtr for this app
+ stackEndP: ^UInt8; // stack chunk end for the App (last byte)
+ globalEndP: ^UInt8; // global chunk end for the App (last byte)
+ rootP: ^SysAppInfoType;// Points to the SysAppInfoType first
+ // allocated for this thread.
+ extraP: MemPtr; // unused MemPtr for the App.
+ end;
+ SysAppInfoType = SysAppInfoTag;
+ SysAppInfoPtr = ^SysAppInfoType;
+
+(************************************************************
+ * 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)
+ SysLibTblEntryType = record
+ dispatchTblP: ^MemPtr; // pointer to library dispatch table
+ globalsP: Pointer; // Library globals
+
+ // New INTERNAL fields for v2.0 (vmk 8/27/96):
+ dbID: LocalID; // database id of the library
+ codeRscH: Pointer; // library code resource handle for RAM-based libraries
+ end;
+ SysLibTblEntryPtr = ^SysLibTblEntryType;
+
+// 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
+ SimDispatchTableType = record
+ numEntries: UInt32 ; // number of library entries
+ entries: array [0..0] of Pointer; // dispatch routine entries
+ // followed by pointer to name
+ end;
+ SimDispatchTablePtr = ^SimDispatchTableType;
+//#endif
+
+// Library entry point procedure
+ SysLibEntryProcPtr = function(refNum: UInt16; entryP: SysLibTblEntryPtr): Err;
+
+// This library refNum is reserved for the Debugger comm library
+const
+ sysDbgCommLibraryRefNum = 0;
+
+// This portID is reserved for identifying the debugger's port
+ sysDbgCommPortID = $C0FF;
+
+// This refNum signals an invalid refNum
+ sysInvalidRefNum = $FFFF;
+
+(************************************************************
+ * Function prototype for Kernel
+ *************************************************************)
+
+// Task termination procedure prototype for use with SysTaskSetTermProc
+type
+ SysTermProcPtr = procedure(taskID: UInt32; reason: Int32);
+
+// Timer procedure for use with SysTimerCreate
+ SysTimerProcPtr = procedure(timerID, param: Int32);
+
+(************************************************************
+ * Structure of the pref=0 resource in applications. Note, this
+ * structure must mirror the structure of the sysResTAppPrefs
+ * resource as defined in SystemResources.h.
+ *************************************************************)
+
+type
+ SysAppPrefs = record
+ priority: UInt16; // task priority
+ stackSize: UInt32; // required stack space
+ minHeapSpace: UInt32; // minimum heap space required
+ end;
+ SysAppPrefsType = SysAppPrefs;
+ SysAppPrefsPtr = ^SysAppPrefsType;
+
+(************************************************************
+ * Structure of the xprf=0 resource in resource DBs. Note, this
+ * structure must mirror the structure of the sysResTExtPrefs
+ * resource as defined in SystemResources.h. Also, fields can only
+ * be added (at the end), never removed or changed.
+ *************************************************************)
+
+const
+ sysExtPrefsVers = 1;
+
+// Flags defined for SysExtPrefsType.flags
+const
+ sysExtPrefsNoOverlayFlag = $00000001;
+
+type
+ SysExtPrefsType = record
+ version: UInt16; // version of structure.
+ flags: UInt32; // 32 boolean flags.
+ end;
+
+(************************************************************
+ * System Errors
+ *************************************************************)
+
+const
+ sysErrTimeout = sysErrorClass or 1;
+ sysErrParamErr = sysErrorClass or 2;
+ sysErrNoFreeResource = sysErrorClass or 3;
+ sysErrNoFreeRAM = sysErrorClass or 4;
+ sysErrNotAllowed = sysErrorClass or 5;
+ sysErrSemInUse = sysErrorClass or 6;
+ sysErrInvalidID = sysErrorClass or 7;
+ sysErrOutOfOwnerIDs = sysErrorClass or 8;
+ sysErrNoFreeLibSlots = sysErrorClass or 9;
+ sysErrLibNotFound = sysErrorClass or 10;
+ sysErrDelayWakened = sysErrorClass or 11; // SysTaskDelay wakened by SysTaskWake before delay completed.
+ sysErrRomIncompatible = sysErrorClass or 12;
+ sysErrBufTooSmall = sysErrorClass or 13;
+ sysErrPrefNotFound = sysErrorClass or 14;
+
+// NotifyMgr error codes:
+ sysNotifyErrEntryNotFound = sysErrorClass or 16; // could not find registration entry in the list
+ sysNotifyErrDuplicateEntry = sysErrorClass or 17; // identical entry already exists
+ sysNotifyErrBroadcastBusy = sysErrorClass or 19; // a broadcast is already in progress - try again later.
+ sysNotifyErrBroadcastCancelled = sysErrorClass or 20; // a handler cancelled the broadcast
+
+// AMX error codes continued - jb 10/20/98
+ sysErrMbId = sysErrorClass or 21;
+ sysErrMbNone = sysErrorClass or 22;
+ sysErrMbBusy = sysErrorClass or 23;
+ sysErrMbFull = sysErrorClass or 24;
+ sysErrMbDepth = sysErrorClass or 25;
+ sysErrMbEnv = sysErrorClass or 26;
+
+// NotifyMgr Phase #2 Error Codes:
+ sysNotifyErrQueueFull = sysErrorClass or 27; // deferred queue is full.
+ sysNotifyErrQueueEmpty = sysErrorClass or 28; // deferred queue is empty.
+ sysNotifyErrNoStackSpace = sysErrorClass or 29; // not enough stack space for a broadcast
+ sysErrNotInitialized = sysErrorClass or 30; // manager is not initialized
+
+// AMX error/warning codes continued - jed 9/10/99
+ sysErrNotAsleep = sysErrorClass or 31; // Task woken by SysTaskWake was not asleep, 1 wake pending
+ sysErrNotAsleepN = sysErrorClass or 32; // Task woken by SysTaskWake was not asleep, >1 wake pending
+
+// Power Manager error codes - soe, srj 9/19/00
+ pwrErrNone = pwrErrorClass or 0;
+ pwrErrBacklight = pwrErrorClass or 1;
+ pwrErrRadio = pwrErrorClass or 2;
+ pwrErrBeam = pwrErrorClass or 3;
+ pwrErrGeneric = pwrErrorClass or 4;
+
+(************************************************************
+ * System Features
+ *************************************************************)
+
+ sysFtrCreator = sysFileCSystem; // Feature Creator
+
+ 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
+
+ sysFtrNumProcessorID = 2; // Product id
+ // 0xMMMMRRRR, where MMMM is the processor model and RRRR is the revision.
+ sysFtrNumProcessorMask = $FFFF0000; // Mask to obtain processor model
+ sysFtrNumProcessor328 = $00010000; // Motorola 68328 (Dragonball)
+ sysFtrNumProcessorEZ = $00020000; // Motorola 68EZ328 (Dragonball EZ)
+ sysFtrNumProcessorVZ = $00030000; // Motorola 68VZ328 (Dragonball VZ)
+ sysFtrNumProductID = sysFtrNumProcessorID; // old (obsolete) define
+
+ sysFtrNumBacklight = 3; // Backlight
+ // bit 0: 1 if present. 0 if Feature does not exist or backlight is not present
+
+ sysFtrNumEncryption = 4; // Which encryption schemes are present
+ sysFtrNumEncryptionMaskDES = $00000001; // bit 0: 1 if DES is present
+
+ 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.
+
+ 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.
+
+ 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.
+
+ sysFtrNumHwrMiscFlags = 8; // GHwrMiscFlags value (PalmOS 3.1)
+ sysFtrNumHwrMiscFlagsExt = 9; // GHwrMiscFlagsExt value (PalmOS 3.1)
+
+ sysFtrNumIntlMgr = 10;
+ // Result is a set of flags that define functionality supported
+ // by the Int'l Manager. (PalmOS 3.1)
+
+ sysFtrNumEncoding = 11;
+ // Result is the character encoding (defined in PalmLocale.h) supported
+ // by this ROM. If this feature doesn't exist then the assumed encoding
+ // is Palmlatin (superset of Windows code page 1252). (PalmOS 3.1)
+
+ sysFtrDefaultFont = 12;
+ // Default font ID used for displaying text. (PalmOS 3.1)
+
+ sysFtrDefaultBoldFont = 13;
+ // Default font ID used for displaying bold text. (PalmOS 3.1)
+
+ 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)
+
+ sysFtrNumVendor = 15;
+ // Result is the vendor id, in the low sixteen bits. (PalmOS 3.3)
+
+ sysFtrNumCharEncodingFlags = 16;
+ // Flags for a given character encoding, specified in TextMgr.h (PalmOS 3.5)
+
+ sysFtrNumNotifyMgrVersion = 17; // version of the NotifyMgr, if any (PalmOS 3.5)
+
+ 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)
+
+ 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)
+
+ sysFtrNumOEMCompanyID = 20; // GHwrOEMCompanyID value (PalmOS 3.5)
+ sysFtrNumOEMDeviceID = 21; // GHwrOEMDeviceID value (PalmOS 3.5)
+ sysFtrNumOEMHALID = 22; // GHwrOEMHALID value (PalmOS 3.5)
+ sysFtrNumDefaultCompression = 23; // Default Clipper's compression (Palmos 3.5)
+ sysFtrNumWinVersion = 24; // Window version (PalmOS 4.0)
+ sysFtrNumAccessorTrapPresent = 25; // If accessor trap exists (PalmOS 4.0)
+
+(************************************************************
+ * ROM token information (for SysGetROMToken, below)
+ *************************************************************)
+
+// Additional tokens and token information is located in <Hardware.h>
+ sysROMTokenSnum = Rsc('snum'); // Memory Card Flash ID (serial number)
+
+(************************************************************
+ * Macros for extracting and combining ROM/OS version components
+ *************************************************************)
+
+// ROM/OS stage numbers
+ sysROMStageDevelopment = 0;
+ sysROMStageAlpha = 1;
+ sysROMStageBeta = 2;
+ sysROMStageRelease = 3;
+
+// MACRO: sysMakeROMVersion
+//
+// Builds a ROM version value from the major, minor, fix, stage, and build numbers
+//
+
+function sysMakeROMVersion(major, minor, fix, stage: UInt8; buildNum: UInt16): UInt32;
+
+
+// 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)
+
+function sysGetROMVerMajor(dwROMVer: UInt32): UInt16;
+function sysGetROMVerMinor(dwROMVer: UInt32): UInt16;
+function sysGetROMVerFix(dwROMVer: UInt32): UInt16;
+function sysGetROMVerStage(dwROMVer: UInt32): UInt16;
+function sysGetROMVerBuild(dwROMVer: UInt32): UInt16;
+
+(************************************************************
+ * System Types
+ *************************************************************)
+
+// Types of batteries installed.
+type
+ SysBatteryKind = Enum;
+
+const
+ sysBatteryKindAlkaline=0;
+ sysBatteryKindNiCad = Succ(sysBatteryKindAlkaline);
+ sysBatteryKindLiIon = Succ(sysBatteryKindNiCad);
+ sysBatteryKindRechAlk = Succ(sysBatteryKindLiIon);
+ sysBatteryKindNiMH = Succ(sysBatteryKindRechAlk);
+ sysBatteryKindLiIon1400 = Succ(sysBatteryKindNiMH);
+ sysBatteryKindLast = $FF; // insert new battery types BEFORE this one
+
+// Different battery states (output of hwrBattery)
+type
+ SysBatteryState = Enum;
+
+const
+ sysBatteryStateNormal = 0;
+ sysBatteryStateLowBattery = Succ(sysBatteryStateNormal);
+ sysBatteryStateCritBattery = Succ(sysBatteryStateLowBattery);
+ sysBatteryStateShutdow = Succ(sysBatteryStateCritBattery);
+
+// SysCreateDataBaseList can generate a list of database.
+type
+ SysDBListItemType = record
+ name: array [0..dmDBNameLength-1] of Char;
+ creator: UInt32;
+ type_: UInt32;
+ version: UInt16;
+ dbID: LocalID;
+ cardNo: UInt16;
+ iconP: BitmapPtr;
+ end;
+
+// 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.
+ SysMailboxMsgType = record
+ data: array [0..2] of UInt32;
+ end;
+
+// Constants used by the SysEvGroupSignal call
+const
+ sysEvGroupSignalConstant = 0;
+ sysEvGroupSignalPulse = 1;
+
+// Constants used by the SysEvGroupWait call
+ sysEvGroupWaitOR = 0;
+ sysEvGroupWaitAND = 1;
+
+(************************************************************
+ * System Pre-defined "file descriptors"
+ * These are used by applications that use the Net Library's
+ * NetLibSelect() call
+ *************************************************************)
+
+ sysFileDescStdIn = 0;
+
+//============================================================================
+// jhl 7/26/00 Integrate HSIMgr functionality
+//============================================================================
+ sysNotifyHSISerialPortInUseEvent = Rsc('hsiu'); // Sent when serial port is in use
+ sysNotifyHSIPeripheralRespondedEvent = Rsc('hspr'); // Sent with peripheral response
+ sysNotifyHSIPeripheralNotRespondingEvent = Rsc('hspn'); // Sent when peripheral does not respond
+ sysNotifyHSINoConnectionEvent = Rsc('ncon'); // Sent on VID of no connection
+ sysNotifyHSIUSBCradleEvent = sysPortUSBDesktop; // Sent on VID of USB Cradle
+ sysNotifyHSIRS232CradleEvent = Rsc('rs2c'); // Sent on VID of RS232 Cradle
+ sysNotifyHSIUSBPeripheralEvent = sysPortUSBPeripheral; // Sent on VID of USB Peripheral
+ sysNotifyHSIRS232PeripheralEvent = Rsc('rs2p'); // Sent on VID of RS232 Peripheral
+ sysNotifyHSIDebugEvent = Rsc('dbug'); // Sent on VID of Debug
+
+ sysMaxHSIResponseSize = 64;
+ sysHSISerialInquiryBaud = 9600;
+ sysHSISerialInquiryString = 'ATI3\015\012';
+ sysHSISerialInquiryStringLen = 6;
+ sysHSISerialInterChrTimeout = 3; // ticks (20-30 ms)
+ sysHSISerialInquiryTimeout = 11; // ticks (100-110 ms)
+
+type
+ SysHSIResponseType = record
+ // "Voltage ID" from modem pin converted to 4 character VID
+// VID: UInt32;
+ // Actual voltage detected on modem VID pin
+// mVolts: UInt16;
+ // Character string received in response to inquiry string
+ // (will be NUL terminated)
+ responseBuffer: array [0..sysMaxHSIResponseSize-1] of Char;
+ // Length of string in responseBuffer
+ responseLength: UInt16;
+ end;
+
+(************************************************************
+ * Function Prototypes
+ *************************************************************)
+
+// Prototype for Pilot applications entry point
+
+// UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags);
+
+// SystemMgr routines
+procedure SysUnimplemented; syscall sysTrapSysUnimplemented;
+
+procedure SysColdBoot(card0P: Pointer; card0Size: UInt32; card1P: Pointer;
+ card1Size, sysCardHeaderOffset: UInt32); syscall sysTrapSysColdBoot;
+
+procedure SysInit; syscall sysTrapSysInit;
+
+procedure SysReset; syscall sysTrapSysReset;
+
+//procedure SysPowerOn(card0P: Pointer; card0Size: UInt32; card1P: Pointer;
+// card1Size, sysCardHeaderOffset: UInt32; reFormat: Boolean); syscall sysTrapSysPowerOn;
+
+procedure SysDoze(onlyNMI: Boolean); syscall sysTrapSysDoze;
+
+function SysSetPerformance(var sysClockP: UInt32; var cpuDutyP: UInt16): Err; syscall sysTrapSysSetPerformance;
+
+procedure SysSleep(untilReset, emergency: Boolean); syscall sysTrapSysSleep;
+
+function SysSetAutoOffTime(seconds: UInt16): UInt16; syscall sysTrapSysSetAutoOffTime;
+
+function SysTicksPerSecond: UInt16; syscall sysTrapSysTicksPerSecond;
+
+function SysLaunchConsole: Err; syscall sysTrapSysLaunchConsole;
+
+function SysHandleEvent(var eventP: EventType): Boolean; syscall sysTrapSysHandleEvent;
+
+procedure SysUILaunch; syscall sysTrapSysUILaunch;
+
+function SysUIAppSwitch(cardNo: UInt16; dbID: LocalID; cmd: UInt16; cmdPBP: MemPtr): Err; syscall sysTrapSysUIAppSwitch;
+
+function SysCurAppDatabase(var cardNoP: UInt16; var dbIDP: LocalID): Err; syscall sysTrapSysCurAppDatabase;
+
+function SysBroadcastActionCode(cmd: UInt16; cmdPBP: MemPtr): Err; syscall sysTrapSysBroadcastActionCode;
+
+function SysAppLaunch(cardNo: UInt16; dbID: LocalID; launchFlags, cmd: UInt16;
+ cmdPBP: MemPtr; var resultP: UInt32): Err; syscall sysTrapSysAppLaunch;
+
+function SysNewOwnerID: UInt16; syscall sysTrapSysNewOwnerID;
+
+function SysSetA5(newValue: UInt32): UInt32; syscall sysTrapSysSetA5;
+
+// Routines used by startup code
+function SysAppStartup(var appInfoPP: SysAppInfoPtr; var prevGlobalsP, globalsPtrP: MemPtr): Err; syscall sysTrapSysAppStartup;
+
+function SysAppExit(appInfoP: SysAppInfoPtr; prevGlobalsP, globalsP: MemPtr): Err; syscall sysTrapSysAppExit;
+
+//#if EMULATION_LEVEL != EMULATION_NONE
+// Simulator-specific routines
+//MemPtr SysCardImageInfo(UInt16 cardNo, UInt32 *sizeP;
+//
+//void SysCardImageDeleted(UInt16 cardNo;
+//#endif // EMULATION_LEVEL != EMULATION_NONE
+
+function SysUIBusy(set_, value: Boolean): UInt16; syscall sysTrapSysUIBusy;
+
+function SysLCDContrast(set_: Boolean; newContrastLevel: UInt8): UInt8; syscall sysTrapSysLCDContrast;
+
+function SysLCDBrightness(set_: Boolean; newBrightnessLevel: UInt8): UInt8; syscall sysTrapSysLCDBrightness;
+
+// System Dialogs
+procedure SysBatteryDialog; syscall sysTrapSysBatteryDialog;
+
+// Utilities
+function SysSetTrapAddress(trapNum: UInt16; procP: Pointer): Err; syscall sysTrapSysSetTrapAddress;
+
+function SysGetTrapAddress(trapNum: UInt16): Pointer; syscall sysTrapSysGetTrapAddress;
+
+function SysDisableInts: UInt16; syscall sysTrapSysDisableInts;
+
+procedure SysRestoreStatus(status: UInt16); syscall sysTrapSysRestoreStatus;
+
+function SysGetOSVersionString: PChar; syscall sysTrapSysGetOSVersionString;
+
+// The following trap is a public definition of HwrGetROMToken from <Hardware.h>
+// See token definitions (like sysROMTokenSerial) above...
+
+function SysGetROMToken(cardNo: UInt16; token: UInt32; var dataP: UInt8Ptr; var sizeP: UInt16): Err; syscall sysTrapHwrGetROMToken;
+
+
+// Library Management
+function SysLibInstall(libraryP: SysLibEntryProcPtr; var refNumP: UInt16): Err; syscall sysTrapSysLibInstall;
+
+function SysLibLoad(libType, libCreator: UInt32; var refNumP: UInt16): Err; syscall sysTrapSysLibLoad;
+
+function SysLibRemove(refNum: UInt16): Err; syscall sysTrapSysLibRemove;
+
+function SysLibFind(const nameP: PChar; var refNumP: UInt16): Err; syscall sysTrapSysLibFind;
+
+function SysLibTblEntry(refNum: UInt16): SysLibTblEntryPtr; syscall sysTrapSysLibTblEntry;
+
+// Generic Library calls
+function SysLibOpen(refNum: UInt16): Err; syscall sysLibTrapOpen;
+function SysLibClose(refNum: UInt16): Err; syscall sysLibTrapClose;
+function SysLibSleep(refNum: UInt16): Err; syscall sysLibTrapSleep;
+function SysLibWake(refNum: UInt16): Err; syscall sysLibTrapWake;
+
+//-----------------------------------------------------
+// Kernel Prototypes
+//-----------------------------------------------------
+
+// Task Creation and deleation
+function SysTranslateKernelErr(err: Err): Err; syscall sysTrapSysTranslateKernelErr;
+
+function SysTaskCreate(var taskIDP, creator: UInt32; codeP: ProcPtr; stackP: MemPtr;
+ stackSize, attr, priority, tSlice: UInt32): Err; syscall sysTrapSysTaskCreate;
+
+function SysTaskDelete(taskID, priority: UInt32): Err; syscall sysTrapSysTaskDelete;
+
+function SysTaskTrigger(taskID: UInt32): Err; syscall sysTrapSysTaskTrigger;
+
+function SysTaskID: UInt32; syscall sysTrapSysTaskID;
+
+function SysTaskDelay(delay: Int32): Err; syscall sysTrapSysTaskDelay;
+
+function SysTaskSetTermProc(taskID: UInt32; termProcP: SysTermProcPtr): Err; syscall sysTrapSysTaskSetTermProc;
+
+function SysTaskSwitching(enable: Boolean): Err; syscall sysTrapSysTaskSwitching;
+
+function SysTaskWait(timeout: Int32): Err; syscall sysTrapSysTaskWait;
+
+function SysTaskWake(taskID: UInt32): Err; syscall sysTrapSysTaskWake;
+
+procedure SysTaskWaitClr; syscall sysTrapSysTaskWaitClr;
+
+function SysTaskSuspend(taskID: UInt32): Err; syscall sysTrapSysTaskSuspend;
+
+function SysTaskResume(taskID: UInt32): Err; syscall sysTrapSysTaskResume;
+
+// Counting Semaphores
+function SysSemaphoreCreate(var smIDP, tagP: UInt32; initValue: Int32): Err; syscall sysTrapSysSemaphoreCreate;
+
+function SysSemaphoreDelete(smID: UInt32): Err; syscall sysTrapSysSemaphoreDelete;
+
+function SysSemaphoreWait(smID, priority: UInt32; timeout: Int32): Err; syscall sysTrapSysSemaphoreWait;
+
+function SysSemaphoreSignal(smID: UInt32): Err; syscall sysTrapSysSemaphoreSignal;
+
+function SysSemaphoreSet(smID: UInt32): Err; syscall sysTrapSysSemaphoreSet;
+
+// Resource Semaphores
+function SysResSemaphoreCreate(var smIDP, tagP: UInt32): Err; syscall sysTrapSysResSemaphoreCreate;
+
+function SysResSemaphoreDelete(smID: UInt32): Err; syscall sysTrapSysResSemaphoreDelete;
+
+function SysResSemaphoreReserve(smID, priority: UInt32; timeout: Int32): Err; syscall sysTrapSysResSemaphoreReserve;
+
+function SysResSemaphoreRelease(smID: UInt32): Err; syscall sysTrapSysResSemaphoreRelease;
+
+// Timers
+function SysTimerCreate(var timerIDP, tagP: UInt32; timerProc: SysTimerProcPtr;
+ periodicDelay, param: UInt32): Err; syscall sysTrapSysTimerCreate;
+
+function SysTimerDelete(timerID: UInt32): Err; syscall sysTrapSysTimerDelete;
+
+function SysTimerWrite(timerID, value: UInt32): Err; syscall sysTrapSysTimerWrite;
+
+function SysTimerRead(timerID: UInt32; var valueP: UInt32): Err; syscall sysTrapSysTimerRead;
+
+// Information
+function SysKernelInfo(paramP: Pointer): Err; syscall sysTrapSysKernelInfo;
+
+function SysCreateDataBaseList(type_, creator: UInt32; var dbCount: UInt16;
+ var dbIDs: MemHandle; lookupName: Boolean): Boolean; syscall sysTrapSysCreateDataBaseList;
+
+function SysCreatePanelList(var panelCount: UInt16; var panelIDs: MemHandle): Boolean; syscall sysTrapSysCreatePanelList;
+
+function SysBatteryInfo(set_: Boolean; var warnThresholdP, criticalThresholdP: UInt16;
+ var maxTicksP: Int16; var kindP: SysBatteryKind; var pluggedIn: Boolean;
+ var percentP: UInt8): UInt16; syscall sysTrapSysBatteryInfo;
+
+function SysBatteryInfoV20(set_: Boolean; warnThresholdP, criticalThresholdP: UInt16;
+ var maxTicksP: Int16; var kindP: SysBatteryKind; var pluggedIn: Boolean): UInt16; syscall sysTrapSysBatteryInfoV20;
+
+function SysGetStackInfo(var startPP, endPP: MemPtr): Boolean; syscall sysTrapSysGetStackInfo;
+
+// Mailboxes
+function SysMailboxCreate(var mbIDP, tagP: UInt32; depth: UInt32): Err; syscall sysTrapSysMailboxCreate;
+
+function SysMailboxDelete(mbID: UInt32): Err; syscall sysTrapSysMailboxDelete;
+
+function SysMailboxFlush(mbID: UInt32): Err; syscall sysTrapSysMailboxFlush;
+
+function SysMailboxSend(mbID: UInt32; msgP: Pointer; wAck: UInt32): Err; syscall sysTrapSysMailboxSend;
+
+function SysMailboxWait(mbID: UInt32; msgP: Pointer; priority: UInt32; timeout: Int32): Err; syscall sysTrapSysMailboxWait;
+
+// Event Groups
+function SysEvGroupCreate(var evIDP, tagP: UInt32; init: UInt32): Err; syscall sysTrapSysEvGroupCreate;
+
+//Err SysEvGroupDelete(UInt32 evID) // save trap table space - don't need
+//; syscall sysTrapSysEvGroupDelete;
+
+function SysEvGroupSignal(evID, mask, value: UInt32; type_: Int32): Err; syscall sysTrapSysEvGroupSignal;
+
+function SysEvGroupRead(evID: UInt32; var valueP: UInt32): Err; syscall sysTrapSysEvGroupRead;
+
+function SysEvGroupWait(evID, mask, value: UInt32; matchType, timeout: Int32): Err; syscall sysTrapSysEvGroupWait;
+
+(************************************************************
+ * Assembly Function Prototypes
+ *************************************************************)
+
+//#define _SysSemaphoreSignal ASM_; syscall sysTrapSysSemaphoreSignal
+
+//#define _SysSemaphoreSet ASM_; syscall sysTrapSysSemaphoreSet
+
+//#define _SysDoze ASM_; syscall sysTrapSysDoze
+
+implementation
+
+function sysMakeROMVersion(major, minor, fix, stage: UInt8; buildNum: UInt16): UInt32;
+begin
+ sysMakeROMVersion :=
+ ((major and $0FF) shl 24) or
+ ((minor and $00F) shl 20) or
+ ((fix and $00F) shl 16) or
+ ((stage and $00F) shl 12) or
+ (buildNum and $0FFF);
+end;
+
+function sysGetROMVerMajor(dwROMVer: UInt32): UInt16;
+begin
+ sysGetROMVerMajor := (dwROMVer shr 24) and $00FF;
+end;
+
+function sysGetROMVerMinor(dwROMVer: UInt32): UInt16;
+begin
+ sysGetROMVerMinor := (dwROMVer shr 20) and $000F;
+end;
+
+function sysGetROMVerFix(dwROMVer: UInt32): UInt16;
+begin
+ sysGetROMVerFix := (dwROMVer shr 16) and $000F;
+end;
+
+function sysGetROMVerStage(dwROMVer: UInt32): UInt16;
+begin
+ sysGetROMVerStage := (dwROMVer shr 12) and $000F;
+end;
+
+function sysGetROMVerBuild(dwROMVer: UInt32): UInt16;
+begin
+ sysGetROMVerBuild := dwROMVer and $0FFF;
+end;
+
+end.
diff --git a/packages/palmunits/src/systemresources.pp b/packages/palmunits/src/systemresources.pp
new file mode 100644
index 0000000000..5490a1169d
--- /dev/null
+++ b/packages/palmunits/src/systemresources.pp
@@ -0,0 +1,411 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SystemResources.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ * 04/11/00 CS Added sysFileCLZ77Lib, sysResTCompressedDB, and
+ * sysResIDCompressedDB to support saving compressed DBs
+ * inside apps (e.g. GraffitiDemo inside Setup).
+ * 05/12/00 kwk Added sysFileTLocaleModule.
+ * 08/29/00 spk added sysFileCPalmDevice
+ * 09/13/00 djk added bluetooth creator types
+ * 10/27/00 CS Added sysFileCSmsMessenger, sysFileCNetTrace, sysFileCPing,
+ * sysResTFontMap, sysFileTStdIO, and sysFileCLanguagePicker.
+ * CS Moved sysFileCSdSpiCard up to live with other DB creators.
+ *
+ *****************************************************************************)
+
+unit systemresources;
+
+interface
+
+//-----------------------------------------------------------
+// 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 Rsc := }
+const
+ sysFileCSystem = Rsc('psys'); // Creator type for System files
+ sysFileCOEMSystem = Rsc('poem'); // Creator type for OEM System files
+ sysFileCPalmDevice = Rsc('pdvc'); // Creator type for Palm Devices, analogous to 'poem'
+ sysFileCGraffiti = Rsc('graf'); // Creator type for Graffiti databases
+ sysFileCSystemPatch = Rsc('ptch'); // Creator for System resource file patches
+
+ sysFileCCalculator = Rsc('calc'); // Creator type for Calculator App
+ sysFileCSecurity = Rsc('secr'); // Creator type for Security App
+ sysFileCPreferences = Rsc('pref'); // Creator type for Preferences App
+ sysFileCAddress = Rsc('addr'); // Creator type for Address App
+ sysFileCToDo = Rsc('todo'); // Creator type for To Do App
+ sysFileCDatebook = Rsc('date'); // Creator type for Datebook App
+ sysFileCMemo = Rsc('memo'); // Creator type for MemoPad App
+ sysFileCSync = Rsc('sync'); // Creator type for HotSync App
+ sysFileCMemory = Rsc('memr'); // Creator type for Memory App
+ sysFileCMail = Rsc('mail'); // Creator type for Mail App
+ sysFileCExpense = Rsc('exps'); // Creator type for Expense App
+ sysFileCLauncher = Rsc('lnch'); // Creator type for Launcher App
+ sysFileCClipper = Rsc('clpr'); // Creator type for clipper app.
+ sysFileCDial = Rsc('dial'); // Creator type for dial app.
+ sysFileCSetup = Rsc('setp'); // Creator type for setup app.
+ sysFileCActivate = Rsc('actv'); // Creator type for activation app.
+ sysFileCGenenicActivate = Rsc('gafd'); // New Generic Activation application working for all Palm models
+ sysFileCFlashInstaller = Rsc('fins'); // Creator type for FlashInstaller app.
+ sysFileCRFDiag = Rsc('rfdg'); // Creator type for RF diagnostics app.
+ sysFileCMessaging = Rsc('msgs'); // Creator type for Messaging App
+ sysFileCModemFlashTool = Rsc('gsmf'); // Creator type for Palm V modem flash app.
+ sysFileCJEDict = Rsc('dict'); // Creator type for JEDict app.
+ sysFileHotSyncServer = Rsc('srvr'); // Creator type for HotSync(R) Server app.
+ sysFileHotSyncServerUpdate = Rsc('hssu'); // Creator type for HotSync(R) Server update app.
+
+ sysFileCCardInfo = Rsc('cinf'); // Creator type for the Card info app.
+ sysFileCPhone = Rsc('fone'); // Creator type for integrated phone components.
+ sysFileCSmsMessenger = Rsc('smsm'); // Creator type for SMS messenger app.
+ sysFileCNetTrace = Rsc('nett'); // Creator type for Net Trace StdIO app.
+ sysFileCPing = Rsc('ping'); // Creator type for Ping StdIO app.
+ sysFileCLanguagePicker = Rsc('lpkr'); // Creator type for Language Picker app.
+
+// The following apps are manufacturing, calibration and maintenance related
+ sysFileCMfgExtension = Rsc('mfx1'); // Creator type for Manufacturing Extension.
+ sysFileCMfgFunctional = Rsc('mfgf'); // Creator type for Manufacturing functional test autostart app.
+ sysFileCMfgCalibration = Rsc('mfgc'); // Creator type for Manufacturing radio calibration app.
+
+// Demo Apps
+ sysFileCGraffitiDemo = Rsc('gdem'); // Creator type for Graffiti Demo
+ sysFileCMailDemo = Rsc('mdem'); // Creator type for Mail Demo
+
+ sysFileCFirstApp = sysFileCPreferences; // Creator type for First App after reset
+ sysFileCAltFirstApp = sysFileCSetup; // Creator type for First alternate App after reset (with hard key pressed)
+ sysFileCDefaultApp = sysFileCPreferences; // Creator type for Default app
+ sysFileCDefaultButton1App = sysFileCDatebook; // Creator type for dflt hard button 1 app
+ sysFileCDefaultButton2App = sysFileCAddress; // Creator type for dflt hard button 2 app
+ sysFileCDefaultButton3App = sysFileCToDo; // Creator type for dflt hard button 3 app
+ sysFileCDefaultButton4App = sysFileCMemo; // Creator type for dflt hard button 4 app
+ sysFileCDefaultCalcButtonApp = sysFileCCalculator; // Creator type for dflt calc button app
+ sysFileCDefaultCradleApp = sysFileCSync; // Creator type for dflt hot sync button app
+ sysFileCDefaultModemApp = sysFileCSync; // Creator type for dflt modem button app
+ sysFileCDefaultAntennaButtonApp = sysFileCLauncher; // Creator type for dflt antenna up button app
+ sysFileCNullApp = Rsc('0000'); // Creator type for non-existing app
+ sysFileCSimulator = Rsc('????'); // Creator type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+ sysFileCDigitizer = Rsc('digi'); // Creator type for Digitizer Panel
+ sysFileCDateTime = Rsc('dttm'); // Creator type for Date & Time Panel
+ sysFileCGeneral = Rsc('gnrl'); // Creator type for General Panel
+ sysFileCFormats = Rsc('frmt'); // Creator type for Formats Panel
+ sysFileCShortCuts = Rsc('shct'); // Creator type for ShortCuts Panel
+ sysFileCButtons = Rsc('bttn'); // Creator type for Buttons Panel
+ sysFileCOwner = Rsc('ownr'); // Creator type for Owner Panel
+ sysFileCModemPanel = Rsc('modm'); // Creator type for Modem Panel
+ sysFileCDialPanel = Rsc('dial'); // Creator type for Dial Panel
+ sysFileCNetworkPanel = Rsc('netw'); // Creator type for Network Panel
+ sysFileCWirelessPanel = Rsc('wclp'); // Creator type for the wireless Panel.
+ sysFileCUserDict = Rsc('udic'); // Creator type for the UserDict panel.
+ sysFileCPADHtal = Rsc('hpad'); // Creator type for PAD HTAL lirary
+ sysFileCTCPHtal = Rsc('htcp'); // Creator type for TCP HTAL lirary
+ sysFileCRELHtal = Rsc('hrel'); // Creator type for REL HTAL library
+ sysFileCMineHunt = Rsc('mine'); // Creator type for MineHunt App
+ sysFileCPuzzle15 = Rsc('puzl'); // Creator type for Puzzle "15" App
+ sysFileCOpenLibInfo = Rsc('olbi'); // Creator type for Feature Manager features
+ // used for saving open library info under PalmOS v1.x
+ sysFileCHwrFlashMgr = Rsc('flsh'); // Creator type for HwrFlashMgr features
+ sysFileCPhonePanel = Rsc('phop'); // Creator type for Phone Panel
+
+// Added by BGT, 08/01/2000
+ sysFileDRAMFixOriginal = Rsc('mmfx'); // Creator type for 1.0 DRAM Fix
+ sysFileDRAMFix = Rsc('dmfx'); // Creator type for 1.0.3 DRAM Fix and later
+
+// 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.
+ sysFileTLibrary = Rsc('libr'); // File type of Shared Libraries
+ sysFileTLibraryExtension = Rsc('libx'); // File type of library extensions
+
+ sysFileCNet = Rsc('netl'); // Creator type for Net (TCP/IP) Library
+ sysFileCRmpLib = Rsc('netp'); // Creator type for RMP Library (NetLib plug-in)
+ sysFileCINetLib = Rsc('inet'); // Creator type for INet Library
+ sysFileCSecLib = Rsc('secl'); // Creator type for Ir Library
+ sysFileCWebLib = Rsc('webl'); // Creator type for Web Library
+ sysFileCIrLib = Rsc('irda'); // Creator type for Ir Library
+
+ sysFileCBtLib = Rsc('blth'); // Creator type for Bt Library
+ sysFileCBtTransLib = Rsc('bttx'); // Creator for the Bt HCI Transport library
+ sysFileCLocalLib = Rsc('locl'); // Creator type for Local exchange library
+ sysFileCLz77Lib = Rsc('lz77'); // Creator type for LZ77 Library (Registered)
+ sysFileCSmsLib = Rsc('smsl'); // Creator type for SMS Library
+ sysFileCBtExgLib = Rsc('btex'); // Creator type for Bluetooth Exchange Library
+ sysFileCPdiLib = Rsc('pdil'); // Creator type for PDI Library
+ sysFileCTelMgrLib = Rsc('tmgr'); // Creator type for Telephony Manager Library
+ sysFileCTelTaskSerial = Rsc('spht'); // Creator type for Serial Telephony Task
+ sysFileTTelTaskSerial = Rsc('ttsk'); // File type for Serial Telephony Task
+ sysFileCBaseATDriver = Rsc('patd'); // Creator type for the Base AT Driver
+ sysFileTBaseATDriver = Rsc('patd'); // File type for the Base AT Driver (same as Creator)
+ sysFileCStandardGsm = Rsc('stgd'); // Creator type for the Standard GSM Driver
+ sysFileTPhoneDriver = Rsc('pdrv'); // File type for Phone Drivers of Telephony Task
+
+ sysFileCSerialMgr = Rsc('smgr'); // Creator for SerialMgrNew used for features.
+ sysFileCSerialWrapper = Rsc('swrp'); // Creator type for Serial Wrapper Library.
+ sysFileCIrSerialWrapper = Rsc('iwrp'); // Creator type for Ir Serial Wrapper Library.
+ sysFileCTextServices = Rsc('tsml'); // Creator type for Text Services Library.
+
+ sysFileTUartPlugIn = Rsc('sdrv'); // File type for SerialMgrNew physical port plug-in.
+ sysFileTVirtPlugin = Rsc('vdrv'); // Flir type for SerialMgrNew virtual port plug-in.
+ sysFileCUart328 = Rsc('u328'); // Creator type for '328 UART plug-in
+ sysFileCUart328EZ = Rsc('u8EZ'); // Creator type for '328EZ UART plug-in
+ sysFileCUart650 = Rsc('u650'); // Creator type for '650 UART plug-in
+ sysFileCVirtIrComm = Rsc('ircm'); // Creator type for IrComm virtual port plug-in.
+
+ sysFileCVirtRfComm = Rsc('rfcm'); // Creator type for RfComm (Bluetooth) virtual port plug-in.
+ sysFileCBtConnectPanelHelper = Rsc('btcp'); // Creator type for the Bt Connection Panel helper app.
+ sysFileCPDIUSBD12 = Rsc('pusb'); // Creator type for USB database
+ sysPortUSBDesktop = Rsc('usbd'); // Creator type for USB Desktop
+ sysPortUSBConsole = Rsc('usbc'); // Creator type for USB Console
+ sysPortUSBPeripheral = Rsc('usbp'); // Creator type for USB Peripheral
+ sysFileCsyscallConnector = Rsc('econ'); // Creator type for the syscall connector
+ sysFileCExpansionMgr = Rsc('expn'); // Creator of Expansion Manager extension database
+ sysFileCVFSMgr = Rsc('vfsm'); // Creator code for VFSMgr...
+ sysFileCFATFS = Rsc('tatf'); // Creator type for FAT filesystem library
+ sysFileCSdSpiCard = Rsc('sdsd'); // Creator type for Slot Driver: SD bus, SPI mode, memory cards
+ sysFileCSlotDriverPnps = Rsc('pnps'); // Creator ID for Pnps Serial Peripheral Slot Driver
+
+ sysFileTSystem = Rsc('rsrc'); // File type for Main System File
+ sysFileTSystemPatch = Rsc('ptch'); // File type for System resource file patches
+ sysFileTKernel = Rsc('krnl'); // File type for System Kernel (AMX)
+ sysFileTBoot = Rsc('boot'); // File type for SmallROM System File
+ sysFileTSmallHal = Rsc('shal'); // File type for SmallROM HAL File
+ sysFileTBigHal = Rsc('bhal'); // File type for Main ROM HAL File
+ sysFileTSplash = Rsc('spls'); // File type for Main ROM Splash File
+ sysFileTUIAppShell = Rsc('uish'); // File type for UI Application Shell
+ sysFileTOverlay = Rsc('ovly'); // File type for UI overlay database
+ sysFileTExtension = Rsc('extn'); // File type for System Extensions
+ sysFileTApplication = Rsc('appl'); // File type for applications
+ sysFileTPanel = Rsc('panl'); // File type for preference panels
+ sysFileTSavedPreferences = Rsc('sprf'); // File type for saved preferences
+ sysFileTPreferences = Rsc('pref'); // File type for preferences
+ sysFileTMidi = Rsc('smfr'); // File type for Standard MIDI File record databases
+ sysFileTpqa = Rsc('pqa '); // File type for the PQA files.
+ sysFileTLocaleModule = Rsc('locm'); // File type for locale modules.
+ sysFileTActivationPlugin = Rsc('actp'); // File type for activation plug-ins.
+
+ sysFileTUserDictionary = Rsc('dict'); // File type for input method user dictionary.
+ sysFileTLearningData = Rsc('lean'); // File type for input method learning data.
+
+ sysFileTGraffitiMacros = Rsc('macr'); // Graffiti Macros database
+
+ sysFileTHtalLib = Rsc('htal'); // HTAL library
+
+ sysFileTExgLib = Rsc('exgl'); // Type of Exchange libraries
+
+ sysFileTSlotDriver = Rsc('libs'); // File type for slot driver libraries
+ sysFileTFileSystem = Rsc('libf'); // File type for file system libraries
+
+ sysFileTFileStream = Rsc('strm'); // Default File Stream database type
+
+ sysFileTTemp = Rsc('temp'); // Temporary database type; as of Palm OS 4.0, the
+ // system WILL automatically delete any db's of
+ // before exiting to protect valuable storage space)
+// Begin Change - BGT 03/21/2000
+
+ sysFileTNetworkPanelPlugin = Rsc('nppi'); // File type for network preference panel plug-ins
+
+// End Change - BGT 03/21/2000
+
+ sysFileTScriptPlugin = Rsc('scpt'); // File type for plugin to the Network Panel to
+ // extend scripting capabilities.
+ sysFileTStdIO = Rsc('sdio'); // File type for standard IO apps
+
+ sysFileTSimulator = Rsc('????'); // File type for Simulator files (app.tres, sys.tres)
+ // '????' does not compile with VC++ (Elaine Server)
+
+//................................................................
+// Resource types and IDs
+//................................................................
+ sysResTBootCode = Rsc('boot'); // Resource type of boot resources
+ sysResIDBootReset = 10000; // Reset code
+ sysResIDBootInitCode = 10001; // Init code
+ sysResIDBootSysCodeStart = 10100; // System code resources start here
+ sysResIDBootSysCodeMin = 10102; // IDs 'Start' to this must exist!!
+ sysResIDBootUICodeStart = 10200; // UI code resources start here
+ sysResIDBootUICodeMin = 10203; // IDs 'Start' to this must exist!!
+
+ sysResIDBootHAL = 19000; // HAL initial code resource (from HAL.prc)
+ sysResIDBootHALCodeStart = 19100; // start of additional high-level HAL code resources
+
+ sysResIDBitmapSplash = 19000; // ID of (boot) splash screen bitmap
+ sysResIDBitmapConfirm = 19001; // ID of hard reset confirmation bitmap
+
+ sysResTAppPrefs = Rsc('pref'); // Resource type of App preferences resources
+ sysResIDAppPrefs = 0; // Application preference
+
+ sysResTExtPrefs = Rsc('xprf'); // Resource type of extended preferences
+ sysResIDExtPrefs = 0; // Extended preferences
+
+ sysResTAppCode = Rsc('code'); // Resource type of App code resources
+ sysResTAppGData = Rsc('data'); // Resource type of App global data resources
+
+ sysResTExtensionCode = Rsc('extn'); // Resource type of Extensions code
+ sysResTExtensionOEMCode = Rsc('exte'); // Resource type of OEM Extensions code
+
+ sysResTFeatures = Rsc('feat'); // Resource type of System features table
+ sysResIDFeatures = 10000; // Resource ID of System features table
+ sysResIDOverlayFeatures = 10001; // Resource ID of system overlay feature table.
+
+ sysResTLibrary = Rsc('libr'); // Resource type of System Libraries
+// sysResIDLibrarySerMgr328 = 10000; // Dragonball (68328) UART
+// sysResIDLibrarySerMgr681 = 10001; // 68681 UART
+// sysResIDLibraryRMPPlugIn = 10002; // Reliable Message Protocol NetLib Plug-in
+
+ sysResTSilkscreen = Rsc('silk'); // Resource type of silkscreen info.
+
+ sysResTGrfTemplate = Rsc('tmpl'); // Graffiti templates "file"
+ sysResIDGrfTemplate = 10000; // Graffiti templates "file" ID
+ sysResTGrfDictionary = Rsc('dict'); // Graffiti dictionary "file"
+ sysResIDGrfDictionary = 10000; // Graffiti dictionary "file" ID
+ sysResIDGrfDefaultMacros = 10000; // sysResTDefaultDB resource with Graffiti Macros database
+
+ sysResTDefaultDB = Rsc('dflt'); // Default database resource type
+ sysResIDDefaultDB = 1; // resource ID of sysResTDefaultDB in each app
+ sysResTCompressedDB = Rsc('cpdb'); // Compressed database resource type
+ sysResIDCompressedDB = 10000; // resource ID of first sysResTCompressedDB
+
+ sysResTErrStrings = Rsc('tSTL'); // list of error strings
+ sysResIDErrStrings = 10000; // resource ID is (errno>>8)+sysResIDErrStrings
+
+ sysResIDOEMDBVersion = 20001; // resource ID of "tver" and "tint" versions in OEM stamped databases
+
+ sysResTButtonDefaults = Rsc('hsbd'); // Hard/soft button default apps
+ sysResIDButtonDefaults = 10000; // resource ID of system button defaults resource
+
+// System Preferences
+ sysResTSysPref = sysFileCSystem;
+ sysResIDSysPrefMain = 0; // Main preferences
+ sysResIDSysPrefPassword = 1; // Password
+ sysResIDSysPrefFindStr = 2; // Find string
+ sysResIDSysPrefCalibration = 3; // Digitizer calibration.
+ sysResIDDlkUserInfo = 4; // Desktop Link user information.
+ sysResIDDlkLocalPC = 5; // Desktop Link local PC host name
+ sysResIDDlkCondFilterTab = 6; // Desktop Link conduit filter table
+ sysResIDModemMgrPref = 7; // Modem Manager preferences
+ sysResIDDlkLocalPCAddr = 8; // Desktop Link local PC host address
+ sysResIDDlkLocalPCMask = 9; // Desktop Link local PC host subnet mask
+
+// These prefs store parameters to pass to an app when launched with a button
+ sysResIDButton1Param = 10; // Parameter for hard button 1 app
+ sysResIDButton2Param = 11; // Parameter for hard button 2 app
+ sysResIDButton3Param = 12; // Parameter for hard button 3 app
+ sysResIDButton4Param = 13; // Parameter for hard button 4 app
+ sysResIDCalcButtonParam = 14; // Parameter for calc button app
+ sysResIDCradleParam = 15; // Parameter for hot sync button app
+ sysResIDModemParam = 16; // Parameter for modem button app
+ sysResIDAntennaButtonParam = 17; // Parameter for antenna up button app
+
+// New for Color, user's color preferences
+ sysResIDPrefUIColorTableBase = 17; // base + depth = ID of actual pref
+ sysResIDPrefUIColorTable1 = 18; // User's UI colors for 1bpp displays
+ sysResIDPrefUIColorTable2 = 19; // User's UI colors for 2bpp displays
+ sysResIDPrefUIColorTable4 = 21; // User's UI colors for 4bpp displays
+ sysResIDPrefUIColorTable8 = 25; // User's UI colors for 8bpp displays
+ sysResIDSysPrefPasswordHint = 26; // Password hint
+ sysResIDSysPrefPasswordHash = 27; // Password hash (MD5)
+
+// FlashMgr Resources - old
+ sysResTFlashMgr = Rsc('flsh');
+ sysResIDFlashMgrWorkspace = 1; // RAM workspace during flash activity
+
+// FlashMgr Resources - new
+ sysResTHwrFlashIdent = Rsc('flid'); // Flash identification code resource
+ sysResIDHwrFlashIdent = 10000; // Flash identification code resource
+
+ sysResTHwrFlashCode = Rsc('flcd'); // Flash programming code resource
+ // (resource ID determined by device type)
+// FontMgr Resources
+ sysResTFontMap = Rsc('fntm'); // Font map resource
+
+// OEM Feature type and id.
+ sysFtrTOEMSys = sysFileCOEMSystem;
+ sysFtrIDOEMSysHideBatteryGauge = 1;
+
+// Onscreen keyboard features
+ sysFtrTKeyboard = Rsc('keyb');
+ sysFtrIDKeyboardActive = 1; // Boolean value, true => keyboard is active.
+ // Currently only used for Japanese.
+
+// Activation status values.
+ sysActivateStatusFeatureIndex = 1;
+ sysActivateNeedGeorgeQuery = 0;
+ sysActivateNeedMortyQuery = 1;
+ sysActivateFullyActivated = 2;
+
+ sysMaxUserDomainNameLength = 64;
+
+// Current clipper feature indeces
+ sysClipperPQACardNoIndex = 1;
+ 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.
+//
+//-----------------------------------------------------------
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/sysutil.pp b/packages/palmunits/src/sysutil.pp
new file mode 100644
index 0000000000..ab4cbe51d0
--- /dev/null
+++ b/packages/palmunits/src/sysutil.pp
@@ -0,0 +1,92 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: SysUtils.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * These are miscellaneous routines.
+ *
+ * History:
+ * April 27, 1995 Created by Roger Flores
+ *
+ *****************************************************************************)
+
+unit sysutil;
+
+interface
+
+uses palmos, coretraps;
+
+//typedef Int16 _comparF (const void *, const void *, Int16 other);
+type
+ _comparF = function(p1, p2: Pointer; other: Int32): Int16;
+ CmpFuncPtr = _comparF;
+
+
+ _searchF = function(const searchData, arrayData: Pointer; other: Int32): Int16;
+ SearchFuncPtr = _searchF;
+
+// For backwards compatibility
+//const
+// GremlinIsOn = hostSelectorGremlinIsRunning;
+
+(************************************************************
+ * Constants
+ *************************************************************)
+
+const
+ sysRandomMax = $7FFF; // Max value returned from SysRandom()
+
+(************************************************************
+ * Macros
+ *************************************************************)
+
+// Abs(a) (((a) >= 0) ? (a) : -(a))
+
+(************************************************************
+ * procedures
+ *************************************************************)
+
+function SysBinarySearch(const baseP: Pointer; numOfElements, width: Int16;
+ searchF: SearchFuncPtr; const searchData: Pointer;
+ other: Int32; var position: Int32; findFirst: Boolean): Boolean; syscall sysTrapSysBinarySearch;
+
+procedure SysInsertionSort(baseP: Pointer; numOfElements, width: Int16;
+ comparF: CmpFuncPtr; other: Int32); syscall sysTrapSysInsertionSort;
+
+procedure SysQSort(baseP: Pointer; numOfElements, width: Int16;
+ comparF: CmpFuncPtr; other: Int32); syscall sysTrapSysQSort;
+
+procedure SysCopyStringResource(string_: PChar; theID: Int16); syscall sysTrapSysCopyStringResource;
+
+function SysFormPointerArrayToStrings(c: PChar; stringCount: Int16): MemHandle; syscall sysTrapSysFormPointerArrayToStrings;
+
+
+// Return a random number ranging from 0 to sysRandomMax.
+// Normally, 0 is passed unless you want to start with a new seed.
+function SysRandom(newSeed: Int32): Int16; syscall sysTrapSysRandom;
+
+
+function SysStringByIndex(resID, index: UInt16; strP: PChar; maxLen: UInt16): PChar; syscall sysTrapSysStringByIndex;
+
+function SysErrString(err: Err; strP: PChar; maxLen: UInt16): PChar; syscall sysTrapSysErrString;
+
+// This function is not to be called directly. Instead, use the various Emu* calls
+// in EmuTraps.h because they work for Poser, the device, and the simulator, and
+// they are safer because of the type checking.
+//!!!function HostControl(selector: HostControlTrapNumber, ...): UInt32; syscall sysTrapHostControl;
+
+// For backwards compatibility
+//const
+// SysGremlins = HostControl;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/table.pp b/packages/palmunits/src/table.pp
new file mode 100644
index 0000000000..d4ee7f89ff
--- /dev/null
+++ b/packages/palmunits/src/table.pp
@@ -0,0 +1,279 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Table.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines table structures and routines.
+ *
+ * History:
+ * September 1, 1994 Created by Art Lamb
+ *
+ *****************************************************************************)
+
+unit table;
+
+interface
+
+uses palmos, coretraps, rect, font, field, control;
+
+//-------------------------------------------------------------------
+// Table structures
+//-------------------------------------------------------------------
+
+const
+ tableDefaultColumnSpacing = 1;
+ tableNoteIndicatorWidth = 7;
+ tableNoteIndicatorHeight = 11;
+ tableMaxTextItemSize = 255; // does not incude terminating null
+
+ tblUnusableRow = $ffff;
+
+// Display style of a table item
+//
+type
+ tableItemStyles = Enum;
+
+const
+ checkboxTableItem = 0;
+ customTableItem = Succ(checkboxTableItem);
+ dateTableItem = Succ(customTableItem);
+ labelTableItem = Succ(dateTableItem);
+ numericTableItem = Succ(labelTableItem);
+ popupTriggerTableItem = Succ(numericTableItem);
+ textTableItem = Succ(popupTriggerTableItem);
+ textWithNoteTableItem = Succ(textTableItem);
+ timeTableItem = Succ(textWithNoteTableItem);
+ narrowTextTableItem = Succ(timeTableItem);
+ tallCustomTableItem = Succ(narrowTextTableItem);
+
+
+type
+ TableItemStyleType = tableItemStyles;
+
+ TableItemType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
+ itemType: TableItemStyleType;
+ fontID: FontID; // font for drawing text
+ intValue: Int16;
+ ptr: PChar;
+ {$endif}
+ end;
+ TableItemTag = TableItemType;
+ TableItemPtr = ^TableItemType;
+
+// Draw item callback routine prototype, used only by customTableItem.
+ TableDrawItemFuncType = procedure(tableP: Pointer; row, column: Int16; var bounds: RectangleType);
+
+ TableDrawItemFuncPtr = TableDrawItemFuncType;
+
+// Load data callback routine prototype
+ TableLoadDataFuncType = function(tableP: Pointer; row, column: Int16; editable: Boolean;
+ var dataH: MemHandle; var dataOffset, dataSize: Int16; fld: FieldPtr): Err;
+
+ TableLoadDataFuncPtr = TableLoadDataFuncType;
+
+// Save data callback routine prototype
+ TableSaveDataFuncType = function(tableP: Pointer; row, column: Int16): Boolean;
+
+ TableSaveDataFuncPtr = TableSaveDataFuncType;
+
+ TableColumnAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
+ width: Coord; // width in pixels
+ Bits: UInt16;
+{
+ UInt16 reserved1 : 5;
+ UInt16 masked : 1; // if both row + column masked, draw only grey box
+ UInt16 editIndicator : 1;
+ UInt16 usable : 1;
+ UInt16 reserved2 : 8;
+}
+ spacing: Coord; // space after column
+ drawCallback: TableDrawItemFuncPtr;
+ loadDataCallback: TableLoadDataFuncPtr;
+ saveDataCallback: TableSaveDataFuncPtr;
+ {$endif}
+ end;
+ TableColumnAttrTag = TableColumnAttrType;
+
+ TableRowAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
+ id: UInt16;
+ height: Coord; // row height in pixels
+ data: UInt32;
+ Bits: UInt16;
+{
+ UInt16 reserved1 : 7;
+ UInt16 usable : 1;
+ UInt16 reserved2 : 4;
+ UInt16 masked : 1; // if both row + column masked, draw only grey box
+ UInt16 invalid : 1; // true if redraw needed
+ UInt16 staticHeight : 1; // Set if height does not expands as text is entered
+ UInt16 selectable : 1;
+ }
+ reserved3: UInt16;
+ {$endif}
+ end;
+ TableRowAttrTag = TableRowAttrType;
+
+ TableAttrType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ UInt16 visible:1; // Set if drawn, used internally
+ UInt16 editable:1; // Set if editable
+ UInt16 editing:1; // Set if in edit mode
+ UInt16 selected:1; // Set if the current item is selected
+ UInt16 hasScrollBar:1; // Set if the table has a scroll bar
+ UInt16 usable:1; // Set if in table is visible in the current form
+ UInt16 reserved:10;
+}
+ {$endif}
+ end;
+ TableAttrTag = TableAttrType;
+
+ TableType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_TABLES} // These fields will not be available in the next OS release!
+ id: UInt16;
+ bounds: RectangleType;
+ attr: TableAttrType;
+ numColumns: Int16;
+ numRows: Int16;
+ currentRow: Int16;
+ currentColumn: Int16;
+ topRow: Int16;
+ columnAttrs: ^TableColumnAttrType;
+ rowAttrs: ^TableRowAttrType;
+ items: TableItemPtr;
+ currentField: FieldType;
+ {$endif}
+ end;
+
+ TablePtr = ^TableType;
+
+//-------------------------------------------------------------------
+// Table routines
+//-------------------------------------------------------------------
+
+procedure TblDrawTable(tableP: TablePtr); syscall sysTrapTblDrawTable;
+
+procedure TblRedrawTable(tableP: TablePtr); syscall sysTrapTblRedrawTable;
+
+procedure TblEraseTable(tableP: TablePtr); syscall sysTrapTblEraseTable;
+
+function TblHandleEvent(tableP: TablePtr; event: EventPtr): Boolean; syscall sysTrapTblHandleEvent;
+
+procedure TblGetItemBounds(const tableP: TablePtr; row, column: Int16; var rP: RectangleType); syscall sysTrapTblGetItemBounds;
+
+procedure TblSelectItem(tableP: TablePtr; row, column: Int16); syscall sysTrapTblSelectItem;
+
+function TblGetItemInt(const tableP: TablePtr; row, column: Int16): Int16; syscall sysTrapTblGetItemInt;
+
+procedure TblSetItemInt(tableP: TablePtr; row, column, value: Int16); syscall sysTrapTblSetItemInt;
+
+procedure TblSetItemPtr(tableP: TablePtr; row, column: Int16; value: Pointer); syscall sysTrapTblSetItemPtr;
+
+procedure TblSetItemStyle(tableP: TablePtr; row, column: Int16; type_: TableItemStyleType); syscall sysTrapTblSetItemStyle;
+
+procedure TblUnhighlightSelection(tableP: TablePtr); syscall sysTrapTblUnhighlightSelection;
+
+function TblRowUsable(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowUsable;
+
+procedure TblSetRowUsable(tableP: TablePtr; row: Int16; usable: Boolean); syscall sysTrapTblSetRowUsable;
+
+function TblGetLastUsableRow(const tableP: TablePtr): Int16; syscall sysTrapTblGetLastUsableRow;
+
+procedure TblSetColumnUsable(tableP: TablePtr; column: Int16; usable: Boolean); syscall sysTrapTblSetColumnUsable;
+
+procedure TblSetRowSelectable(tableP: TablePtr; row: Int16; selectable: Boolean); syscall sysTrapTblSetRowSelectable;
+
+function TblRowSelectable(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowSelectable;
+
+function TblGetNumberOfRows(const tableP: TablePtr): Int16; syscall sysTrapTblGetNumberOfRows;
+
+procedure TblSetCustomDrawProcedure(tableP: TablePtr; column: Int16; drawCallback: TableDrawItemFuncPtr); syscall sysTrapTblSetCustomDrawProcedure;
+
+procedure TblSetLoadDataProcedure(tableP: TablePtr; column: Int16; loadDataCallback: TableLoadDataFuncPtr); syscall sysTrapTblSetLoadDataProcedure;
+
+procedure TblSetSaveDataProcedure(tableP: TablePtr; column: Int16; saveDataCallback: TableSaveDataFuncPtr); syscall sysTrapTblSetSaveDataProcedure;
+
+procedure TblGetBounds(const tableP: TablePtr; var rP: RectangleType); syscall sysTrapTblGetBounds;
+
+procedure TblSetBounds(tableP: TablePtr; {const} var rP: RectangleType); syscall sysTrapTblSetBounds;
+
+function TblGetRowHeight(const tableP: TablePtr; row: Int16): Coord; syscall sysTrapTblGetRowHeight;
+
+procedure TblSetRowHeight(tableP: TablePtr; row: Int16; height: Coord); syscall sysTrapTblSetRowHeight;
+
+function TblGetColumnWidth(const tableP: TablePtr; column: Int16): Coord; syscall sysTrapTblGetColumnWidth;
+
+procedure TblSetColumnWidth(tableP: TablePtr; column: Int16; width: Coord); syscall sysTrapTblSetColumnWidth;
+
+function TblGetColumnSpacing(const tableP: TablePtr; column: Int16): Coord; syscall sysTrapTblGetColumnSpacing;
+
+procedure TblSetColumnSpacing(tableP: TablePtr; column: Int16; spacing: Coord); syscall sysTrapTblSetColumnSpacing;
+
+function TblFindRowID(const tableP: TablePtr; id: UInt16; var rowP: Int16): Boolean; syscall sysTrapTblFindRowID;
+
+function TblFindRowData(const tableP: TablePtr; data: UInt32; var rowP: Int16): Boolean; syscall sysTrapTblFindRowData;
+
+function TblGetRowID(const tableP: TablePtr; row: Int16): UInt16; syscall sysTrapTblGetRowID;
+
+procedure TblSetRowID(tableP: TablePtr; row, id: Int16); syscall sysTrapTblSetRowID;
+
+function TblGetRowData(const tableP: TablePtr; row: Int16): UInt32; syscall sysTrapTblGetRowData;
+
+procedure TblSetRowData(tableP: TablePtr; row: Int16; data: UInt32); syscall sysTrapTblSetRowData;
+
+function TblRowInvalid(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowInvalid;
+
+procedure TblMarkRowInvalid(tableP: TablePtr; row: Int16); syscall sysTrapTblMarkRowInvalid;
+
+procedure TblMarkTableInvalid(tableP: TablePtr); syscall sysTrapTblMarkTableInvalid;
+
+function TblGetSelection(const tableP: TablePtr; var rowP, columnP: Int16): Boolean; syscall sysTrapTblGetSelection;
+
+procedure TblInsertRow(tableP: TablePtr; row: Int16); syscall sysTrapTblInsertRow;
+
+procedure TblRemoveRow(tableP: TablePtr; row: Int16); syscall sysTrapTblRemoveRow;
+
+procedure TblReleaseFocus(tableP: TablePtr); syscall sysTrapTblReleaseFocus;
+
+function TblEditing(const tableP: TablePtr): Boolean; syscall sysTrapTblEditing;
+
+function TblGetCurrentField(const tableP: TablePtr): FieldPtr; syscall sysTrapTblGetCurrentField;
+
+procedure TblGrabFocus(tableP: TablePtr; row, column: Int16); syscall sysTrapTblGrabFocus;
+
+procedure TblSetColumnEditIndicator(tableP: TablePtr; column: Int16; editIndicator: Boolean); syscall sysTrapTblSetColumnEditIndicator;
+
+procedure TblSetRowStaticHeight(tableP: TablePtr; row: Int16; staticHeight: Boolean); syscall sysTrapTblSetRowStaticHeight;
+
+procedure TblHasScrollBar(tableP: TablePtr; hasScrollBar: Boolean); syscall sysTrapTblHasScrollBar;
+
+function TblGetItemFont(const tableP: TablePtr; row, column: Int16): FontID; syscall sysTrapTblGetItemFont;
+
+procedure TblSetItemFont(tableP: TablePtr; row, column: Int16; fontID: FontID); syscall sysTrapTblSetItemFont;
+
+function TblGetItemPtr(const tableP: TablePtr; row, column: Int16): Pointer; syscall sysTrapTblGetItemPtr;
+
+function TblRowMasked(const tableP: TablePtr; row: Int16): Boolean; syscall sysTrapTblRowMasked;
+
+procedure TblSetRowMasked(tableP: TablePtr; row: Int16; masked: Boolean); syscall sysTrapTblSetRowMasked;
+
+procedure TblSetColumnMasked(tableP: TablePtr; column: Int16; masked: Boolean); syscall sysTrapTblSetColumnMasked;
+
+function TblGetNumberOfColumns(const tableP: TablePtr): Int16; syscall sysTrapTblGetNumberOfColumns;
+
+function TblGetTopRow(const tableP: TablePtr): Int16; syscall sysTrapTblGetTopRow;
+
+procedure TblSetSelection(tableP: TablePtr; row, column: Int16); syscall sysTrapTblSetSelection;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/telephonymgr.pp b/packages/palmunits/src/telephonymgr.pp
new file mode 100644
index 0000000000..38369515b3
--- /dev/null
+++ b/packages/palmunits/src/telephonymgr.pp
@@ -0,0 +1,1199 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TelephonyMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This is the header file for the Telephony Manager
+ * for Palm OS Wireless Telephony Add-on.
+ * It defines the Telephony Manager public functions.
+ *
+ * History:
+ * Created by Gilles Fabre
+ * 08/05/99 gfa Initial version.
+ * 05/02/00 gfa Shared lib, 2nd API version.
+ *
+ *****************************************************************************)
+
+unit telephonymgr;
+
+interface
+
+uses palmos, libtraps, errorbase, systemresources, event_, systemmgr, telephonymgrtypes;
+
+// sysMakeROMVersion(major, minor, fix, stage, buildNum)
+const
+ kTelMgrVersionMajor = 1;
+ kTelMgrVersionMinor = 0;
+ kTelMgrVersionFix = 3;
+ kTelMgrVersionBuild = 0;
+
+function kTelMgrVersion(major, minor, fix, stage: UInt8; buildNum: UInt16): UInt32;
+
+const
+// TelMgr shared lib internal name
+ kTelMgrLibName = 'Telephony Library';
+
+// TelMgr shared lib name and creator
+ kTelMgrDatabaseCreator = sysFileCTelMgrLib;
+ kTelMgrDatabaseType = sysFileTLibrary;
+
+ kTelTelephonyNotification = Rsc('tmgr'); // telephony notification
+ kTelTelephonyEvent = $1200; // telephony event
+
+// Telephony notification IDs
+ kTelSmsLaunchCmdIncomingMessage = 0; // an incoming SMS
+ kTelSpcLaunchCmdIncomingCall = Succ(kTelSmsLaunchCmdIncomingMessage); // an incoming voice call
+ kTelSpcLaunchCmdCallerIDAvailable = Succ(kTelSpcLaunchCmdIncomingCall); // the caller ID is available
+ kTelSpcLaunchCmdCallReleased = Succ(kTelSpcLaunchCmdCallerIDAvailable); // the call has been released
+ kTelSpcLaunchCmdCallBusy = Succ(kTelSpcLaunchCmdCallReleased); // the called equipment is busy
+ kTelSpcLaunchCmdCallConnect = Succ(kTelSpcLaunchCmdCallBusy); // the line is opened
+ kTelSpcLaunchCmdCallError = Succ(kTelSpcLaunchCmdCallConnect); // the call has encountered an error
+ kTelEmcLaunchCmdCallReleased = Succ(kTelSpcLaunchCmdCallError); // the call has been released
+ kTelEmcLaunchCmdCallBusy = Succ(kTelEmcLaunchCmdCallReleased); // the called equipment is busy
+ kTelEmcLaunchCmdCallConnect = Succ(kTelEmcLaunchCmdCallBusy); // the line is opened
+ kTelEmcLaunchCmdCallError = Succ(kTelEmcLaunchCmdCallConnect); // the call has encountered an error
+ kTelLastLaunchCode = Succ(kTelEmcLaunchCmdCallError);
+
+// notification priorities
+ kTelCallNotificationPriority = 0; // higher priority
+ kTelSmsNotificationPriority = 1;
+
+// error codes
+ telErrMsgAllocation = telErrorClass or $01; // couldn't allocate message
+ telErrUnknown = telErrorClass or $02; // unknown Tel internal error
+ telErrMemAllocation = telErrorClass or $03; // memory allocation error
+
+ telErrResultTimeOut = telErrorClass or $04; // time-out was reached
+ telErrResultUserCancel = telErrorClass or $05; // user cancelled action
+ telErrResultBusyResource = telErrorClass or $06; // resource is busy
+ telErrInvalidAppId = telErrorClass or $07; // don't know that application
+ telErrTooManyApps = telErrorClass or $08; // applications table is full
+ telErrSecurity = telErrorClass or $09; // access to ME has not been granted
+ telErrBufferSize = telErrorClass or $0A; // buffer used to retrieve data is too small
+ telErrFeatureNotSupported = telErrorClass or $0B; // the feature is not supported by phone/network
+
+ telErrPhoneComm = telErrorClass or $0C; // the communication link with the phone is down
+ telErrPhoneReply = telErrorClass or $0D; // the phone reply syntax is incorrect, check the phone driver!
+ telErrCommandFailed = telErrorClass or $0E; // the phone couldn't achieve the associated command, check the phone driver!
+
+ telErrSpcLineIsBusy = telErrorClass or $0F; // spc call failure events, error field values
+
+ telErrPhoneCodeRequired = telErrorClass or $10; // phone code required
+ telErrNoSIMInserted = telErrorClass or $11; // no SIM inserted
+ telErrPINRequired = telErrorClass or $12; // PIN is required
+ telErrPUKRequired = telErrorClass or $13; // PUK is required
+ telErrSIMFailure = telErrorClass or $14; // the SIM is not working properly
+ telErrSIMBusy = telErrorClass or $15; // the SIM couldn't reply
+ telErrSIMWrong = telErrorClass or $16; // the SIM is not accepted by the phone
+ telErrPassword = telErrorClass or $17; // incorrect password
+ telErrPIN2Required = telErrorClass or $18; // PIN2 is required
+ telErrPUK2Required = telErrorClass or $19; // PUK2 is required
+ telErrPhoneMemAllocation = telErrorClass or $1A; // phone memory is full
+ telErrInvalidIndex = telErrorClass or $1B; // invalid index when accessing a storage
+ telErrEntryNotFound = telErrorClass or $1C; // entry not found
+ telErrPhoneMemFailure = telErrorClass or $1D; // the phone encountered a memory error
+ telErrInvalidString = telErrorClass or $1E; // bad character in text string
+ telErrInvalidDial = telErrorClass or $1F; // bad character in dial string
+ telErrNoNetwork = telErrorClass or $20; // no network available
+ telErrNetworkTimeOut = telErrorClass or $21; // the network didn't reply within 'normal' time delay
+ telErrInvalidParameter = telErrorClass or $22; // bad parameter passed to an API
+ telErrValidityPeriod = telErrorClass or $23; // the specified short message validity period is invalid
+ telErrCodingScheme = telErrorClass or $24; // the specified short message coding scheme is invalid
+ telErrPhoneNumber = telErrorClass or $25; // the specified short message smsc or destination phone number is invalid
+ telErrValueStale = telErrorClass or $26; // information couldn't be retrieved, a copy of last retrieved value was returned
+ telErrTTaskNotRunning = telErrorClass or $27; // the Telephony Task is not running
+ telErrPhoneToSIMPINRequired = telErrorClass or $28; // Phone 2 SIM PIN is required
+
+ telErrSpecificDrvNotFound = telErrorClass or $29; // the specified driver was not found
+ telErrGenericDrvNotFound = telErrorClass or $2A; // the generic driver was not found
+ telErrNoSpecificDrv = telErrorClass or $2B; // no specific driver was specified
+
+ telErrSpcLineIsReleased = telErrorClass or $2C; // the call has been released
+ telErrSpcCallError = telErrorClass or $2D; // the call has encountered an error
+
+ telErrNotInstalled = telErrorClass or $2E; // the shared lib couldn't be installed
+ telErrVersion = telErrorClass or $2F; // the shared lib version doesn't match the application one
+ telErrSettings = telErrorClass or $30; // bad telephony settings: Phone Panel Prefs doesn't exist or Telephony Profile not (correctly) set
+
+ telErrUnavailableValue = telErrorClass or $31; // the asked value can't be retrieved at that time (i.e.: TelSpcGetCallerNumber and no active line)
+
+ telErrLimitedCompatibility = telErrorClass or $32; // the current driver is partially compatible with the connected phone
+
+ telErrProfileConflict = telErrorClass or $33; // the currently used profile conflicts with the requested profile
+
+ telErrLibStillInUse = telErrorClass or $34; // the shared lib is currently being used by another app, don't unload it!
+
+ telErrTTaskNotFound = telErrorClass or $35; // couldn't find the specified (by phone driver) telephony task
+
+// constants
+ kTelInvalidAppId = TelAppID(-1); // this value can't be returned on TelMgr attachement
+
+ kTelInfiniteDelay = $FFFFFFFF; // infinite time-out delay
+
+ kTelLocationSeparator = ';'; // this symbol is used to separate location string tokens
+
+ kTelNwkAutomaticSearch = 0; // network search mode
+ kTelNwkManualSearch = 1;
+
+ kTelNwkCDMA = 0; // network type
+ kTelNwkGSM = 1;
+ kTelNwkTDMA = 2;
+ kTelNwkPDC = 3;
+
+ kTelPowBatteryPowered = 0; // battery status
+ kTelPowBatteryNotPowered = 1;
+ kTelPowNoBattery = 2;
+ kTelPowBatteryFault = 3;
+
+ kTelSpcCallingLineId = -1; // ID of a calling line. We can't provide a real ID knowing that an error might occur after
+ //TelSpcCallNumber return... So use this one to 'close' the line
+// Messages types
+ kTelSmsMessageTypeDelivered = 0;
+ kTelSmsMessageTypeReport = 1;
+ kTelSmsMessageTypeSubmitted = 2;
+ kTelSmsMessageTypeManualAck = 3;
+ kTelSmsMessageAllTypes = 4;
+
+ kTelSmsMultiPartExtensionTypeId = $00; // Multipart short messages
+ kTelSmsNbsExtensionTypeId = $04; // NBS message, with port number in short
+ kTelSmsNbs2ExtensionTypeId = $05; // NBS message, with port number in long
+
+ kTelSmsDefaultProtocol = 0; // sms message transport protocol
+ kTelSmsFaxProtocol = 1;
+ kTelSmsX400Protocol = 2;
+ kTelSmsPagingProtocol = 3;
+ kTelSmsEmailProtocol = 4;
+ kTelSmsErmesProtocol = 5;
+ kTelSmsVoiceProtocol = 6;
+
+ kTelSmsAPIVersion = $0001; // SMS api version
+
+ kTelSmsStorageSIM = 0; // SMS storage IDs
+ kTelSmsStoragePhone = 1;
+ kTelSmsStorageAdaptor = 2;
+ kTelSmsStorageFirstOem = 3;
+
+ kTelSmsCMTMessageType = 0; // Cellular Messaging Teleservice message
+ kTelSmsCPTMessageType = 1; // Cellular Paging Teleservice message
+ kTelSmsVMNMessageType = 2; // Voice Mail Notification message
+
+
+// Delivery report Type (UInt8) - Only used in CDMA & TDMA advanced parameters
+ kTelSmsStatusReportDeliveryType = 0; // Status report or delivery acknowledge
+ kTelSmsManualAckDeliveryType = 1; // Manual acknowledge delivery
+
+
+// Data coding scheme (UInt8)
+ kTelSms8BitsEncoding = 0;
+ kTelSmsBitsASCIIEncoding = 1; // ANSI X3.4
+ kTelSmsIA5Encoding = 2; // CCITTT T.50
+ kTelSmsIS91Encoding = 3; // TIA/EIA/IS-91 section 3.7.1
+ kTelSmsUCS2Encoding = 4; // Only supported by GSM
+ kTelSmsDefaultGSMEncoding = 5; // Only supported by GSM
+
+
+// Message urgency / priority (UInt8) - Only used in CDMA & TDMA advanced parameters
+ kTelSmsUrgencyNormal = 0;
+ kTelSmsUrgencyUrgent = 1;
+ kTelSmsUrgencyEmergency = 2;
+//Bulk (CDMA) & Interactive mode (TDMA) are not supported
+
+
+// Privacy message indicator (UInt8) - Only used in CDMA & TDMA advanced parameters
+ kTelSmsPrivacyNotRestricted = 0; // Privacy level 0
+ kTelSmsPrivacyRestricted = 1; // Privacy level 1
+ kTelSmsPrivacyConfidential = 2; // Privacy level 2
+ kTelSmsPrivacySecret = 3; // Privacy level 3
+
+
+// Delivery status report (UInt8)
+ kTelSmsDSRSuccess = 0;
+ kTelSmsDSRMessageReplaced = 1;
+ kTelSmsDSRMessageForwarded = 2; // unknown delivery result
+ kTelSmsDSRTempCongestion = 3;
+ kTelSmsDSRTempSMEBusy = 4;
+ kTelSmsDSRTempServiceRejected = 5;
+ kTelSmsDSRTempServiceUnavailable = 6;
+ kTelSmsDSRTempSMEError = 7;
+ kTelSmsDSRTempOther = 8;
+ kTelSmsDSRPermRPError = 9;
+ kTelSmsDSRPermBadDestination = 10;
+ kTelSmsDSRPermUnobtainable = 11;
+ kTelSmsDSRPermServiceUnavailable = 12;
+ kTelSmsDSRPermInternetworkError = 13;
+ kTelSmsDSRPermValidityExpired = 14;
+ kTelSmsDSRPermDeletedByOrigSME = 15;
+ kTelSmsDSRPermDeleteByAdm = 16;
+ kTelSmsDSRPermSMNotExist = 17;
+ kTelSmsDSRPermOther = 18;
+
+ kTelSpeechCallClass = 0; // call classes
+ kTelDataCallClass = 1;
+ kTelFaxCallClass = 2;
+
+ kTelPhbFixedPhonebook = 0; // phonebooks
+ kTelPhbSimPhonebook = 1;
+ kTelPhbPhonePhonebook = 2;
+ kTelPhbLastDialedPhonebook = 3;
+ kTelPhbSimAndPhonePhonebook = 4;
+ kTelPhbAdaptorPhonebook = 5;
+ kTelPhbFirstOemPhonebook = 6;
+
+ kTelCallIdle = 0; // call states
+ kTelCallConnecting = 1;
+ kTelCallConnected = 2;
+ kTelCallRedial = 3;
+ kTelCallIncoming = 4;
+ kTelCallIncomingAck = 5;
+ kTelCallDisconnecting = 6;
+
+ kTelCallTypeOutgoing = 0; // call type
+ kTelCallTypeIncoming = 1;
+
+ kTelCallServiceVoice = 0; // call service type
+ kTelCallServiceData = 1;
+
+ kTelStyReady = 0; // no more security code expected
+ kTelStyPin1CodeId = 1; // authentication code IDs
+ kTelStyPin2CodeId = 2;
+ kTelStyPuk1CodeId = 3;
+ kTelStyPuk2CodeId = 4;
+ kTelStyPhoneToSimCodeId = 5;
+ kTelStyFirstOemCodeId = 6;
+
+ kTelInfPhoneBrand = 0; // phone information type
+ kTelInfPhoneModel = 1;
+ kTelInfPhoneRevision = 2;
+
+// TelMgr library call ID's
+// first entry points are reserved for internal use only
+ telLibTrapReserved1 = sysLibTrapCustom;
+ telLibTrapReserved2 = sysLibTrapCustom + 1;
+ telLibTrapReserved3 = sysLibTrapCustom + 2;
+ telLibTrapReserved4 = sysLibTrapCustom + 3;
+ telLibTrapReserved5 = sysLibTrapCustom + 4;
+ telLibTrapReserved6 = sysLibTrapCustom + 5;
+ telLibTrapReserved7 = sysLibTrapCustom + 6;
+ telLibTrapReserved8 = sysLibTrapCustom + 7;
+ telLibTrapReserved9 = sysLibTrapCustom + 8;
+ telLibTrapReserved10 = sysLibTrapCustom + 9;
+
+ telLibTrapGetEvent = sysLibTrapCustom + 10;
+ telLibTrapGetTelephonyEvent = sysLibTrapCustom + 11;
+
+ telLibTrapOpenPhoneConnection = sysLibTrapCustom + 12;
+ telLibTrapIsPhoneConnected = sysLibTrapCustom + 13;
+ telLibTrapClosePhoneConnection = sysLibTrapCustom + 14;
+
+ telLibTrapIsServiceAvailable = sysLibTrapCustom + 15;
+ telLibTrapIsFunctionSupported = sysLibTrapCustom + 16;
+
+ telLibTrapSendCommandString = sysLibTrapCustom + 17;
+
+ telLibTrapCancel = sysLibTrapCustom + 18;
+
+ telLibTrapMatchPhoneDriver = sysLibTrapCustom + 19;
+
+ telLibTrapGetCallState = sysLibTrapCustom + 20;
+
+ telLibTrapOemCall = sysLibTrapCustom + 21;
+
+ telLibTrapNwkGetNetworks = sysLibTrapCustom + 22;
+ telLibTrapNwkGetNetworkName = sysLibTrapCustom + 23;
+ telLibTrapNwkGetLocation = sysLibTrapCustom + 24;
+ telLibTrapNwkSelectNetwork = sysLibTrapCustom + 25;
+ telLibTrapNwkGetSelectedNetwork = sysLibTrapCustom + 26;
+ telLibTrapNwkGetNetworkType = sysLibTrapCustom + 27;
+ telLibTrapNwkGetSignalLevel = sysLibTrapCustom + 28;
+ telLibTrapNwkGetSearchMode = sysLibTrapCustom + 29;
+ telLibTrapNwkSetSearchMode = sysLibTrapCustom + 30;
+
+ telLibTrapStyChangeAuthenticationCode = sysLibTrapCustom + 31;
+ telLibTrapStyGetAuthenticationState = sysLibTrapCustom + 32;
+ telLibTrapStyEnterAuthenticationCode = sysLibTrapCustom + 33;
+
+ telLibTrapPowGetPowerLevel = sysLibTrapCustom + 34;
+ telLibTrapPowGetBatteryStatus = sysLibTrapCustom + 35;
+ telLibTrapPowSetPhonePower = sysLibTrapCustom + 36;
+
+ telLibTrapCfgSetSmsCenter = sysLibTrapCustom + 37;
+ telLibTrapCfgGetSmsCenter = sysLibTrapCustom + 38;
+ telLibTrapCfgGetPhoneNumber = sysLibTrapCustom + 39;
+
+ telLibTrapSmsGetUniquePartId = sysLibTrapCustom + 40;
+ telLibTrapSmsGetDataMaxSize = sysLibTrapCustom + 41;
+ telLibTrapSmsSendMessage = sysLibTrapCustom + 42;
+ telLibTrapSmsSendManualAcknowledge = sysLibTrapCustom + 43;
+ telLibTrapSmsReadMessage = sysLibTrapCustom + 44;
+ telLibTrapSmsReadMessages = sysLibTrapCustom + 45;
+ telLibTrapSmsReadReport = sysLibTrapCustom + 46;
+ telLibTrapSmsReadReports = sysLibTrapCustom + 47;
+ telLibTrapSmsReadSubmittedMessage = sysLibTrapCustom + 48;
+ telLibTrapSmsReadSubmittedMessages = sysLibTrapCustom + 49;
+ telLibTrapSmsGetMessageCount = sysLibTrapCustom + 50;
+ telLibTrapSmsDeleteMessage = sysLibTrapCustom + 51;
+ telLibTrapSmsGetAvailableStorage = sysLibTrapCustom + 52;
+ telLibTrapSmsGetSelectedStorage = sysLibTrapCustom + 53;
+ telLibTrapSmsSelectStorage = sysLibTrapCustom + 54;
+
+ telLibTrapEmcCall = sysLibTrapCustom + 55;
+ telLibTrapEmcCloseLine = sysLibTrapCustom + 56;
+ telLibTrapEmcGetNumberCount = sysLibTrapCustom + 57;
+ telLibTrapEmcGetNumber = sysLibTrapCustom + 58;
+ telLibTrapEmcSetNumber = sysLibTrapCustom + 59;
+ telLibTrapEmcSelectNumber = sysLibTrapCustom + 60;
+
+ telLibTrapSpcCallNumber = sysLibTrapCustom + 61;
+ telLibTrapSpcCloseLine = sysLibTrapCustom + 62;
+ telLibTrapSpcHoldLine = sysLibTrapCustom + 63;
+ telLibTrapSpcRetrieveHeldLine = sysLibTrapCustom + 64;
+ telLibTrapSpcConference = sysLibTrapCustom + 65;
+ telLibTrapSpcSelectLine = sysLibTrapCustom + 66;
+ telLibTrapSpcAcceptCall = sysLibTrapCustom + 67;
+ telLibTrapSpcRejectCall = sysLibTrapCustom + 68;
+ telLibTrapSpcGetCallerNumber = sysLibTrapCustom + 69;
+ telLibTrapSpcSendBurstDTMF = sysLibTrapCustom + 70;
+ telLibTrapSpcStartContinuousDTMF = sysLibTrapCustom + 71;
+ telLibTrapSpcStopContinuousDTMF = sysLibTrapCustom + 72;
+ telLibTrapSpcPlayDTMF = sysLibTrapCustom + 73;
+
+ telLibTrapPhbGetEntryCount = sysLibTrapCustom + 74;
+ telLibTrapPhbGetEntry = sysLibTrapCustom + 75;
+ telLibTrapPhbGetEntries = sysLibTrapCustom + 76;
+ telLibTrapPhbAddEntry = sysLibTrapCustom + 77;
+ telLibTrapPhbDeleteEntry = sysLibTrapCustom + 78;
+ telLibTrapPhbGetAvailablePhonebooks = sysLibTrapCustom + 79;
+ telLibTrapPhbSelectPhonebook = sysLibTrapCustom + 80;
+ telLibTrapPhbGetSelectedPhonebook = sysLibTrapCustom + 81;
+ telLibTrapPhbGetEntryMaxSizes = sysLibTrapCustom + 82;
+
+ telLibTrapSndPlayKeyTone = sysLibTrapCustom + 83;
+ telLibTrapSndStopKeyTone = sysLibTrapCustom + 84;
+ telLibTrapSndMute = sysLibTrapCustom + 85;
+
+ telLibTrapInfGetInformation = sysLibTrapCustom + 86;
+
+ telLibTrapDtcCallNumber = sysLibTrapCustom + 87;
+ telLibTrapDtcCloseLine = sysLibTrapCustom + 88;
+ telLibTrapDtcSendData = sysLibTrapCustom + 89;
+ telLibTrapDtcReceiveData = sysLibTrapCustom + 90;
+
+ telLibTrapUnblockNotifications = sysLibTrapCustom + 91;
+
+ telLibTrapOpenProfile = sysLibTrapCustom + 92;
+
+ telLibTrapLast = sysLibTrapCustom + 93;
+
+// function traps
+function TelOpen(iRefnum: UInt16; iVersnum: UInt32; var oAppIdP: TelAppID): Err; syscall sysLibTrapOpen;
+
+function TelClose(iRefnum: UInt16; iAppId: TelAppID): Err; syscall sysLibTrapClose;
+
+// events management
+procedure TelGetEvent(iRefnum: UInt16; iAppId: TelAppID; oEventP: EventPtr; iTimeOut: Int32); syscall telLibTrapGetEvent;
+
+procedure TelGetTelephonyEvent(iRefnum: UInt16; iAppId: TelAppID; oEventP: EventPtr; iTimeOut: Int32); syscall telLibTrapGetTelephonyEvent;
+
+// phone connection management
+function TelOpenPhoneConnection(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapOpenPhoneConnection;
+
+function TelIsPhoneConnected(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapIsPhoneConnected;
+
+function TelClosePhoneConnection(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapClosePhoneConnection;
+
+// service/function availability
+function TelIsServiceAvailable(iRefnum: UInt16; iAppId: TelAppID; serviceId: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapIsServiceAvailable;
+
+function TelIsFunctionSupported(iRefnum: UInt16; iAppId: TelAppID; functionId: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapIsFunctionSupported;
+
+// sending commands to the phone
+function TelSendCommandString(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSendCommandStringType; var ioTransIdP: UInt16): Err; syscall telLibTrapSendCommandString;
+
+// cancelling asynchronous calls
+function TelCancel(iRefnum: UInt16; iAppId: TelAppID; iTransId: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapCancel;
+
+// checking whether phone and driver match
+function TelMatchPhoneDriver(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapMatchPhoneDriver;
+
+// getting phone status
+function TelGetCallState(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelGetCallStateType; var ioTransIdP: UInt16): Err; syscall telLibTrapGetCallState;
+
+// OEM support
+function TelOemCall(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelOemCallType; var ioTransIdP: UInt16): Err; syscall telLibTrapOemCall;
+
+// network
+function TelNwkGetNetworks(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelNwkGetNetworksType; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetNetworks;
+
+function TelNwkGetNetworkName(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelNwkGetNetworkNameType; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetNetworkName;
+
+function TelNwkGetLocation(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelNwkGetLocationType; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetLocation;
+
+function TelNwkSelectNetwork(iRefnum: UInt16; iAppId: TelAppID; iNetworkId: UInt32; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkSelectNetwork;
+
+function TelNwkGetSelectedNetwork(iRefnum: UInt16; iAppId: TelAppID; var oNetworkIdP: UInt32; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetSelectedNetwork;
+
+function TelNwkGetNetworkType(iRefnum: UInt16; iAppId: TelAppID; var oTypeP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetNetworkType;
+
+function TelNwkGetSignalLevel(iRefnum: UInt16; iAppId: TelAppID; var oSignalP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetSignalLevel;
+
+function TelNwkGetSearchMode(iRefnum: UInt16; iAppId: TelAppID; var oModeP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkGetSearchMode;
+
+function TelNwkSetSearchMode(iRefnum: UInt16; iAppId: TelAppID; iMode: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapNwkSetSearchMode;
+
+// security
+function TelStyGetAuthenticationState(iRefnum: UInt16; iAppId: TelAppID; var oStateP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapStyGetAuthenticationState;
+
+function TelStyEnterAuthenticationCode(iRefnum: UInt16; iAppId: TelAppID; const iCodeP: PChar; var ioTransIdP: UInt16): Err; syscall telLibTrapStyEnterAuthenticationCode;
+
+function TelStyChangeAuthenticationCode(iRefnum: UInt16; iAppId: TelAppID; var iParamP: TelStyChangeAuthenticationType; var ioTransIdP: UInt16): Err; syscall telLibTrapStyChangeAuthenticationCode;
+
+// power
+function TelPowGetPowerLevel(iRefnum: UInt16; iAppId: TelAppID; var oPowerP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapPowGetPowerLevel;
+
+function TelPowGetBatteryStatus(iRefnum: UInt16; iAppId: TelAppID; var oStatusP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapPowGetBatteryStatus;
+
+function TelPowSetPhonePower(iRefnum: UInt16; iAppId: TelAppID; iPowerOn: Boolean): Err; syscall telLibTrapPowSetPhonePower;
+
+// configuration
+function TelCfgSetSmsCenter(iRefnum: UInt16; iAppId: TelAppID; const iDialNumberP: PChar; var ioTransIdP: UInt16): Err; syscall telLibTrapCfgSetSmsCenter;
+
+function TelCfgGetSmsCenter(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelCfgGetSmsCenterType; var ioTransIdP: UInt16): Err; syscall telLibTrapCfgGetSmsCenter;
+
+function TelCfgGetPhoneNumber(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelCfgGetPhoneNumberType; var ioTransIdP: UInt16): Err; syscall telLibTrapCfgGetPhoneNumber;
+
+// sms
+function TelSmsGetUniquePartId(iRefnum: UInt16; iAppId: TelAppID; var oUniqueIdP: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsGetUniquePartId;
+
+function TelSmsGetDataMaxSize(iRefnum: UInt16; iAppId: TelAppID; var oSizeP: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsGetDataMaxSize;
+
+function TelSmsSendMessage(iRefnum: UInt16; iAppId: TelAppID; var ioMessageP: TelSmsSendMessageType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsSendMessage;
+
+function TelSmsSendManualAcknowledge(iRefnum: UInt16; iAppId: TelAppID; var ioAckP: TelSmsManualAckType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsSendManualAcknowledge;
+
+function TelSmsReadMessage(iRefnum: UInt16; iAppId: TelAppID; var ioMessageP: TelSmsDeliveryMessageType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadMessage;
+
+function TelSmsReadMessages(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsReadMessagesType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadMessages;
+
+function TelSmsReadReport(iRefnum: UInt16; iAppId: TelAppID; var ioReportP: TelSmsReportType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadReport;
+
+function TelSmsReadReports(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsReadReportsType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadReports;
+
+function TelSmsReadSubmittedMessage(iRefnum: UInt16; iAppId: TelAppID; var ioMessageP: TelSmsSubmittedMessageType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadSubmittedMessage;
+
+function TelSmsReadSubmittedMessages(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsReadSubmittedMessagesType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsReadSubmittedMessages;
+
+function TelSmsGetMessageCount(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsGetMessageCountType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsGetMessageCount;
+
+function TelSmsDeleteMessage(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsDeleteMessageType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsDeleteMessage;
+
+function TelSmsGetAvailableStorage(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSmsGetAvailableStorageType; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsGetAvailableStorage;
+
+function TelSmsGetSelectedStorage(iRefnum: UInt16; iAppId: TelAppID; var oStorageIdP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsGetSelectedStorage;
+
+function TelSmsSelectStorage(iRefnum: UInt16; iAppId: TelAppID; iStorageId: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSmsSelectStorage;
+
+// emergency calls
+function TelEmcCall(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcCall;
+
+function TelEmcCloseLine(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcCloseLine;
+
+function TelEmcGetNumberCount(iRefnum: UInt16; iAppId: TelAppID; var oCountP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcGetNumberCount;
+
+function TelEmcGetNumber(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelEmcGetNumberType; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcGetNumber;
+
+function TelEmcSetNumber(iRefnum: UInt16; iAppId: TelAppID; var iParamP: TelEmcSetNumberType; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcSetNumber;
+
+function TelEmcSelectNumber(iRefnum: UInt16; iAppId: TelAppID; iIndex: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapEmcSelectNumber;
+
+// speech call
+function TelSpcCallNumber(iRefnum: UInt16; iAppId: TelAppID; const iDialNumberP: PChar; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcCallNumber;
+
+function TelSpcCloseLine(iRefnum: UInt16; iAppId: TelAppID; iLineId: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcCloseLine;
+
+function TelSpcHoldLine(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcHoldLine;
+
+function TelSpcRetrieveHeldLine(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcRetrieveHeldLine;
+
+function TelSpcConference(iRefnum: UInt16; iAppId: TelAppID; var oLineIdP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcConference;
+
+function TelSpcSelectLine(iRefnum: UInt16; iAppId: TelAppID; iLineId: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcSelectLine;
+
+function TelSpcAcceptCall(iRefnum: UInt16; iAppId: TelAppID; var oLineIdP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcAcceptCall;
+
+function TelSpcRejectCall(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcRejectCall;
+
+function TelSpcGetCallerNumber(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelSpcGetCallerNumberType; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcGetCallerNumber;
+
+function TelSpcSendBurstDTMF(iRefnum: UInt16; iAppId: TelAppID; const iDTMFStringP: PChar; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcSendBurstDTMF;
+
+function TelSpcStartContinuousDTMF(iRefnum: UInt16; iAppId: TelAppID; iKeyCode: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcStartContinuousDTMF;
+
+function TelSpcStopContinuousDTMF(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcStopContinuousDTMF;
+
+function TelSpcPlayDTMF(iRefnum: UInt16; iAppId: TelAppID; var iParamP: TelSpcPlayDTMFType; var ioTransIdP: UInt16): Err; syscall telLibTrapSpcPlayDTMF;
+
+// phonebook
+function TelPhbGetEntryCount(iRefnum: UInt16; iAppId: TelAppID; var oParamP: TelPhbGetEntryCountType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetEntryCount;
+
+function TelPhbGetEntry(iRefnum: UInt16; iAppId: TelAppID; var ioEntryP: TelPhbEntryType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetEntry;
+
+function TelPhbGetEntries(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelPhbGetEntriesType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetEntries;
+
+function TelPhbAddEntry(iRefnum: UInt16; iAppId: TelAppID; var iEntryP: TelPhbEntryType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbAddEntry;
+
+function TelPhbDeleteEntry(iRefnum: UInt16; iAppId: TelAppID; iEntryIndex: UInt16; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbDeleteEntry;
+
+function TelPhbGetAvailablePhonebooks(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelPhbGetAvailablePhonebooksType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetAvailablePhonebooks;
+
+function TelPhbSelectPhonebook(iRefnum: UInt16; iAppId: TelAppID; iPhbId: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbSelectPhonebook;
+
+function TelPhbGetSelectedPhonebook(iRefnum: UInt16; iAppId: TelAppID; var oPhbIdP: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetSelectedPhonebook;
+
+function TelPhbGetEntryMaxSizes(iRefnum: UInt16; iAppId: TelAppID; var oParamP: TelPhbGetEntryMaxSizesType; var ioTransIdP: UInt16): Err; syscall telLibTrapPhbGetEntryMaxSizes;
+
+// sound
+function TelSndPlayKeyTone(iRefnum: UInt16; iAppId: TelAppID; var iParamP: TelSndPlayKeyToneType; var ioTransIdP: UInt16): Err; syscall telLibTrapSndPlayKeyTone;
+
+function TelSndStopKeyTone(iRefnum: UInt16; iAppId: TelAppID; var ioTransIdP: UInt16): Err; syscall telLibTrapSndStopKeyTone;
+
+function TelSndMute(iRefnum: UInt16; iAppId: TelAppID; iMuteOn: Boolean; var ioTransIdP: UInt16): Err; syscall telLibTrapSndMute;
+
+// information
+function TelInfGetInformation(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelInfGetInformationType; var ioTransIdP: UInt16): Err; syscall telLibTrapInfGetInformation;
+
+// data
+function TelDtcCallNumber(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelDtcCallNumberType; var ioTransIdP: UInt16): Err; syscall telLibTrapDtcCallNumber;
+
+function TelDtcCloseLine(iRefnum: UInt16; iAppId: TelAppID; iLineId: UInt8; var ioTransIdP: UInt16): Err; syscall telLibTrapDtcCloseLine;
+
+function TelDtcSendData(iRefnum: UInt16; iAppId: TelAppID; var iParamP: TelDtcSendDataType; var ioTransIdP: UInt16): Err; syscall telLibTrapDtcSendData;
+
+function TelDtcReceiveData(iRefnum: UInt16; iAppId: TelAppID; var ioParamP: TelDtcReceiveDataType; var ioTransIdP: UInt16): Err; syscall telLibTrapDtcReceiveData;
+
+function TelUnblockNotifications(iRefnum: UInt16): Err; syscall telLibTrapUnblockNotifications;
+
+// open telephony using a particular connection profile
+function TelOpenProfile(iRefnum: UInt16; iVersnum: UInt32; profileId: UInt32; var oAppIdP: TelAppID): Err; syscall telLibTrapOpenProfile;
+
+// MACROS for checking service availability
+function TelIsNwkServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsStyServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPowServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsCfgServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsDtcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsOemServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSndServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsInfServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+// MACROS to check function availability
+function TelIsSendCommandStringSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsCancelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsMatchPhoneDriverSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsGetCallStateSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsOemCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetNetworksSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetNetworkNameSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetLocationSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkSelectNetworkSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetSelectedNetworkSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetNetworkTypeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetSignalLevelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkGetSearchModeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsNwkSetSearchModeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsStyGetAuthenticationStateSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsStyEnterAuthenticationCodeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsStyChangeAuthenticationCodeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPowGetPowerLevelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPowGetBatteryStatusSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPowSetPhonePowerSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsCfgSetSmsCenterSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsCfgGetSmsCenterSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsCfgGetPhoneNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsGetUniquePartIdSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsGetDataMaxSizeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsSendMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsSendManualAcknowledgeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadMessagesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadReportSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadReportsSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadSubmittedMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsReadSubmittedMessagesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsGetMessageCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsDeleteMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsGetAvailableStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsGetSelectedStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSmsSelectStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcGetNumberCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcGetNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcSetNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsEmcSelectNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcCallNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcHoldLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcRetrieveHeldLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcConferenceSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcSelectLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcAcceptCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcRejectCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcGetCallerNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcSendBurstDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcStartContinuousDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcStopContinuousDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSpcPlayDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetEntryCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetEntriesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbAddEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbDeleteEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetAvailablePhonebooksSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbSelectPhonebookSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetSelectedPhonebookSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsPhbGetEntryMaxSizesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSndPlayKeyToneSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSndStopKeyToneSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsSndMuteSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsInfGetInformationSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsDtcCallNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsDtcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsDtcSendDataSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+function TelIsDtcReceiveDataSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+
+implementation
+
+function kTelMgrVersion(major, minor, fix, stage: UInt8; buildNum: UInt16): UInt32;
+begin
+ kTelMgrVersion := sysMakeROMVersion(kTelMgrVersionMajor, kTelMgrVersionMinor, kTelMgrVersionFix, sysROMStageBeta, kTelMgrVersionBuild);
+end;
+
+// MACROS for checking service availability
+function TelIsNwkServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelNwkServiceId, transIdP);
+end;
+
+function TelIsStyServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsStyServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelStyServiceId, transIdP);
+end;
+
+function TelIsPowServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPowServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelPowServiceId, transIdP);
+end;
+
+function TelIsCfgServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsCfgServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelCfgServiceId, transIdP);
+end;
+
+function TelIsSmsServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelSmsServiceId, transIdP);
+end;
+
+function TelIsEmcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelEmcServiceId, transIdP);
+end;
+
+function TelIsSpcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelSpcServiceId, transIdP);
+end;
+
+function TelIsDtcServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsDtcServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelDtcServiceId, transIdP);
+end;
+
+function TelIsPhbServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelPhbServiceId, transIdP);
+end;
+
+function TelIsOemServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsOemServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelOemServiceId, transIdP);
+end;
+
+function TelIsSndServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSndServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelSndServiceId, transIdP);
+end;
+
+function TelIsInfServiceAvailable(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsInfServiceAvailable := TelIsServiceAvailable(refnum, appId, kTelInfServiceId, transIdP);
+end;
+
+// MACROS to check function availability
+function TelIsSendCommandStringSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSendCommandStringSupported := TelIsFunctionSupported(refnum, appId, kTelSendCommandStringMessage, transIdP);
+end;
+
+function TelIsCancelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsCancelSupported := TelIsFunctionSupported(refnum, appId, kTelUrqCancelMessage, transIdP);
+end;
+
+function TelIsMatchPhoneDriverSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsMatchPhoneDriverSupported := TelIsFunctionSupported(refnum, appId, kTelUrqMatchPhoneDriverMessage, transIdP);
+end;
+
+function TelIsGetCallStateSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsGetCallStateSupported := TelIsFunctionSupported(refnum, appId, kTelGetCallStateMessage, transIdP);
+end;
+
+function TelIsOemCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsOemCallSupported := TelIsFunctionSupported(refnum, appId, kTelOemCallMessage, transIdP);
+end;
+
+function TelIsNwkGetNetworksSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetNetworksSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworksMessage, transIdP);
+end;
+
+function TelIsNwkGetNetworkNameSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetNetworkNameSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworkNameMessage, transIdP);
+end;
+
+function TelIsNwkGetLocationSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetLocationSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetLocationMessage, transIdP);
+end;
+
+function TelIsNwkSelectNetworkSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkSelectNetworkSupported := TelIsFunctionSupported(refnum, appId, kTelNwkSelectNetworkMessage, transIdP);
+end;
+
+function TelIsNwkGetSelectedNetworkSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetSelectedNetworkSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetSelectedNetworkMessage, transIdP);
+end;
+
+function TelIsNwkGetNetworkTypeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetNetworkTypeSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetNetworkTypeMessage, transIdP);
+end;
+
+function TelIsNwkGetSignalLevelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetSignalLevelSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetSignalLevelMessage, transIdP);
+end;
+
+function TelIsNwkGetSearchModeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkGetSearchModeSupported := TelIsFunctionSupported(refnum, appId, kTelNwkGetSearchModeMessage, transIdP);
+end;
+
+function TelIsNwkSetSearchModeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsNwkSetSearchModeSupported := TelIsFunctionSupported(refnum, appId, kTelNwkSetSearchModeMessage, transIdP);
+end;
+
+function TelIsStyGetAuthenticationStateSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsStyGetAuthenticationStateSupported := TelIsFunctionSupported(refnum, appId, kTelStyGetAuthenticationStateMessage, transIdP);
+end;
+
+function TelIsStyEnterAuthenticationCodeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsStyEnterAuthenticationCodeSupported := TelIsFunctionSupported(refnum, appId, kTelStyEnterAuthenticationCodeMessage, transIdP);
+end;
+
+function TelIsStyChangeAuthenticationCodeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsStyChangeAuthenticationCodeSupported := TelIsFunctionSupported(refnum, appId, kTelStyChangeAuthenticationCodeMessage, transIdP);
+end;
+
+function TelIsPowGetPowerLevelSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPowGetPowerLevelSupported := TelIsFunctionSupported(refnum, appId, kTelPowGetPowerLevelMessage, transIdP);
+end;
+
+function TelIsPowGetBatteryStatusSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPowGetBatteryStatusSupported := TelIsFunctionSupported(refnum, appId, kTelPowGetBatteryStatusMessage, transIdP);
+end;
+
+function TelIsPowSetPhonePowerSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPowSetPhonePowerSupported := TelIsFunctionSupported(refnum, appId, kTelPowSetPhonePowerMessage, transIdP);
+end;
+
+function TelIsCfgSetSmsCenterSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsCfgSetSmsCenterSupported := TelIsFunctionSupported(refnum, appId, kTelCfgSetSmsCenterMessage, transIdP);
+end;
+
+function TelIsCfgGetSmsCenterSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsCfgGetSmsCenterSupported := TelIsFunctionSupported(refnum, appId, kTelCfgGetSmsCenterMessage, transIdP);
+end;
+
+function TelIsCfgGetPhoneNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsCfgGetPhoneNumberSupported := TelIsFunctionSupported(refnum, appId, kTelCfgGetPhoneNumberMessage, transIdP);
+end;
+
+function TelIsSmsGetUniquePartIdSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsGetUniquePartIdSupported := TelIsFunctionSupported(refnum, appId, kTelUrqSmsGetUniquePartIdMessage, transIdP);
+end;
+
+function TelIsSmsGetDataMaxSizeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsGetDataMaxSizeSupported := TelIsFunctionSupported(refnum, appId, kTelSmsGetDataMaxSizeMessage, transIdP);
+end;
+
+function TelIsSmsSendMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsSendMessageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsSendMessageMessage, transIdP);
+end;
+
+function TelIsSmsSendManualAcknowledgeSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsSendManualAcknowledgeSupported := TelIsFunctionSupported(refnum, appId, kTelSmsSendManualAcknowledgeMessage, transIdP);
+end;
+
+function TelIsSmsReadMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadMessageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadMessageMessage, transIdP);
+end;
+
+function TelIsSmsReadMessagesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadMessagesSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadMessagesMessage, transIdP);
+end;
+
+function TelIsSmsReadReportSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadReportSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadReportMessage, transIdP);
+end;
+
+function TelIsSmsReadReportsSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadReportsSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadReportsMessage, transIdP);
+end;
+
+function TelIsSmsReadSubmittedMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadSubmittedMessageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadSubmittedMessageMessage, transIdP);
+end;
+
+function TelIsSmsReadSubmittedMessagesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsReadSubmittedMessagesSupported := TelIsFunctionSupported(refnum, appId, kTelSmsReadSubmittedMessagesMessage, transIdP);
+end;
+
+function TelIsSmsGetMessageCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsGetMessageCountSupported := TelIsFunctionSupported(refnum, appId, kTelSmsGetMessageCountMessage, transIdP);
+end;
+
+function TelIsSmsDeleteMessageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsDeleteMessageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsDeleteMessageMessage, transIdP);
+end;
+
+function TelIsSmsGetAvailableStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsGetAvailableStorageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsGetAvailableStorageMessage, transIdP);
+end;
+
+function TelIsSmsGetSelectedStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsGetSelectedStorageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsGetSelectedStorageMessage, transIdP);
+end;
+
+function TelIsSmsSelectStorageSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSmsSelectStorageSupported := TelIsFunctionSupported(refnum, appId, kTelSmsSelectStorageMessage, transIdP);
+end;
+
+function TelIsEmcCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcCallSupported := TelIsFunctionSupported(refnum, appId, kTelEmcCallMessage, transIdP);
+end;
+
+function TelIsEmcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcCloseLineSupported := TelIsFunctionSupported(refnum, appId, kTelEmcCloseLineMessage, transIdP);
+end;
+
+function TelIsEmcGetNumberCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcGetNumberCountSupported := TelIsFunctionSupported(refnum, appId, kTelEmcGetNumberCountMessage, transIdP);
+end;
+
+function TelIsEmcGetNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcGetNumberSupported := TelIsFunctionSupported(refnum, appId, kTelEmcGetNumberMessage, transIdP);
+end;
+
+function TelIsEmcSetNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcSetNumberSupported := TelIsFunctionSupported(refnum, appId, kTelEmcSetNumberMessage, transIdP);
+end;
+
+function TelIsEmcSelectNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsEmcSelectNumberSupported := TelIsFunctionSupported(refnum, appId, kTelEmcSelectNumberMessage, transIdP);
+end;
+
+function TelIsSpcCallNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcCallNumberSupported := TelIsFunctionSupported(refnum, appId, kTelSpcCallNumberMessage, transIdP);
+end;
+
+function TelIsSpcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcCloseLineSupported := TelIsFunctionSupported(refnum, appId, kTelSpcCloseLineMessage, transIdP);
+end;
+
+function TelIsSpcHoldLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcHoldLineSupported := TelIsFunctionSupported(refnum, appId, kTelSpcHoldLineMessage, transIdP);
+end;
+
+function TelIsSpcRetrieveHeldLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcRetrieveHeldLineSupported := TelIsFunctionSupported(refnum, appId, kTelSpcRetrieveHeldLineMessage, transIdP);
+end;
+
+function TelIsSpcConferenceSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcConferenceSupported := TelIsFunctionSupported(refnum, appId, kTelSpcConferenceMessage, transIdP);
+end;
+
+function TelIsSpcSelectLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcSelectLineSupported := TelIsFunctionSupported(refnum, appId, kTelSpcSelectLineMessage, transIdP);
+end;
+
+function TelIsSpcAcceptCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcAcceptCallSupported := TelIsFunctionSupported(refnum, appId, kTelSpcAcceptCallMessage, transIdP);
+end;
+
+function TelIsSpcRejectCallSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcRejectCallSupported := TelIsFunctionSupported(refnum, appId, kTelSpcRejectCallMessage, transIdP);
+end;
+
+function TelIsSpcGetCallerNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcGetCallerNumberSupported := TelIsFunctionSupported(refnum, appId, kTelSpcGetCallerNumberMessage, transIdP);
+end;
+
+function TelIsSpcSendBurstDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcSendBurstDTMFSupported := TelIsFunctionSupported(refnum, appId, kTelSpcSendBurstDTMFMessage, transIdP);
+end;
+
+function TelIsSpcStartContinuousDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcStartContinuousDTMFSupported := TelIsFunctionSupported(refnum, appId, kTelSpcStartContinuousDTMFMessage, transIdP);
+end;
+
+function TelIsSpcStopContinuousDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcStopContinuousDTMFSupported := TelIsFunctionSupported(refnum, appId, kTelSpcStopContinuousDTMFMessage, transIdP);
+end;
+
+function TelIsSpcPlayDTMFSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSpcPlayDTMFSupported := TelIsFunctionSupported(refnum, appId, kTelSpcPlayDTMFMessage, transIdP);
+end;
+
+function TelIsPhbGetEntryCountSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetEntryCountSupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryCountMessage, transIdP);
+end;
+
+function TelIsPhbGetEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetEntrySupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryMessage, transIdP);
+end;
+
+function TelIsPhbGetEntriesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetEntriesSupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetEntriesMessage, transIdP);
+end;
+
+function TelIsPhbAddEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbAddEntrySupported := TelIsFunctionSupported(refnum, appId, kTelPhbAddEntryMessage, transIdP);
+end;
+
+function TelIsPhbDeleteEntrySupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbDeleteEntrySupported := TelIsFunctionSupported(refnum, appId, kTelPhbDeleteEntryMessage, transIdP);
+end;
+
+function TelIsPhbGetAvailablePhonebooksSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetAvailablePhonebooksSupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetAvailablePhonebooksMessage, transIdP);
+end;
+
+function TelIsPhbSelectPhonebookSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbSelectPhonebookSupported := TelIsFunctionSupported(refnum, appId, kTelPhbSelectPhonebookMessage, transIdP);
+end;
+
+function TelIsPhbGetSelectedPhonebookSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetSelectedPhonebookSupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetSelectedPhonebookMessage, transIdP);
+end;
+
+function TelIsPhbGetEntryMaxSizesSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsPhbGetEntryMaxSizesSupported := TelIsFunctionSupported(refnum, appId, kTelPhbGetEntryMaxSizesMessage, transIdP);
+end;
+
+function TelIsSndPlayKeyToneSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSndPlayKeyToneSupported := TelIsFunctionSupported(refnum, appId, kTelSndPlayKeyToneMessage, transIdP);
+end;
+
+function TelIsSndStopKeyToneSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSndStopKeyToneSupported := TelIsFunctionSupported(refnum, appId, kTelSndStopKeyToneMessage, transIdP);
+end;
+
+function TelIsSndMuteSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsSndMuteSupported := TelIsFunctionSupported(refnum, appId, kTelSndMuteMessage, transIdP);
+end;
+
+function TelIsInfGetInformationSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsInfGetInformationSupported := TelIsFunctionSupported(refnum, appId, kTelInfGetInformationMessage, transIdP);
+end;
+
+function TelIsDtcCallNumberSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsDtcCallNumberSupported := TelIsFunctionSupported(refnum, appId, kTelDtcCallNumberMessage, transIdP);
+end;
+
+function TelIsDtcCloseLineSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsDtcCloseLineSupported := TelIsFunctionSupported(refnum, appId, kTelDtcCloseLineMessage, transIdP);
+end;
+
+function TelIsDtcSendDataSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsDtcSendDataSupported := TelIsFunctionSupported(refnum, appId, kTelDtcSendDataMessage, transIdP);
+end;
+
+function TelIsDtcReceiveDataSupported(refnum: UInt16; appId: TelAppID; var transIdP: UInt16): Err;
+begin
+ TelIsDtcReceiveDataSupported := TelIsFunctionSupported(refnum, appId, kTelDtcReceiveDataMessage, transIdP);
+end;
+
+end.
diff --git a/packages/palmunits/src/telephonymgrtypes.pp b/packages/palmunits/src/telephonymgrtypes.pp
new file mode 100644
index 0000000000..0267681429
--- /dev/null
+++ b/packages/palmunits/src/telephonymgrtypes.pp
@@ -0,0 +1,591 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TelephonyMgrTypes.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This is the header file declaring the data types used by the
+ * Telephony Manager for Palm OS Wireless Telephony Add-on.
+ *
+ * History:
+ * Created by Gilles Fabre
+ * 08/02/99 gfa Initial version.
+ * 05/02/00 gfa Shared lib, 2nd API version.
+ *
+ *****************************************************************************)
+
+unit telephonymgrtypes;
+
+interface
+
+uses palmos, errorbase, event_;
+
+const
+ telErrorClass = appErrorClass + $100; // DOLATER: remove this constant
+ kTelMaxPhoneNumberLen = 30;
+
+// managers id
+type
+ TelServices = Enum;
+
+const
+ kTelNwkServiceId = 0;
+ kTelStyServiceId = Succ(kTelNwkServiceId);
+ kTelPowServiceId = Succ(kTelStyServiceId);
+ kTelCfgServiceId = Succ(kTelPowServiceId);
+ kTelSmsServiceId = Succ(kTelCfgServiceId);
+ kTelEmcServiceId = Succ(kTelSmsServiceId);
+ kTelSpcServiceId = Succ(kTelEmcServiceId);
+ kTelDtcServiceId = Succ(kTelSpcServiceId);
+ kTelPhbServiceId = Succ(kTelDtcServiceId);
+ kTelOemServiceId = Succ(kTelPhbServiceId);
+ kTelSndServiceId = Succ(kTelOemServiceId);
+ kTelInfServiceId = Succ(kTelSndServiceId);
+
+// messages
+type
+ TelMessages = Enum;
+
+const
+ kTelGetCallStateMessage = 0;
+
+ kTelSendCommandStringMessage = Succ(kTelGetCallStateMessage);
+
+ kTelNwkGetNetworkNameMessage = Succ(kTelSendCommandStringMessage);
+ kTelNwkGetNetworkTypeMessage = Succ(kTelNwkGetNetworkNameMessage);
+ kTelNwkGetSignalLevelMessage = Succ(kTelNwkGetNetworkTypeMessage);
+ kTelNwkGetSearchModeMessage = Succ(kTelNwkGetSignalLevelMessage);
+ kTelNwkSetSearchModeMessage = Succ(kTelNwkGetSearchModeMessage);
+ kTelNwkGetNetworksMessage = Succ(kTelNwkSetSearchModeMessage);
+ kTelNwkSelectNetworkMessage = Succ(kTelNwkGetNetworksMessage);
+ kTelNwkGetSelectedNetworkMessage = Succ(kTelNwkSelectNetworkMessage);
+ kTelNwkGetLocationMessage = Succ(kTelNwkGetSelectedNetworkMessage);
+
+ kTelStyGetAuthenticationStateMessage = Succ(kTelNwkGetLocationMessage );
+ kTelStyEnterAuthenticationCodeMessage = Succ(kTelStyGetAuthenticationStateMessage);
+ kTelStyChangeAuthenticationCodeMessage = Succ(kTelStyEnterAuthenticationCodeMessage);
+
+ kTelPowGetPowerLevelMessage = Succ(kTelStyChangeAuthenticationCodeMessage);
+ kTelPowGetBatteryStatusMessage = Succ(kTelPowGetPowerLevelMessage);
+ kTelPowSetPhonePowerMessage = Succ(kTelPowGetBatteryStatusMessage);
+
+ kTelCfgSetSmsCenterMessage = Succ(kTelPowSetPhonePowerMessage);
+ kTelCfgGetSmsCenterMessage = Succ(kTelCfgSetSmsCenterMessage);
+ kTelCfgGetPhoneNumberMessage = Succ(kTelCfgGetSmsCenterMessage);
+
+ kTelSmsSendMessageMessage = Succ(kTelCfgGetPhoneNumberMessage);
+ kTelSmsSendManualAcknowledgeMessage = Succ(kTelSmsSendMessageMessage);
+ kTelSmsGetMessageCountMessage = Succ(kTelSmsSendManualAcknowledgeMessage);
+ kTelSmsReadMessageMessage = Succ(kTelSmsGetMessageCountMessage);
+ kTelSmsReadMessagesMessage = Succ(kTelSmsReadMessageMessage);
+ kTelSmsReadSubmittedMessageMessage = Succ(kTelSmsReadMessagesMessage);
+ kTelSmsReadSubmittedMessagesMessage = Succ(kTelSmsReadSubmittedMessageMessage);
+ kTelSmsReadReportMessage = Succ(kTelSmsReadSubmittedMessagesMessage);
+ kTelSmsReadReportsMessage = Succ(kTelSmsReadReportMessage);
+ kTelSmsDeleteMessageMessage = Succ(kTelSmsReadReportsMessage);
+ kTelSmsGetAvailableStorageMessage = Succ(kTelSmsDeleteMessageMessage);
+ kTelSmsSelectStorageMessage = Succ(kTelSmsGetAvailableStorageMessage);
+ kTelSmsGetSelectedStorageMessage = Succ(kTelSmsSelectStorageMessage);
+ kTelSmsGetDataMaxSizeMessage = Succ(kTelSmsGetSelectedStorageMessage);
+
+ kTelEmcGetNumberCountMessage = Succ(kTelSmsGetDataMaxSizeMessage);
+ kTelEmcGetNumberMessage = Succ(kTelEmcGetNumberCountMessage);
+ kTelEmcSetNumberMessage = Succ(kTelEmcGetNumberMessage);
+ kTelEmcSelectNumberMessage = Succ(kTelEmcSetNumberMessage);
+ kTelEmcCallMessage = Succ(kTelEmcSelectNumberMessage);
+ kTelEmcCloseLineMessage = Succ(kTelEmcCallMessage);
+
+ kTelSpcAcceptCallMessage = Succ(kTelEmcCloseLineMessage);
+ kTelSpcRejectCallMessage = Succ(kTelSpcAcceptCallMessage);
+ kTelSpcCallNumberMessage = Succ(kTelSpcRejectCallMessage);
+ kTelSpcCloseLineMessage = Succ(kTelSpcCallNumberMessage);
+ kTelSpcHoldLineMessage = Succ(kTelSpcCloseLineMessage);
+ kTelSpcRetrieveHeldLineMessage = Succ(kTelSpcHoldLineMessage);
+ kTelSpcGetCallerNumberMessage = Succ(kTelSpcRetrieveHeldLineMessage);
+ kTelSpcSendBurstDTMFMessage = Succ(kTelSpcGetCallerNumberMessage);
+ kTelSpcStartContinuousDTMFMessage = Succ(kTelSpcSendBurstDTMFMessage);
+ kTelSpcStopContinuousDTMFMessage = Succ(kTelSpcStartContinuousDTMFMessage);
+ kTelSpcConferenceMessage = Succ(kTelSpcStopContinuousDTMFMessage);
+ kTelSpcSelectLineMessage = Succ(kTelSpcConferenceMessage);
+ kTelSpcPlayDTMFMessage = Succ(kTelSpcSelectLineMessage);
+
+ kTelDtcCallNumberMessage = Succ(kTelSpcPlayDTMFMessage);
+ kTelDtcCloseLineMessage = Succ(kTelDtcCallNumberMessage);
+ kTelDtcSendDataMessage = Succ(kTelDtcCloseLineMessage);
+ kTelDtcReceiveDataMessage = Succ(kTelDtcSendDataMessage);
+
+ kTelPhbGetEntryCountMessage = Succ(kTelDtcReceiveDataMessage);
+ kTelPhbGetEntryMessage = Succ(kTelPhbGetEntryCountMessage);
+ kTelPhbGetEntriesMessage = Succ(kTelPhbGetEntryMessage);
+ kTelPhbAddEntryMessage = Succ(kTelPhbGetEntriesMessage);
+ kTelPhbDeleteEntryMessage = Succ(kTelPhbAddEntryMessage);
+ kTelPhbGetAvailablePhonebooksMessage = Succ(kTelPhbDeleteEntryMessage);
+ kTelPhbSelectPhonebookMessage = Succ(kTelPhbGetAvailablePhonebooksMessage);
+ kTelPhbGetSelectedPhonebookMessage = Succ(kTelPhbSelectPhonebookMessage);
+ kTelPhbGetEntryMaxSizesMessage = Succ(kTelPhbGetSelectedPhonebookMessage);
+
+ kTelSndPlayKeyToneMessage = Succ(kTelPhbGetEntryMaxSizesMessage);
+ kTelSndStopKeyToneMessage = Succ(kTelSndPlayKeyToneMessage);
+ kTelSndMuteMessage = Succ(kTelSndStopKeyToneMessage);
+
+ kTelUrqSmsGetUniquePartIdMessage = Succ(kTelSndMuteMessage);
+
+ kTelUrqClosePhoneConnectionMessage = Succ(kTelUrqSmsGetUniquePartIdMessage); // urgent query: ask TT to close connection with phone
+ kTelUrqOpenPhoneConnectionMessage = Succ(kTelUrqClosePhoneConnectionMessage); // urgent query: ask TT to open connection with phone
+ kTelUrqIsPhoneConnectedMessage = Succ(kTelUrqOpenPhoneConnectionMessage); // urgent query: ask TT the connection state with phone
+ kTelUrqMatchPhoneDriverMessage = Succ(kTelUrqIsPhoneConnectedMessage); // urgent query: ask TT to check whether the driver matches the phone
+ kTelUrqCancelMessage = Succ(kTelUrqMatchPhoneDriverMessage); // urgent query: ask TT to cancel an asynchronous call
+ kTelUrqIsServiceAvailableMessage = Succ(kTelUrqCancelMessage); // urgent query: ask TT whether a service set is available
+ kTelUrqIsFunctionSupportedMessage = Succ(kTelUrqIsServiceAvailableMessage); // urgent query: ask TT whether a function is supported
+
+ kTelUrqGetTTStatusMessage = Succ(kTelUrqIsFunctionSupportedMessage); // urgent query: ask TT is status
+ kTelUrqSleepMessage = Succ(kTelUrqGetTTStatusMessage); // urgent query: warn TT the palm is going asleep
+ kTelUrqWakeMessage = Succ(kTelUrqSleepMessage); // urgent query: warn TT the palm is awaking
+ kTelUrqDetachMessage = Succ(kTelUrqWakeMessage); // urgent query: warn TT associated application is about to quit
+ kTelUrqStopTTMessage = Succ(kTelUrqDetachMessage); // urgent query: ask TT to stop
+
+ kTelInfGetInformationMessage = Succ(kTelUrqStopTTMessage);
+
+ kTelOemCallMessage = Succ(kTelInfGetInformationMessage); // oem calls
+
+ kTelLastMessage = kTelOemCallMessage;
+
+type
+ // basic types
+ TelAppID = UInt32;
+
+ // notification structure
+ TelNotificationType = record
+ notificationData: UInt32; // associated data if any
+ notificationData2: UInt32; // associated data if any
+ timeStamp: UInt32; // time stamp
+ notificationId: UInt16; // what was the associated telephony event
+ priority: UInt8; // notification priority 0 == max, 255 == min
+ end;
+
+ // event structure
+ TelEventType = record
+ eType: eventsEnum;
+ penDown: Boolean;
+ tapCount: UInt8;
+ screenX: Int16;
+ screenY: Int16;
+
+ functionId: UInt16; // ID of the message associated to the asynchronous function call
+ transId: UInt16; // transId returned on asynchronous function call return
+ aramP: ^MemPtr; // parameter passed at asynchronous function call
+ returnCode: Err; // function return code, errNone if ok, else an error
+ end;
+
+ // command string
+ TelSendCommandStringType = record
+ commandString: PChar; // command string to be sent
+ resultString: PChar; // result string
+ resultSize: UInt16; // result string buffer size/max bytes retrieved on result
+ timeOut: UInt32; // milliseconds time out for command processing (before phone starts replying)
+ end;
+
+ // call state
+ TelGetCallStateType = record
+ state: UInt8; // call state, see kTelCall<State> constants in TelMgr.h
+ callType: UInt8; // incoming or outgoing
+ callServiceType: UInt8; // voice or data
+
+ // outgoing or incoming call number
+ numberSize: UInt8; // size of number (in), length of number + 1 (out)
+ number: PChar; // called or calling number
+ end;
+
+ // network support
+ TelNwkGetNetworkNameType = record
+ id: UInt32; // network ID
+ value: PChar; // name
+ size: UInt16; // size of name (in), name len including '\0' (out)
+ end;
+
+ TelNwkGetNetworksType = record
+ etworkIdP: ^UInt32; // network IDs array
+ size: UInt8; // size of networkIdP (in), number of network IDs (out)
+ end;
+
+ // phone location within network web
+ TelNwkGetLocationType = record
+ value: PChar; // current location string
+ size: UInt16; // size of value (in), location len including '\0' (out)
+ end;
+
+ // change security code
+ TelStyChangeAuthenticationType = record
+ codeId: UInt8; // code to be changed
+ oldCode: PChar; // old code value
+ newCode: PChar; // new code value
+ end;
+
+ // SMS center
+ TelCfgGetSmsCenterType = record
+ size: UInt8; // size of value (in), SMS dial number len including '\0' (out)
+ value: PChar; // SMS center dial number
+ end;
+
+ // phone number
+ TelCfgGetPhoneNumberType = record
+ size: UInt8; // size of value (in), phone dial number len including '\0' (out)
+ value: PChar; // phone dial number
+ end;
+
+ // SMS
+ // SMS time
+ TelSmsDateTimeType = record
+ absolute: Boolean;
+ dateTime: UInt32; // relative time from now, or Palm absolute time
+ end;
+
+ // SMS extensions
+ TelSmsMultiPartExtensionType = record
+ bytesSent: UInt16;
+ partCurrent: UInt16;
+ partCount: UInt16;
+ partId: UInt16;
+ end;
+
+ TelSmsNbsExtensionType = record
+ destPort: UInt16; // destination NBS port
+ srcPort: UInt16; // source NBS port
+ end;
+
+ TelSmsUserExtensionType = record
+ extHeader: ^UInt8; // user defined extended header
+ extHeaderSize: UInt8;
+ end;
+
+ TelSmsExtensionType = record
+ extensionTypeId: UInt8; // what does this extension describe?
+
+ case Integer of
+ 1: (mp: TelSmsMultiPartExtensionType); // multi-part SMS extension
+ 2: (nbs: TelSmsNbsExtensionType); // NBS SMS extension
+ 3: (user: TelSmsUserExtensionType); // User Defined SMS extension
+ end;
+
+ // Advanced parameters for GSM
+ TelSmsSubmitAdvancedGSMType = record
+ protocolId: UInt16; // Reserved - not supported (Fax, paging, . . .) GSM only
+
+ rejectDuplicatedRequest: Boolean; // GSM - Network must reject msg if the same exists
+ replyPath: Boolean; // GSM - use reply specified path
+
+ serviceCenterNumber: PChar; // SMS service center number
+ serviceCenterNumberSize: UInt8; // Used for decoding only
+ end;
+
+ // Advanced parameters for CDMA
+ TelSmsSubmitAdvancedCDMAType = record
+ manualAckRequest: Boolean;
+ messageType: UInt8; // Message Type
+
+ deferredDate: TelSmsDateTimeType; // GSM & CDMA only Absolute or relative
+
+ priority: UInt8; // CDMA & TDMA only
+ privacy: UInt8; // CDMA & TDMA only
+
+ alertOnDeliveryRequest: Boolean; // CDMA & TDMA(?)
+
+ callbackNumber: PChar; // CDMA & TDMA only - address to reply
+ callbackNumberSize: UInt8;
+ end;
+
+ // Advanced parameters for TDMA - currently identical to CDMA
+ TelSmsSubmitAdvancedTDMAType = TelSmsSubmitAdvancedCDMAType;
+
+ TelSmsSubmitMessageAdvancedParams = record
+ case Integer of
+ 1: (advancedGSM: TelSmsSubmitAdvancedGSMType);
+ 2: (advancedCDMA: TelSmsSubmitAdvancedCDMAType);
+ 3: (advancedTDMA: TelSmsSubmitAdvancedTDMAType);
+ end;
+
+ // Submit message structure
+ TelSmsSubmitMessageType = record
+ version: UInt16; // SMS API version
+
+ networkDeliveryRequest: Boolean; // All - Ask a network delivery report / status report
+
+ destinationAddress: PChar; // length : GSM 12bytes, CDMA up to 2x64 bytes
+ destinationAddressSize: UInt8; // Used for decoding only
+
+ dataSize: UInt16; // Length of data being sent
+ data: ^UInt8; // All
+ dataCodingScheme: UInt8;
+
+ validityPeriod: TelSmsDateTimeType; // All - Absolute or relative
+
+ // Advanced parameters
+ standardType: UInt8; // Indicates the type of advanced parameters
+
+ advancedParams: TelSmsSubmitMessageAdvancedParams;
+
+ extensionsCount: UInt8; // how many extensions in this message
+ extensionsP: ^TelSmsExtensionType; // SMS extensions array: NBS, Multi-part, etc.
+ end;
+
+ // Submit message structure parameter
+ TelSmsSendMessageType = record
+ messageId: UInt32; // Output parameter, filled by the telephony implementation
+ message: TelSmsSubmitMessageType;
+ end;
+
+ // Submitted message structure parameter
+ TelSmsSubmittedMessageType = record
+ index: UInt16; // Message's index on the phone
+ message: TelSmsSubmitMessageType;
+ end;
+
+ // Manual acknowledge structure
+ TelSmsManualAckType = record
+ version: UInt16; // SMS API version
+ destinationAddress: PChar; // length : GSM 12bytes, CDMA up to 2x64 bytes
+ messagesId: UInt32; // Message Id of message to be acknowledged
+
+ dataSize: UInt16; // Length of data being sent
+ data: ^UInt8; // All
+ dataCodingScheme: UInt8;
+
+ responseCode: UInt8; // Value is network dependant
+ end;
+
+ TelSmsDeliveryAdvancedGSMType = record
+ protocolId: UInt16; // reserved - not supported - GSM only
+
+ replyPath: Boolean; // GSM - must use specified reply path
+ serviceCenterNumber: PChar;
+ serviceCenterNumberSize: UInt8;
+ end;
+
+ TelSmsDeliveryAdvancedCDMAType = record
+ messageType: UInt8; // Delivery Message Type
+
+ validityPeriod: TelSmsDateTimeType; // CDMA & TDMA only
+
+ priority: UInt8; // CDMA & TDMA only
+ privacy: UInt8; // CDMA & TDMA only
+
+ alertOnDeliveryRequest: Boolean; // CDMA & TDMA only
+ manualAckRequest: Boolean; // CDMA
+
+ voiceMessageNumber: UInt8; // CDMA, TDMA, GSM
+
+ callbackNumberSize: UInt8;
+ callbackNumberAddress: PChar; // Store callback address
+
+ languageIndicator: UInt8; // reserved - not supported - CDMA only
+ end;
+
+ TelSmsDeliveryAdvancedTDMAType = record
+ messageType: UInt8; // Delivery Message Type
+
+ validityPeriod: TelSmsDateTimeType; // CDMA & TDMA only
+
+ priority: UInt8; // CDMA & TDMA only
+ privacy: UInt8; // CDMA & TDMA only
+
+ manualAckRequest: Boolean; // CDMA
+
+ alertOnDeliveryRequest: Boolean; // CDMA & TDMA only
+ voiceMessageNumber: UInt8; // CDMA, TDMA, GSM
+
+ callbackNumberSize: UInt8;
+ callbackNumberAddress: PChar; // Store callback address
+ end;
+
+ TelSmsDeliveryMessageAdvancedParams = record
+ case Integer of
+ 1: (advancedGSM: TelSmsDeliveryAdvancedGSMType);
+ 2: (advancedCDMA: TelSmsDeliveryAdvancedCDMAType);
+ 3: (advancedTDMA: TelSmsDeliveryAdvancedTDMAType);
+ end;
+
+ // Delivery message structure
+ TelSmsDeliveryMessageType = record
+
+ version: UInt16; // SMS API version
+ index: UInt16; // SMS index on the phone storage
+
+ messageIdentifier: UInt32;
+
+ timeStamp: TelSmsDateTimeType;
+
+ dataSize: UInt16; // Length of data being sent
+ data: ^UInt8;
+ dataCodingScheme: UInt8; // enum All
+
+ originatingAddressSize: UInt8;
+ originatingAddress: PChar; // Store originating address (delivery message)
+
+ otherToReceive: Boolean; // GSM & CDMA & TDMA(?)
+
+ reportDeliveryIndicator: Boolean; // All
+
+ // Advanced parameters
+ standardType: UInt8;
+ advancedParams: TelSmsDeliveryMessageAdvancedParams;
+
+ extensionsCount: UInt8; // how many extensions in this message
+ extensionsP: ^TelSmsExtensionType; // SMS extensions array: NBS, Multi-part, etc.
+ end;
+
+ // Report message structure
+ TelSmsReportType = record
+ version: UInt16;
+ index: UInt16; // SMS index on the phone storage
+ reportType: UInt8; // Delivery report type
+ messageId: UInt32;
+
+ dataSize: UInt16; // Length of data being sent
+ data: ^UInt8;
+ dataCodingScheme: UInt8;
+
+ originatingAddress: PChar; // Store originating address
+ originatingAddressSize: UInt8;
+
+ report: UInt8;
+
+ timeStamp: TelSmsDateTimeType; // Time when SC received the corresponding sent message
+ end;
+
+ // multiple messages read
+ TelSmsReadMessagesType = record
+ first: UInt16; // first message physical index, zero based
+ count: UInt16; // number of messages to read
+ messagesP: ^TelSmsDeliveryMessageType; // messages array
+ end;
+
+ // multiple reports read
+ TelSmsReadReportsType = record
+ first: UInt16; // first report physical index, zero based
+ count: UInt16; // number of reports to read
+ reportsP: ^TelSmsReportType; // reports array
+ end;
+
+ // multiple submitted messages read
+ TelSmsReadSubmittedMessagesType = record
+ first: UInt16; // first sent message physical index, zero based
+ count: UInt16; // number of sent messages to read
+ submittedsP: ^TelSmsSubmittedMessageType; // sent messages array
+ end;
+
+ // get messages number/slots in selected storage
+ TelSmsGetMessageCountType = record
+ messageType: UInt8; // report, submitted, etc.
+ slots: UInt16; // number of entries in the selected storage
+ count: UInt16; // number of messages present in the selected storage
+ end;
+
+ // delete message selected storage
+ TelSmsDeleteMessageType = record
+ messageType: UInt8; // report, submitted, etc.
+ index: UInt16; // physical index in storage, zero based
+ end;
+
+ // available storage list
+ TelSmsGetAvailableStorageType = record
+ count: UInt16; // storage IDs array size (in), retrieved IDs number (out)
+ storagesP: ^UInt8; // storage IDs array
+ end;
+
+ // emergency call support
+ TelEmcGetNumberType = record
+ index: UInt8; // EMC number index, zero based
+ size: UInt8; // EMC dial number len including '\0' (out), value size (in)
+ value: PChar; // EMC dial number
+ end;
+
+ TelEmcSetNumberType = record
+ index: UInt8; // EMC number index, zero based
+ value: PChar; // EMC dial number
+ end;
+
+ // speech call support
+ TelSpcGetCallerNumberType = record
+ size: UInt8; // dial number len including '\0' (out), value size (in)
+ value: PChar; // dial number
+ end;
+
+ TelSpcPlayDTMFType = record
+ keyTone: UInt8; // keytone to be played
+ duration: UInt32; // play duration in 10 ms multiple
+ end;
+
+ // phonebook support
+ TelPhbEntryType = record
+ phoneIndex: UInt16; // entry's index in the phonebook, zero based
+ fullName: PChar;
+ fullNameSize: UInt8; // name len including '\0' (out), name size (in)
+ dialNumber: PChar;
+ dialNumberSize: UInt8; // dial number len including '\0' (out), dialNumber size (in)
+ end;
+
+ TelPhbGetEntryCountType = record
+ slots: UInt16; // number of entries in the selected phonebook
+ count: UInt16; // number of name/addresse pairs present in the selected phonebook
+ end;
+
+ TelPhbGetEntriesType = record
+ first: UInt16; // first entry physical index, zero based
+ count: UInt16; // number of name/addresse pairs
+ entriesP: ^TelPhbEntryType; // name/addresse pairs array
+ end;
+
+ TelPhbGetAvailablePhonebooksType = record
+ count: UInt16; // size of array (in), number of IDs (out)
+ phonebooksP: ^UInt8; // phonebook IDs array
+ end;
+
+ TelPhbGetEntryMaxSizesType = record
+ fullNameMaxSize: UInt8; // name len including '\0'
+ dialNumberMaxSize: UInt8; // dial number len including '\0'
+ end;
+
+ // sound support
+ TelSndPlayKeyToneType = record
+ keycode: UInt8; // what key
+ type_: UInt8; // what tone type
+ end;
+
+ // information support
+ TelInfGetInformationType = record
+ infoType: UInt8; // expected information, can be up to 2Kb (!)
+ size: UInt16; // value len including '\0' (out), value size (in)
+ value: PChar; // returned information string
+ end;
+
+ // data call support
+ TelDtcCallNumberType = record
+ dialNumberP: PChar; // number to dial
+ lineId: UInt8; // resulting line id, sent back in event
+ end;
+
+ TelDtcSendDataType = record
+ data: ^UInt8; // data to be sent
+ size: UInt32; // data size (in), data sent (out)
+ end;
+
+ TelDtcReceiveDataType = record
+ data: ^UInt8; // buffer to receive data
+ size: UInt32; // size of buffer (in), data size (out)
+ timeOut: Int32; // milliseconds to wait before exiting
+ end;
+
+ // OEM support
+ TelOemCallType = record
+ OemId: UInt32; // unique ID of OEM function set
+ funcId: UInt8; // function ID
+ paramP: Pointer; // parameters block
+ end;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/telephonymgrui.pp b/packages/palmunits/src/telephonymgrui.pp
new file mode 100644
index 0000000000..f838d4931b
--- /dev/null
+++ b/packages/palmunits/src/telephonymgrui.pp
@@ -0,0 +1,58 @@
+{$MACRO ON}
+
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TelephonyMgrUI.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This is the header
+ *
+ * History:
+ * May 23, 2000 ARO Initial Release
+ * May,30, 2000 PPL Add Pin code notification
+ * Nov 11, 2000 PPL Remove unused staff
+ * Dec 03, 2000 LFe add flags
+ *
+ *****************************************************************************)
+
+unit telephonymgrui;
+
+interface
+
+uses palmos;
+
+(***********************************************************************
+ * Structure definition - to move to a public header file
+ ***********************************************************************)
+
+const
+ kTelNotifyErrorDetailsVersion = 1;
+
+ telNotifyErrorEvent = Rsc('terr');
+ telNotifyEnterCodeEvent = Rsc('tpin');
+
+ kTelTryAgainBit = $00000001;
+ kTelNoSetUpButtonBit = $00000002;
+ kTelAutoTryAgainBit = $00000004;
+ kTelAutoSetUpButtonBit = $00000008;
+
+type
+ TelNotifyErrorDetailsType = record
+ version: UInt16;
+ error: Err;
+ ioFlags: UInt32;
+ messageP: PChar;
+ end;
+
+ TelNotifyErrorDetailsTag = TelNotifyErrorDetailsType;
+ TelNotifyErrorDetailsPtr = ^TelNotifyErrorDetailsType;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/textmgr.pp b/packages/palmunits/src/textmgr.pp
new file mode 100644
index 0000000000..47b21ef9fd
--- /dev/null
+++ b/packages/palmunits/src/textmgr.pp
@@ -0,0 +1,721 @@
+{$MACRO ON}
+
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TextMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+
+unit textmgr;
+
+interface
+
+uses palmos, coretraps, errorbase, intlmgr;
+
+(***********************************************************************
+ * Public types & constants
+ ***********************************************************************)
+
+// See PalmLocale.h for encoding constants of type CharEncodingType, and
+// character encoding names.
+type
+ CharEncodingType = UInt8;
+
+// 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).
+type
+ TranslitOpType = UInt16;
+
+// Standard transliteration operations.
+const
+ translitOpStandardBase = 0; // Beginning of standard operations.
+
+ translitOpUpperCase = 0;
+ translitOpLowerCase = 1;
+ translitOpReserved2 = 2;
+ translitOpReserved3 = 3;
+
+// Custom transliteration operations (defined in CharXXXX.h encoding-specific
+// header files.
+ translitOpCustomBase = 1000; // Beginning of char-encoding specific ops.
+
+ translitOpPreprocess = $8000; // 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.
+ kTxtConvertStateSize = 32;
+
+type
+ TxtConvertStateType = record
+ ioSrcState: array [0..kTxtConvertStateSize - 1] of UInt8;
+ ioDstState: array [0..kTxtConvertStateSize - 1] of UInt8;
+ end;
+
+// Flags available in the sysFtrNumCharEncodingFlags feature attribute.
+const
+ charEncodingOnlySingleByte = $00000001;
+ charEncodingHasDoubleByte = $00000002;
+ charEncodingHasLigatures = $00000004;
+ charEncodingLeftToRight = $00000008;
+
+// 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.
+ byteAttrFirst = $80; // First byte of multi-byte char.
+ byteAttrLast = $40; // Last byte of multi-byte char.
+ byteAttrMiddle = $20; // Middle byte of muli-byte char.
+ byteAttrSingle = $01; // Single byte.
+
+// Character attribute flags. These replace the old flags defined in
+// CharAttr.h, but are bit-compatible.
+ charAttr_XA = $0200; // extra alphabetic
+ charAttr_XS = $0100; // extra space
+ charAttr_BB = $0080; // BEL, BS, etc.
+ charAttr_CN = $0040; // CR, FF, HT, NL, VT
+ charAttr_DI = $0020; // '0'-'9'
+ charAttr_LO = $0010; // 'a'-'z' and lowercase extended chars.
+ charAttr_PU = $0008; // punctuation
+ charAttr_SP = $0004; // space
+ charAttr_UP = $0002; // 'A'-'Z' and uppercase extended chars.
+ charAttr_XD = $0001; // '0'-'9', 'A'-'F', 'a'-'f'
+
+// Various sets of character attribute flags.
+ charAttrPrint = charAttr_DI or charAttr_LO or charAttr_PU or charAttr_SP or charAttr_UP or charAttr_XA;
+ charAttrSpace = charAttr_CN or charAttr_SP or charAttr_XS;
+ charAttrAlNum = charAttr_DI or charAttr_LO or charAttr_UP or charAttr_XA;
+ charAttrAlpha = charAttr_LO or charAttr_UP or charAttr_XA;
+ charAttrCntrl = charAttr_BB or charAttr_CN;
+ charAttrGraph = charAttr_DI or charAttr_LO or charAttr_PU or charAttr_UP or charAttr_XA;
+ charAttrDelim = charAttr_SP or 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.
+
+//!!! sizeOf7BitChar(c) = 1;
+
+// Maximum size a single WChar character will occupy in a text string.
+ maxCharBytes = 3;
+
+// Text manager error codes.
+ txtErrUknownTranslitOp = txtErrorClass or 1;
+ txtErrTranslitOverrun = txtErrorClass or 2;
+ txtErrTranslitOverflow = txtErrorClass or 3;
+ txtErrConvertOverflow = txtErrorClass or 4;
+ txtErrConvertUnderflow = txtErrorClass or 5;
+ txtErrUnknownEncoding = txtErrorClass or 6;
+ txtErrNoCharMapping = txtErrorClass or 7;
+ txtErrTranslitUnderflow = txtErrorClass or 8;
+
+(***********************************************************************
+ * Public macros
+ ***********************************************************************)
+
+function TxtCharIsSpace(ch: WChar): Boolean;
+function TxtCharIsPrint(ch: WChar): Boolean;
+function TxtCharIsDigit(ch: WChar): Boolean;
+function TxtCharIsAlNum(ch: WChar): Boolean;
+function TxtCharIsAlpha(ch: WChar): Boolean;
+function TxtCharIsCntrl(ch: WChar): Boolean;
+function TxtCharIsGraph(ch: WChar): Boolean;
+function TxtCharIsLower(ch: WChar): Boolean;
+function TxtCharIsPunct(ch: WChar): Boolean;
+function TxtCharIsUpper(ch: WChar): Boolean;
+function TxtCharIsHex(ch: WChar): Boolean;
+function TxtCharIsDelim(ch: WChar): Boolean;
+
+// <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.
+
+function TxtCharIsHardKey(m, c: UInt16): Boolean;
+
+// <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
+function TxtCharIsVirtual(m, c: UInt16): Boolean;
+
+function TxtPreviousCharSize(const inText: PChar; inOffset: UInt32): UInt16;
+function TxtNextCharSize(const inText: PChar; inOffset: UInt32): UInt16;
+
+(***********************************************************************
+ * Public routines
+ ***********************************************************************)
+
+// DOLATER kwk - fix up parameter names to use i, o versus in, out
+
+// Return back byte attribute (first, last, single, middle) for <inByte>.
+
+function TxtByteAttr(inByte: UInt8): UInt8;
+
+// Return back the standard attribute bits for <inChar>.
+
+function TxtCharAttr(inChar: WChar): UInt16;
+
+// Return back the extended attribute bits for <inChar>.
+
+function TxtCharXAttr(inChar: WChar): UInt16;
+
+// Return the size (in bytes) of the character <inChar>. This represents
+// how many bytes would be required to store the character in a string.
+
+function TxtCharSize(inChar: WChar): UInt16;
+
+// Return the width (in pixels) of the character <inChar>. You should
+// use FntWCharWidth or FntGlueWCharWidth instead of this routine.
+
+function TxtCharWidth(inChar: WChar): Int16;
+
+// Load the character before offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+function TxtGetPreviousChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16;
+
+// Load the character at offset <inOffset> in the <inText> text. Return
+// back the size of the character.
+
+function TxtGetNextChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16;
+
+// Return the character at offset <inOffset> in the <inText> text.
+
+function TxtGetChar(const inText: PChar; inOffset: UInt32): WChar;
+
+// Set the character at offset <inOffset> in the <inText> text, and
+// return back the size of the character.
+
+function TxtSetNextChar(ioText: PChar; inOffset: UInt32; inChar: WChar): UInt16;
+
+// 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>.
+
+function TxtReplaceStr(ioStr: PChar; inMaxLen: UInt16; const inParamStr: PChar; inParamNum: UInt16): UInt16;
+
+// 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 "".
+
+function TxtParamString(const inTemplate, param0, param1, param2, param3: PChar): PChar;
+
+// 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>.
+
+function TxtCharBounds(const inText: PChar; inOffset: UInt32; var outStart: UInt32; var outEnd: UInt32): WChar;
+
+// Return the appropriate byte position for truncating <inText> such that it is
+// at most <inOffset> bytes long.
+
+function TxtGetTruncationOffset(const inText: PChar; inOffset: UInt32): UInt32;
+
+// 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>.
+
+function TxtFindString(const inSourceStr, inTargetStr: PChar;
+ var outPos: UInt32; var outLength: UInt16): Boolean;
+
+// 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).
+
+function TxtWordBounds(const inText: PChar; inLength, inOffset: UInt32;
+ var outStart, outEnd: UInt32): Boolean;
+
+// 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>.
+
+function TxtGetWordWrapOffset(const iTextP: PChar; iOffset: UInt32): UInt32;
+
+// Return the minimum (lowest) encoding required for <inChar>. If we
+// don't know about the character, return encoding_Unknown.
+
+function TxtCharEncoding(inChar: WChar): CharEncodingType;
+
+// 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.
+
+function TxtStrEncoding(const inStr: PChar): CharEncodingType;
+
+// Return the higher (max) encoding of <a> and <b>.
+
+function TxtMaxEncoding(a, b: CharEncodingType): CharEncodingType;
+
+// Return a pointer to the 'standard' name for <inEncoding>. If the
+// encoding is unknown, return a pointer to an empty string.
+
+function TxtEncodingName(inEncoding: CharEncodingType): PChar;
+
+// Map from a character set name <iEncodingName> to a CharEncodingType.
+// If the character set name is unknown, return charEncodingUnknown.
+
+function TxtNameToEncoding(const iEncodingName: PChar): CharEncodingType;
+
+// 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.
+
+function TxtTransliterate(const inSrcText: PChar; inSrcLength: UInt16; outDstText: PChar;
+ var ioDstLength: UInt16; inOp: TranslitOpType): Err;
+
+// 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.
+
+function TxtConvertEncoding(newConversion: Boolean; var ioStateP: TxtConvertStateType;
+ const srcTextP: PChar; var ioSrcBytes: UInt16; srcEncoding: CharEncodingType;
+ dstTextP: PChar; var ioDstBytes: UInt16; dstEncoding: CharEncodingType;
+ const substitutionStr: PChar; substitutionLen: UInt16): Err;
+
+// Return true if <inChar> is a valid (drawable) character. Note that we'll
+// return false if it is a virtual character code.
+
+function TxtCharIsValid(inChar: WChar): Boolean;
+
+// 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.
+
+function TxtCaselessCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16;
+
+// 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).
+
+function TxtCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16;
+
+implementation
+
+uses Chars, SysEvent;
+
+function __TxtByteAttr(inByte: UInt8): UInt8; syscall sysTrapIntlDispatch;
+function __TxtCharAttr(inChar: WChar): UInt16; syscall sysTrapIntlDispatch;
+function __TxtCharXAttr(inChar: WChar): UInt16; syscall sysTrapIntlDispatch;
+function __TxtCharSize(inChar: WChar): UInt16; syscall sysTrapIntlDispatch;
+function __TxtCharWidth(inChar: WChar): Int16; syscall sysTrapIntlDispatch;
+function __TxtGetPreviousChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16; syscall sysTrapIntlDispatch;
+function __TxtGetNextChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16; syscall sysTrapIntlDispatch;
+function __TxtGetChar(const inText: PChar; inOffset: UInt32): WChar; syscall sysTrapIntlDispatch;
+function __TxtSetNextChar(ioText: PChar; inOffset: UInt32; inChar: WChar): UInt16; syscall sysTrapIntlDispatch;
+function __TxtReplaceStr(ioStr: PChar; inMaxLen: UInt16; const inParamStr: PChar; inParamNum: UInt16): UInt16; syscall sysTrapIntlDispatch;
+function __TxtParamString(const inTemplate, param0, param1, param2, param3: PChar): PChar; syscall sysTrapIntlDispatch;
+function __TxtCharBounds(const inText: PChar; inOffset: UInt32; var outStart: UInt32; var outEnd: UInt32): WChar; syscall sysTrapIntlDispatch;
+function __TxtGetTruncationOffset(const inText: PChar; inOffset: UInt32): UInt32; syscall sysTrapIntlDispatch;
+function __TxtFindString(const inSourceStr, inTargetStr: PChar;
+ var outPos: UInt32; var outLength: UInt16): Boolean; syscall sysTrapIntlDispatch;
+function __TxtWordBounds(const inText: PChar; inLength, inOffset: UInt32;
+ var outStart, outEnd: UInt32): Boolean; syscall sysTrapIntlDispatch;
+function __TxtGetWordWrapOffset(const iTextP: PChar; iOffset: UInt32): UInt32; syscall sysTrapIntlDispatch;
+function __TxtCharEncoding(inChar: WChar): CharEncodingType; syscall sysTrapIntlDispatch;
+function __TxtStrEncoding(const inStr: PChar): CharEncodingType; syscall sysTrapIntlDispatch;
+function __TxtMaxEncoding(a, b: CharEncodingType): CharEncodingType; syscall sysTrapIntlDispatch;
+function __TxtEncodingName(inEncoding: CharEncodingType): PChar; syscall sysTrapIntlDispatch;
+function __TxtNameToEncoding(const iEncodingName: PChar): CharEncodingType; syscall sysTrapIntlDispatch;
+function __TxtTransliterate(const inSrcText: PChar; inSrcLength: UInt16; outDstText: PChar;
+ var ioDstLength: UInt16; inOp: TranslitOpType): Err; syscall sysTrapIntlDispatch;
+function __TxtConvertEncoding(newConversion: Boolean; var ioStateP: TxtConvertStateType;
+ const srcTextP: PChar; var ioSrcBytes: UInt16; srcEncoding: CharEncodingType;
+ dstTextP: PChar; var ioDstBytes: UInt16; dstEncoding: CharEncodingType;
+ const substitutionStr: PChar; substitutionLen: UInt16): Err; syscall sysTrapIntlDispatch;
+function __TxtCharIsValid(inChar: WChar): Boolean; syscall sysTrapIntlDispatch;
+
+function __TxtCaselessCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16; syscall sysTrapIntlDispatch;
+function __TxtCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16; syscall sysTrapIntlDispatch;
+
+function TxtByteAttr(inByte: UInt8): UInt8;
+begin
+ asm
+ move.l #$intlTxtByteAttr, D2;
+ end;
+ TxtByteAttr := TxtByteAttr(inByte);
+end;
+
+function TxtCharAttr(inChar: WChar): UInt16;
+begin
+ asm
+ move.l #$intlTxtCharAttr, D2;
+ end;
+ TxtCharAttr := __TxtCharAttr(inChar);
+end;
+
+function TxtCharXAttr(inChar: WChar): UInt16;
+begin
+ asm
+ move.l #$intlTxtCharXAttr, D2;
+ end;
+ TxtCharXAttr := __TxtCharXAttr(inChar);
+end;
+
+function TxtCharSize(inChar: WChar): UInt16;
+begin
+ asm
+ move.l #$intlTxtCharSize, D2;
+ end;
+ TxtCharSize := TxtCharSize(inChar);
+end;
+
+function TxtCharWidth(inChar: WChar): Int16;
+begin
+ asm
+ move.l #$intlTxtCharWidth, D2;
+ end;
+ TxtCharWidth := TxtCharWidth(inChar);
+end;
+
+function TxtGetPreviousChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16;
+begin
+ asm
+ move.l #$intlTxtGetPreviousChar, D2;
+ end;
+ TxtGetPreviousChar := __TxtGetPreviousChar(inText, inOffset, outChar);
+end;
+
+function TxtGetNextChar(const inText: PChar; inOffset: UInt32; outChar: WCharPtr): UInt16;
+begin
+ asm
+ move.l #$intlTxtGetNextChar, D2;
+ end;
+ TxtGetNextChar := __TxtGetNextChar(inText, inOffset, outChar);
+end;
+
+function TxtGetChar(const inText: PChar; inOffset: UInt32): WChar;
+begin
+ asm
+ move.l #$intlTxtGetChar, D2;
+ end;
+ TxtGetChar := __TxtGetChar(inText, inOffset);
+end;
+
+function TxtSetNextChar(ioText: PChar; inOffset: UInt32; inChar: WChar): UInt16;
+begin
+ asm
+ move.l #$intlTxtSetNextChar, D2;
+ end;
+ TxtSetNextChar := __TxtSetNextChar(ioText, inOffset, inChar);
+end;
+
+function TxtReplaceStr(ioStr: PChar; inMaxLen: UInt16; const inParamStr: PChar; inParamNum: UInt16): UInt16;
+begin
+ asm
+ move.l #$intlTxtReplaceStr, D2;
+ end;
+ TxtReplaceStr := __TxtReplaceStr(ioStr, inMaxLen, inParamStr, inParamNum);
+end;
+
+function TxtParamString(const inTemplate, param0, param1, param2, param3: PChar): PChar;
+begin
+ asm
+ move.l #$intlTxtParamString, D2;
+ end;
+ TxtParamString := __TxtParamString(inTemplate, param0, param1, param2, param3);
+end;
+
+function TxtCharBounds(const inText: PChar; inOffset: UInt32; var outStart: UInt32; var outEnd: UInt32): WChar;
+begin
+ asm
+ move.l #$intlTxtCharBounds, D2;
+ end;
+ TxtCharBounds := TxtCharBounds(inText, inOffset, outStart, outEnd);
+end;
+
+function TxtGetTruncationOffset(const inText: PChar; inOffset: UInt32): UInt32;
+begin
+ asm
+ move.l #$intlTxtGetTruncationOffset, D2;
+ end;
+ TxtGetTruncationOffset := __TxtGetTruncationOffset(inText, inOffset);
+end;
+
+function TxtFindString(const inSourceStr, inTargetStr: PChar;
+ var outPos: UInt32; var outLength: UInt16): Boolean;
+begin
+ asm
+ move.l #$intlTxtFindString, D2;
+ end;
+ TxtFindString := TxtFindString(inSourceStr, inTargetStr, outPos, outLength);
+end;
+
+function TxtWordBounds(const inText: PChar; inLength, inOffset: UInt32;
+ var outStart, outEnd: UInt32): Boolean;
+begin
+ asm
+ move.l #$intlTxtWordBounds, D2;
+ end;
+ TxtWordBounds := __TxtWordBounds(inText, inLength, inOffset, outStart, outEnd);
+end;
+
+function TxtGetWordWrapOffset(const iTextP: PChar; iOffset: UInt32): UInt32;
+begin
+ asm
+ move.l #$intlTxtGetWordWrapOffset, D2;
+ end;
+ TxtGetWordWrapOffset := __TxtGetWordWrapOffset(iTextP, iOffset);
+end;
+
+function TxtCharEncoding(inChar: WChar): CharEncodingType;
+begin
+ asm
+ move.l #$intlTxtCharEncoding, D2;
+ end;
+ TxtCharEncoding := __TxtCharEncoding(inChar);
+end;
+
+function TxtStrEncoding(const inStr: PChar): CharEncodingType;
+begin
+ asm
+ move.l #$intlTxtStrEncoding, D2;
+ end;
+ TxtStrEncoding := __TxtStrEncoding(inStr);
+end;
+
+function TxtMaxEncoding(a, b: CharEncodingType): CharEncodingType;
+begin
+ asm
+ move.l #$intlTxtMaxEncoding, D2;
+ end;
+ TxtMaxEncoding := __TxtMaxEncoding(a, b);
+end;
+
+function TxtEncodingName(inEncoding: CharEncodingType): PChar;
+begin
+ asm
+ move.l #$intlTxtEncodingName, D2;
+ end;
+ TxtEncodingName := __TxtEncodingName(inEncoding);
+end;
+
+function TxtNameToEncoding(const iEncodingName: PChar): CharEncodingType;
+begin
+ asm
+ move.l #$intlTxtNameToEncoding, D2;
+ end;
+ TxtNameToEncoding := __TxtNameToEncoding(iEncodingName);
+end;
+
+function TxtTransliterate(const inSrcText: PChar; inSrcLength: UInt16; outDstText: PChar;
+ var ioDstLength: UInt16; inOp: TranslitOpType): Err;
+begin
+ asm
+ move.l #$intlTxtTransliterate, D2;
+ end;
+ TxtTransliterate := __TxtTransliterate(inSrcText, inSrcLength, outDstText, ioDstLength, inOp);
+end;
+
+function TxtConvertEncoding(newConversion: Boolean; var ioStateP: TxtConvertStateType;
+ const srcTextP: PChar; var ioSrcBytes: UInt16; srcEncoding: CharEncodingType;
+ dstTextP: PChar; var ioDstBytes: UInt16; dstEncoding: CharEncodingType;
+ const substitutionStr: PChar; substitutionLen: UInt16): Err;
+begin
+ asm
+ move.l #$intlTxtConvertEncoding, D2;
+ end;
+ TxtConvertEncoding := __TxtConvertEncoding(newConversion, ioStateP, srcTextP, ioSrcBytes,
+ srcEncoding, dstTextP, ioDstBytes, dstEncoding,
+ substitutionStr, substitutionLen);
+end;
+
+function TxtCharIsValid(inChar: WChar): Boolean;
+begin
+ asm
+ move.l #$intlTxtCharIsValid, D2;
+ end;
+ TxtCharIsValid := __TxtCharIsValid(inChar);
+end;
+
+function TxtCaselessCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16;
+begin
+ asm
+ move.l #$intlTxtCaselessCompare, D2;
+ end;
+ TxtCaselessCompare := __TxtCaselessCompare(s1, s1Len, s1MatchLen, s2, s2Len, s2MatchLen);
+end;
+
+function TxtCompare(const s1: PChar; s1Len: UInt16; var s1MatchLen: UInt16;
+ const s2: PChar; s2Len: UInt16; var s2MatchLen: UInt16): Int16;
+begin
+ asm
+ move.l #$intlTxtCompare, D2;
+ end;
+ TxtCompare := __TxtCompare(s1, s1Len, s1MatchLen, s2, s2Len, s2MatchLen);
+end;
+
+function TxtCharIsSpace(ch: WChar): Boolean;
+begin
+ TxtCharIsSpace := (TxtCharAttr(ch) and charAttrSpace) <> 0;
+end;
+
+function TxtCharIsPrint(ch: WChar): Boolean;
+begin
+ txtCharIsPrint := (TxtCharAttr(ch) and charAttrPrint) <> 0;
+end;
+
+function TxtCharIsDigit(ch: WChar): Boolean;
+begin
+ TxtCharIsDigit := (TxtCharAttr(ch) and charAttr_DI) <> 0;
+end;
+
+function TxtCharIsAlNum(ch: WChar): Boolean;
+begin
+ TxtCharIsAlNum := (TxtCharAttr(ch) and charAttrAlNum) <> 0;
+end;
+
+function TxtCharIsAlpha(ch: WChar): Boolean;
+begin
+ TxtCharIsAlpha := (TxtCharAttr(ch) and charAttrAlpha) <> 0;
+end;
+
+function TxtCharIsCntrl(ch: WChar): Boolean;
+begin
+ txtCharIsCntrl := (TxtCharAttr(ch) and charAttrCntrl) <> 0;
+end;
+
+function TxtCharIsGraph(ch: WChar): Boolean;
+begin
+ TxtCharIsGraph := (TxtCharAttr(ch) and charAttrGraph) <> 0;
+end;
+
+function TxtCharIsLower(ch: WChar): Boolean;
+begin
+ TxtCharIsLower := (TxtCharAttr(ch) and charAttr_LO) <> 0;
+end;
+
+function TxtCharIsPunct(ch: WChar): Boolean;
+begin
+ TxtCharIsPunct := (TxtCharAttr(ch) and charAttr_PU) <> 0;
+end;
+
+function TxtCharIsUpper(ch: WChar): Boolean;
+begin
+ TxtCharIsUpper := (TxtCharAttr(ch) and charAttr_UP) <> 0;
+end;
+
+function TxtCharIsHex(ch: WChar): Boolean;
+begin
+ TxtCharIsHex := (TxtCharAttr(ch) and charAttr_XD) <> 0;
+end;
+
+function TxtCharIsDelim(ch: WChar): Boolean;
+begin
+ TxtCharIsDelim := (TxtCharAttr(ch) and charAttrDelim) <> 0;
+end;
+
+function TxtCharIsHardKey(m, c: UInt16): Boolean;
+begin
+ TxtCharIsHardKey := ((m and commandKeyMask) <> 0) and ((c >= hardKeyMin) and ((c <= hardKeyMax) or (c = calcChr)));
+end;
+
+function TxtCharIsVirtual(m, c: UInt16): Boolean;
+begin
+ TxtCharIsVirtual := (m and commandKeyMask) <> 0;
+end;
+
+function TxtPreviousCharSize(const inText: PChar; inOffset: UInt32): UInt16;
+begin
+ TxtPreviousCharSize := TxtGetPreviousChar(inText, inOffset, nil);
+end;
+
+function TxtNextCharSize(const inText: PChar; inOffset: UInt32): UInt16;
+begin
+ TxtNextCharSize := TxtGetNextChar(inText, inOffset, nil);
+end;
+
+end.
diff --git a/packages/palmunits/src/textservicesmgr.pp b/packages/palmunits/src/textservicesmgr.pp
new file mode 100644
index 0000000000..61d6677db7
--- /dev/null
+++ b/packages/palmunits/src/textservicesmgr.pp
@@ -0,0 +1,118 @@
+{$MACRO ON}
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TextServicesMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header file for Text Services Manager. This provides the caller with
+ * an API for interacting with various text services, including front-end
+ * processors (FEPs), which are sometimes known as input methods.
+ *
+ * History:
+ * 03/05/98 kwk Created by Ken Krugler.
+ * 02/03/99 kwk Changed name to TextServicesMgr.h, was TextServices.h.
+ * 10/20/99 kwk Moved private stuff into TextServicesPrv.h
+ * 04/19/00 kwk Use portable typedef for TsmSelector and TsmFepModeType.
+ * Fixed up descriptions for TsmGet/SetFepMode. Added new
+ * selectors for TsmInit, TsmDrawMode, TsmFepHandleEvent,
+ * TsmFepTerminate, and TsmFepCommit.
+ * 07/06/00 kwk Set type of unused status ptr param to be void*, and
+ * moved TsmFepStatusType into the private header file.
+ * 08/21/00 kwk Moved tsmFtrCreator here from TextServicesPrv.h.
+ * Added tsmFtrNumFlags, tsmFtrFlagsHasFep.
+ * 11/15/00 kwk Added tsmGet/SetSystemFep, tsmGet/SetCurrentFep selectors.
+ *
+ *****************************************************************************)
+
+unit textservicesmgr;
+
+interface
+
+uses palmos, coretraps, systemresources;
+
+(***********************************************************************
+ * Public constants
+ ***********************************************************************)
+
+// Feature Creators and numbers, for use with the FtrGet() call.
+const
+ tsmFtrCreator = sysFileCTextServices;
+
+// Selector used with call to FtrGet(tsmFtrCreator, xxx) to get the
+// Text Services Manager flags.
+ tsmFtrNumFlags = 0;
+
+// Flags returned by FtrGet(tsmFtrCreator, tsmFtrNumFlags) call.
+ tsmFtrFlagsHasFep = $1; // Bit set if FEP is installed.
+
+// Selectors for routines found in the Text Services manager. The order
+// of these selectors MUST match the jump table in TextServicesMgr.c.
+type
+ TsmSelector = UInt16;
+
+const
+ tsmGetFepMode_ = 0;
+ tsmSetFepMode_ = 1;
+ tsmHandleEvent = 2;
+ tsmInit = 3; // new in 4.0
+ tsmDrawMode = 4; // new in 4.0
+ tsmGetSystemFep = 5; // new in 4.0
+ tsmSetSystemFep = 6; // new in 4.0
+ tsmGetCurrentFep = 7; // new in 4.0
+ tsmSetCurrentFep = 8; // new in 4.0
+
+ tsmMaxSelector = tsmSetCurrentFep;
+
+// Input mode - used with TsmGet/SetFepMode.
+type
+ TsmFepModeType = UInt16;
+
+const
+ tsmFepModeDefault = TsmFepModeType(0);
+ tsmFepModeOff = TsmFepModeType(1);
+ tsmFepModeCustom = TsmFepModeType(128);
+
+(***********************************************************************
+ * Public types
+ ***********************************************************************)
+
+(***********************************************************************
+ * Public routines
+ ***********************************************************************)
+
+// Return the current mode for the active FEP. The <nullParam> parameter
+// is unused and must be set to NULL.
+function TsmGetFepMode(nullParam: Pointer): TsmFepModeType;
+
+// Set the mode for the active FEP to be <inNewMode>. The previous mode
+// is returned. The <nullParam> parameter is unused and must be set
+// to NULL.
+function TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType;
+
+implementation
+
+function __TsmGetFepMode(nullParam: Pointer): TsmFepModeType; syscall sysTrapTsmDispatch;
+function __TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType; syscall sysTrapTsmDispatch;
+
+function TsmGetFepMode(nullParam: Pointer): TsmFepModeType;
+begin
+ asm
+ move.l #$tsmGetFepMode_, D2;
+ end;
+ TsmGetFepMode := __TsmGetFepMode(nullParam);
+end;
+
+function TsmSetFepMode(nullParam: Pointer; inNewMode: TsmFepModeType): TsmFepModeType;
+begin
+ asm
+ move.l #$tsmSetFepMode_, D2;
+ end;
+ TsmSetFepMode := __TsmSetFepMode(nullParam, inNewMode);
+end;
+
+end.
diff --git a/packages/palmunits/src/timemgr.pp b/packages/palmunits/src/timemgr.pp
new file mode 100644
index 0000000000..2b877bfef5
--- /dev/null
+++ b/packages/palmunits/src/timemgr.pp
@@ -0,0 +1,58 @@
+{$MACRO ON}
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: TimeMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Time manager functions
+ *
+ * History:
+ * 1/19/95 roger - Created by Roger Flores
+ *
+ *****************************************************************************)
+
+unit timemgr;
+
+interface
+
+uses palmos, coretraps, errorbase;
+
+(************************************************************
+ * Time Manager result codes
+ * (timErrorClass is defined in SystemMgr.h)
+ *************************************************************)
+
+const
+ timErrMemory = timErrorClass or 1;
+
+(************************************************************
+ * Function Prototypes
+ *************************************************************)
+
+//-------------------------------------------------------------------
+// Initialization
+//-------------------------------------------------------------------
+
+function TimInit: Err; syscall sysTrapTimInit;
+
+//-------------------------------------------------------------------
+// API
+//-------------------------------------------------------------------
+
+// seconds since 1/1/1904
+function TimGetSeconds: UInt32; syscall sysTrapTimGetSeconds;
+
+// seconds since 1/1/1904
+procedure TimSetSeconds(seconds: UInt32); syscall sysTrapTimSetSeconds;
+
+// ticks since power on
+function TimGetTicks: UInt32; syscall sysTrapTimGetTicks;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/udamgr.pp b/packages/palmunits/src/udamgr.pp
new file mode 100644
index 0000000000..aa0b4b2030
--- /dev/null
+++ b/packages/palmunits/src/udamgr.pp
@@ -0,0 +1,197 @@
+{$MACRO ON}
+ (***********************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: UDAMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Unified Data Manager header file
+ * Define type and generic macro to access data
+ *
+ * History:
+ * Jun 08, 2000 Created by Alain BASTY
+ *
+ ************************************************************************)
+
+unit udamgr;
+
+interface
+
+uses palmos, coretraps, errorbase, exgmgr;
+
+ (***********************************************************************
+ * Generic options flags
+ ************************************************************************)
+
+const
+ kUDAEndOfReader = 1;
+ kUDAMoreData = 2;
+
+ (***********************************************************************
+ * Generic control
+ ************************************************************************)
+
+const
+ kUDAReinitialize = 1;
+
+ (***********************************************************************
+ * Generic error codes
+ ************************************************************************)
+
+const
+ udaErrControl = udaErrorClass or 1;
+
+ (***********************************************************************
+ * General types
+ ************************************************************************)
+
+type
+ UDABufferSize = UInt16;
+
+const
+ kUDAZeroTerminatedBuffer = $FFFF;
+
+ (***********************************************************************
+ * Types of callback functions
+ ************************************************************************)
+
+type
+ UDAObjectPtr = ^UDAObjectType;
+ UDAReaderPtr = ^UDAReaderType;
+ UDAWriterPtr = ^UDAWriterType;
+
+ UDADeleteFunction = procedure (var ioObject: UDAObjectPtr);
+//!!! UDAControlFunction = function (ioObject: UDAObjectPtr; parameter: UInt16; args: va_list): Err;
+
+ UDAReadFunction = function (ioReader: UDAReaderPtr; var buffer: UInt8; bufferSize: UDABufferSize; var error: Err): UDABufferSize;
+
+ UDAWriteFunction = function (ioWriter: UDAWriterPtr): Err;
+ UDAFlushFunction = function (ioWriter: UDAWriterPtr): Err;
+
+ UDAObjectType = record
+ optionFlags: UInt16;
+ deleteF: UDADeleteFunction;
+ controlF: Pointer; //!!!UDAControlFunction;
+ end;
+ UDAObjectTag = UDAObjectType;
+
+ UDAReaderType = record
+ // The Reader is a base object
+ optionFlags: UInt16 ;
+ deleteF: UDADeleteFunction;
+ controlF: Pointer; //!!!UDAControlFunction;
+
+ // Specific Reader fields
+ readF: UDAReadFunction;
+ end;
+ UDAReaderTag = UDAReaderType;
+
+ UDAFilterType = record
+ // The Filter is a base Object
+ optionFlags: UInt16;
+ deleteF: UDADeleteFunction;
+ controlF: Pointer; //!!!UDAControlFunction;
+
+ // The Filter is a Reader
+ readF: UDAReadFunction;
+
+ // Specific Filter fields
+ upperReader: ^UDAReaderType;
+ end;
+ UDAFilterTag = UDAFilterType;
+
+ UDAWriterType = record
+ // The Writer is a base Object
+ optionFlags: UInt16;
+ deleteF: UDADeleteFunction;
+ controlF: Pointer; //!!!UDAControlFunction;
+
+ // Specific Writer fields
+ initiateWriteF: UDAWriteFunction;
+ flushF: UDAFlushFunction;
+ upperReader: ^UDAReaderType;
+ end;
+ UDAWriterTag = UDAWriterType;
+
+ (***********************************************************************
+ * Generic macro to access generic functions
+ ************************************************************************)
+
+(*
+#define UDADelete(ioObject) (( *(ioObject->deleteF))((UDAObjectType** )(&(ioObject))))
+
+#define UDARead(ioReader, bufferToFillP, bufferSizeInBytes, error) (( *(ioReader->readF))((UDAReaderType* )(ioReader), (bufferToFillP), (bufferSizeInBytes), (error)))
+
+#define UDAEndOfReader(ioReader) (((ioReader)->optionFlags & kUDAEndOfReader) != 0)
+
+#define UDAMoreData(ioReader) (((ioReader)->optionFlags & kUDAMoreData) != 0)
+
+#define UDAFilterJoin(ioFilter, ioReader) (((UDAFilterType* )(ioFilter))->upperReader = ioReader)
+
+#define UDAWriterJoin(ioWriter, ioReader) (ioWriter->upperReader = ioReader)
+
+#define UDAInitiateWrite(ioWriter) (( *(ioWriter)->initiateWriteF))(ioWriter)
+
+#define UDAWriterFlush(ioWriter) (( *(ioWriter)->flushF))(ioWriter)
+*)
+
+(*****************************************************************
+ * UDA API
+ ****************************************************************)
+
+// Public UDAMgr function selectors
+const
+ sysUdaControl = 0;
+ sysUdaMemoryReaderNew = 1;
+ sysUdaExchangeReaderNew = 11;
+ sysUdaExchangeWriterNew = 12;
+
+// UDAMgr function prototypes
+
+//!!! function UDAControl(var ioObject: UDAObjectType; parameter: UInt16, ...): Err; syscall sysTrapUdaMgrDispatch, sysUdaControl;
+
+function UDAExchangeReaderNew(var socket: ExgSocketType): UDAReaderPtr;
+
+function UDAExchangeWriterNew(var socket: ExgSocketType; bufferSize: UDABufferSize): UDAWriterPtr;
+
+ (***********************************************************************
+ * Memory reader
+ ************************************************************************)
+
+function UDAMemoryReaderNew(var bufferP: UInt8; bufferSizeInBytes: UDABufferSize): UDAReaderPtr;
+
+implementation
+
+function __UDAExchangeReaderNew(var socket: ExgSocketType): UDAReaderPtr; syscall sysTrapUdaMgrDispatch;
+function __UDAExchangeWriterNew(var socket: ExgSocketType; bufferSize: UDABufferSize): UDAWriterPtr; syscall sysTrapUdaMgrDispatch;
+function __UDAMemoryReaderNew(var bufferP: UInt8; bufferSizeInBytes: UDABufferSize): UDAReaderPtr; syscall sysTrapUdaMgrDispatch;
+
+function UDAExchangeReaderNew(var socket: ExgSocketType): UDAReaderPtr;
+begin
+ asm
+ move.l #$sysUdaExchangeReaderNew, D2;
+ end;
+ UDAExchangeReaderNew := __UDAExchangeReaderNew(socket);
+end;
+
+function UDAExchangeWriterNew(var socket: ExgSocketType; bufferSize: UDABufferSize): UDAWriterPtr;
+begin
+ asm
+ move.l #$sysUdaExchangeWriterNew, D2;
+ end;
+ UDAExchangeWriterNew := __UDAExchangeWriterNew(socket, bufferSize);
+end;
+
+function UDAMemoryReaderNew(var bufferP: UInt8; bufferSizeInBytes: UDABufferSize): UDAReaderPtr;
+begin
+ asm
+ move.l #$sysUdaMemoryReaderNew, D2;
+ end;
+ UDAMemoryReaderNew := __UDAMemoryReaderNew(bufferP, bufferSizeInBytes);
+end;
+
+end.
diff --git a/packages/palmunits/src/uicolor.pp b/packages/palmunits/src/uicolor.pp
new file mode 100644
index 0000000000..2d98b2a98e
--- /dev/null
+++ b/packages/palmunits/src/uicolor.pp
@@ -0,0 +1,88 @@
+{$MACRO ON}
+(******************************************************************************
+ *
+ * Copyright (c) 1999-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: UIColor.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines structs and functions for setting the "system
+ * colors" that the UI routines use.
+ *
+ * History:
+ * January 20, 1999 Created by Bob Ebert
+ * 08/21/99 kwk Added UIFieldFepRawText...UIFieldFepConvertedBackground
+ * to the UIColorTableEntries enum.
+ * 10/09/99 kwk Added UIFieldFepUnderline to UIColorTableEntries enum.
+ *
+ *****************************************************************************)
+
+unit uicolor;
+
+interface
+
+uses palmos, coretraps, bitmap, window;
+
+type
+ UIColorTableEntries = Enum;
+
+const
+ UIObjectFrame = 0;
+ UIObjectFill = Succ(UIObjectFrame);
+ UIObjectForeground = Succ(UIObjectFill);
+ UIObjectSelectedFill = Succ(UIObjectForeground);
+ UIObjectSelectedForeground = Succ(UIObjectSelectedFill);
+
+ UIMenuFrame = Succ(UIObjectSelectedForeground);
+ UIMenuFill = Succ(UIMenuFrame);
+ UIMenuForeground = Succ(UIMenuFill);
+ UIMenuSelectedFill = Succ(UIMenuForeground);
+ UIMenuSelectedForeground = Succ(UIMenuSelectedFill);
+
+ UIFieldBackground = Succ(UIMenuSelectedForeground);
+ UIFieldText = Succ(UIFieldBackground);
+ UIFieldTextLines = Succ(UIFieldText);
+ UIFieldCaret = Succ(UIFieldTextLines);
+ UIFieldTextHighlightBackground = Succ(UIFieldCaret);
+ UIFieldTextHighlightForeground = Succ(UIFieldTextHighlightBackground);
+ UIFieldFepRawText = Succ(UIFieldTextHighlightForeground);
+ UIFieldFepRawBackground = Succ(UIFieldFepRawText);
+ UIFieldFepConvertedText = Succ(UIFieldFepRawBackground);
+ UIFieldFepConvertedBackground = Succ(UIFieldFepConvertedText);
+ UIFieldFepUnderline = Succ(UIFieldFepConvertedBackground);
+
+ UIFormFrame = Succ(UIFieldFepUnderline);
+ UIFormFill = Succ(UIFormFrame);
+
+ UIDialogFrame = Succ(UIFormFill);
+ UIDialogFill = Succ(UIDialogFrame);
+
+ UIAlertFrame = Succ(UIDialogFill);
+ UIAlertFill = Succ(UIAlertFrame);
+
+ UIOK = Succ(UIAlertFill);
+ UICaution = Succ(UIOK);
+ UIWarning = Succ(UICaution);
+
+ UILastColorTableEntry = Succ(UIWarning);
+
+//------------------------------------------------------------
+// UI Color Table Manipulation Routines
+//------------------------------------------------------------
+
+function UIColorGetTableEntryIndex(which: UIColorTableEntries): IndexedColorType; syscall sysTrapUIColorGetTableEntryIndex;
+
+procedure UIColorGetTableEntryRGB(which: UIColorTableEntries; var rgbP: RGBColorType); syscall sysTrapUIColorGetTableEntryRGB;
+
+function UIColorSetTableEntry(which: UIColorTableEntries; {const} var rgbP: RGBColorType): Err; syscall sysTrapUIColorSetTableEntry;
+
+function UIColorPushTable: Err; syscall sysTrapUIColorPushTable;
+
+function UIColorPopTable: Err; syscall sysTrapUIColorPopTable;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/uicontrols.pp b/packages/palmunits/src/uicontrols.pp
new file mode 100644
index 0000000000..4dd6ed765b
--- /dev/null
+++ b/packages/palmunits/src/uicontrols.pp
@@ -0,0 +1,47 @@
+{$MACRO ON}
+(******************************************************************************
+ *
+ * Copyright (c) 1998-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: UIControls.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Contrast & brightness control for devices with
+ * software contrast.
+ *
+ * History:
+ * Name Date Description
+ * ---- ---- -----------
+ * bob 02/12/98 Initial version
+ * bob 03/15/99 Added brightness
+ * bob 08/27/99 Added UIPickColor, renamed UIControls.h
+ *
+ *****************************************************************************)
+
+unit uicontrols;
+
+interface
+
+uses palmos, coretraps, bitmap, window;
+
+// for UIPickColor
+const
+ UIPickColorStartPalette = 0;
+ UIPickColorStartRGB = 1;
+
+type
+ UIPickColorStartType = UInt16;
+
+procedure UIContrastAdjust; syscall sysTrapUIContrastAdjust;
+
+procedure UIBrightnessAdjust; syscall sysTrapUIBrightnessAdjust;
+
+function UIPickColor(var indexP: IndexedColorType; var rgbP: RGBColorType;
+ start: UIPickColorStartType; const titleP, tipP: PChar): Boolean; syscall sysTrapUIPickColor;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/uiresources.pp b/packages/palmunits/src/uiresources.pp
new file mode 100644
index 0000000000..c2a533ae75
--- /dev/null
+++ b/packages/palmunits/src/uiresources.pp
@@ -0,0 +1,310 @@
+{$MACRO ON}
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 1995-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: UIResources.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * This file defines UI resource types & ids.
+ *
+ * History:
+ * ??/??/?? ??? Created.
+ * 06/29/99 CS Added constantRscType & ResLoadConstant().
+ * 07/07/99 kwk Added fepFieldExtraBytesID, maxCategoryWidthID,
+ * extraStackSpaceID.
+ * 07/09/99 kwk Added silkscreenRscType & formRscType.
+ * 07/12/99 kwk Added sysFatalAlert.
+ * 07/18/99 kwk Added strListRscType, system string list resources.
+ * 08/08/99 kwk Added sysEditMenuJapAddWord/LookupWord.
+ * 09/07/99 kwk Added StrippedBase/GenericLaunchErrAlert
+ * 09/17/99 jmp Added a new NoteView form and menu to eliminate the goto
+ * top/bottom menu items and other extraneous UI elements
+ * that we no longer use in the built-in apps. We need to keep
+ * the old NoteView form and menu around for backwards
+ * compatibility.
+ * 12/10/99 kwk Deleted silkscreenRscType, use sysResTSilkscreen instead.
+ * 07/06/00 kwk Deleted fepFieldExtraBytesID and extraStackSpaceID, since
+ * these are now features.
+ * 07/12/00 gap Remove unused MenuCtlRsc definition (tcbr).
+ * 07/12/00 gap Remove unused MenuCtlRsc definition (tcbr).
+ * 09/04/00 ppl Add constant for Current and default profiel name for ConnectionMgr
+ * 09/07/00 kwk Deleted daysOfWeekStrID, dayFullNamesStrID, monthNamesStrID,
+ * and monthFullNamesStrID, since these are no longer in the
+ * ROM as of 4.0 (tSTR=10000...10003).
+ *
+ *****************************************************************************)
+
+unit uiresources;
+
+interface
+
+uses palmos, coretraps;
+
+// System Default app icon (for apps missing a tAIB)
+const
+ defaultAppIconBitmap = 10000;
+ defaultAppSmallIconBitmap = 10001;
+
+// System version string ID - this is hidden in
+// the SystemVersion.rsrc resource, because the 'system' resources
+// don't have ResEdit formats.
+ systemVersionID = 10000;
+
+//------------------------------------------------------------
+// Resource Type Constants
+//------------------------------------------------------------
+
+ strRsc = Rsc('tSTR');
+ ainRsc = Rsc('tAIN');
+ iconType = Rsc('tAIB');
+ bitmapRsc = Rsc('Tbmp');
+ bsBitmapRsc = Rsc('Tbsb');
+ alertRscType = Rsc('Talt');
+ kbdRscType = Rsc('tkbd');
+ MenuRscType = Rsc('MBAR');
+ fontRscType = Rsc('NFNT');
+ verRsc = Rsc('tver');
+ appInfoStringsRsc = Rsc('tAIS');
+ fontIndexType = Rsc('fnti');
+ midiRsc = Rsc('MIDI');
+ colorTableRsc = Rsc('tclt');
+
+ constantRscType = Rsc('tint');
+ formRscType = Rsc('tFRM');
+
+ strListRscType = Rsc('tSTL');
+ wrdListRscType = Rsc('wrdl');
+ defaultCategoryRscType = Rsc('taic');
+ binaryGeneralRscType = Rsc('tbin');
+
+//------------------------------------------------------------
+// App Version Constants
+//------------------------------------------------------------
+
+ appVersionID = 1; // our apps use tver 1 resource
+ appVersionAlternateID = 1000; // CW Constructor uses tver 1000 resource
+ // so we'll look for ours first, then try theirs
+ ainID = 1000;
+
+ oemVersionID = 10001; // Per-DB version provided by OEMs
+
+//------------------------------------------------------------
+// System Information Constants
+//------------------------------------------------------------
+
+ maxCategoryWidthID = 10001; // Max pixel width for category trigger.
+
+//------------------------------------------------------------
+// System Alerts
+//------------------------------------------------------------
+
+ SelectACategoryAlert = 10000;
+
+// This alert broke 1.0 applications and is now disabled until later.
+// It is redefined below (10015).
+// RemoveCategoryAlert = 10001;
+// RemoveCategoryRecordsButton = 0;
+// RemoveCategoryNameButton = 1;
+// RemoveCategoryCancelButton = 2;
+
+ LowBatteryAlert = 10002;
+ VeryLowBatteryAlert = 10003;
+ UndoAlert = 10004;
+ UndoCancelButton = 1;
+
+ MergeCategoryAlert = 10005;
+ MergeCategoryYes = 0;
+ MergeCategoryNo = 1;
+
+ privateRecordInfoAlert = 10006;
+
+ ClipboardLimitAlert = 10007;
+
+ CategoryExistsAlert = 10012;
+
+ DeviceFullAlert = 10013;
+
+ categoryAllUsedAlert = 10014;
+
+ RemoveCategoryAlert = 10015; // See alert 10001
+ RemoveCategoryYes = 0;
+ RemoveCategoryNo = 1;
+
+ DemoUnitAlert = 10016;
+
+// The "no data to send" message is a shared error message that is displayed
+// when no data is selected when a beam or send command is issued.
+ NoDataToBeamAlert = 10017;
+ NoDataToSendAlert = 10017;
+
+// New for PalmOS 3.1
+ LowCradleChargedBatteryAlert = 10018; // (Not present in Palm VII)
+ VeryLowCradleChargedBatteryAlert = 10019; // (Not present in Palm VII)
+
+// New for PalmOS 3.1 (Instant Karma only)
+ CategoryTooLongAlert = 10020; // (Not present in Palm VII)
+
+// New for PalmOS 3.2 - Alerts used by the ErrAlertCustom() call.
+ ErrOKAlert = 10021; // Error Alert with just an OK button
+ ErrOKCancelAlert = 10022; // Error Alert with an OK & Cancel button
+ ErrCancelAlert = 10023; // Error Alert with just Cancel button. Special case for antenna down alert.
+ InfoOKAlert = 10024; // Info alert with just an OK button
+ InfoOKCancelAlert = 10025; // Info alert with an OK & Cancel button
+ InfoCancelAlert = 10026; // Info alert with just a Cancel button
+ PrivacyWarningAlert = 10027; // Privacy warning for weblib
+ ConfirmationOKAlert = 10028; // Confirmation alert with just an OK button
+ ConfirmationOKCancelAlert = 10029; // Confirmation alert with an OK & Cancel button
+ ConfirmationCancelAlert = 10030; // Confirmation alert with just a Cancel button
+ WarningOKAlert = 10031; // Warning Alert with just an OK button
+ WarningOKCancelAlert = 10032; // Warning Alert with an OK & Cancel button
+ WarningCancelAlert = 10033; // Warning Alert with just Cancel button. Special case for antenna down alert.
+
+// New for PalmOS 3.5 - Launch error alerts
+ StrippedBaseLaunchErrAlert = 10034; // Launch error because of stripped base.
+ GenericLaunchErrAlert = 10035; // Generic launch error.
+
+// New for PalmOS 3.5 - Fatal Alert template
+ sysFatalAlert_ = 10100; // Template for fatal alert
+
+// New for PalmOS 3.5 - Alerts used by new security traps
+ secInvalidPasswordAlert = 13250;
+ secGotoInvalidRecordAlert = 13251;
+ secShowPrivatePermanentPassEntryAlert = 13261;
+ secShowMaskedPrivatePermanentPassEntryAlert = 13265;
+ secHideRecordsAlert = 13268;
+ secMaskRecordsAlert = 13269;
+ secHideMaskRecordsOK = 0;
+ secHideMaskRecordsCancel = 1;
+
+// New for PalmOS 4.0 - General purpose password prompt alert
+ secEnterPasswordAlert = 13300;
+ secEnterPasswordOK = 0;
+ secEnterPasswordCancel = 1;
+
+// command-bar bitmaps
+ BarCutBitmap = 10030;
+ BarCopyBitmap = 10031;
+ BarPasteBitmap = 10032;
+ BarUndoBitmap = 10033;
+ BarBeamBitmap = 10034;
+ BarSecureBitmap = 10035;
+ BarDeleteBitmap = 10036;
+ BarInfoBitmap = 10037;
+
+//Masking bitmaps
+ SecLockBitmap = 10050;
+ SecLockWidth = 6;
+ SecLockHeight = 8;
+
+// System Menu Bar and Menus
+ sysEditMenuID = 10000;
+ sysEditMenuUndoCmd = 10000;
+ sysEditMenuCutCmd = 10001;
+ sysEditMenuCopyCmd = 10002;
+ sysEditMenuPasteCmd = 10003;
+ sysEditMenuSelectAllCmd = 10004;
+ sysEditMenuSeparator = 10005;
+ sysEditMenuKeyboardCmd = 10006;
+ sysEditMenuGraffitiCmd = 10007;
+
+ sysNetworkProgress01Bitmap = 10020;
+ sysNetworkProgress02Bitmap = 10021;
+ sysNetworkProgress03Bitmap = 10022;
+ sysNetworkProgress04Bitmap = 10023;
+ sysNetworkProgress05Bitmap = 10024;
+ sysNetworkProgress06Bitmap = 10025;
+
+// Dynamically added to System Edit menu at runtime
+ sysEditMenuJapAddWord = 10100;
+ sysEditMenuJapLookupWord = 10101;
+
+// Note View Menu Bar and Menus
+ noteMenuID = 10200; // Old NoteView MenuBar
+ noteUndoCmd = sysEditMenuUndoCmd;
+ noteCutCmd = sysEditMenuCutCmd;
+ noteCopyCmd = sysEditMenuCopyCmd;
+ notePasteCmd = sysEditMenuPasteCmd;
+ noteSelectAllCmd = sysEditMenuSelectAllCmd;
+ noteSeparator = sysEditMenuSeparator;
+ noteKeyboardCmd = sysEditMenuKeyboardCmd;
+ noteGraffitiCmd = sysEditMenuKeyboardCmd;
+
+ noteFontCmd = 10200; // These are here for backwards
+ noteTopOfPageCmd = 10201; // compatibility. The built-in
+ noteBottomOfPageCmd = 10202; // apps no longer use them.
+ notePhoneLookupCmd = 10203;
+
+ newNoteMenuID = 10300; // The Edit Menu for the new NoteView.
+ newNoteFontCmd = 10300; // MenuBar is the same as it is for
+ newNotePhoneLookupCmd = 10301; // the old NoteView MenuBar.
+
+// Note View (used by Datebook, To Do, Address, and Expense apps)
+ NoteView = 10900; // The new NoteView is "new" as of Palm OS 3.5.
+ NewNoteView = 10950; // Same as old NoteView, but points to newNoteMenuID and doesn't ref UI objects listed below.
+ NoteField = 10901;
+ NoteDoneButton = 10902;
+ NoteSmallFontButton = 10903; // Not in NewNoteView, use FontCmd instead.
+ NoteLargeFontButton = 10904; // Not in NewNoteView, use FontCmd instead.
+ NoteDeleteButton = 10905;
+ NoteUpButton = 10906; // Not in NewNoteView, use scrollbars now.
+ NoteDownButton = 10907; // Not in NewNoteView, use scrollbars now.
+ NoteScrollBar = 10908;
+ NoteFontGroup = 1;
+ noteViewMaxLength = 4096; // not including null, tied to tFLD rsrc 10901
+
+// About Box - used by Datebook, Memo, Address, To Do, & others
+ aboutDialog = 11000;
+ aboutNameLabel = 11001;
+ aboutVersionLabel = 11002;
+ aboutErrorStr = 11003;
+
+// Category New Name Dialog (used for new and renamed categories)
+ categoryNewNameDialog = 11100;
+ categoryNewNameField = 11103;
+ categoryNewNameOKButton = 11104;
+
+// Categories Edit Dialog
+ CategoriesEditForm = 10000;
+ CategoriesEditList = 10002;
+ CategoriesEditOKButton = 10003;
+ CategoriesEditNewButton = 10004;
+ CategoriesEditRenameButton = 10005;
+ CategoriesEditDeleteButton = 10006;
+
+// Graffiti Reference Dialog
+ graffitiReferenceDialog = 11200;
+ graffitiReferenceDoneButton = 11202;
+ graffitiReferenceUpButton = 11203;
+ graffitiReferenceDownButton = 11204;
+ graffitiReferenceFirstBitmap = 11205;
+
+// System string resources
+ categoryAllStrID = 10004;
+ categoryEditStrID = 10005;
+ menuCommandStrID = 10006;
+ launcherBatteryStrID = 10007;
+ systemNameStrID = 10008;
+ phoneLookupTitleStrID = 10009;
+ phoneLookupAddStrID = 10010;
+ phoneLookupFormatStrID = 10011;
+
+//------------------------------------------------------------
+// Misc. resource routines
+//------------------------------------------------------------
+
+function ResLoadForm(rscID: UInt16): Pointer; syscall sysTrapResLoadForm;
+
+function ResLoadMenu(rscID: UInt16): Pointer; syscall sysTrapResLoadMenu;
+
+//!!!function ResLoadString(rscID: UInt16): PChar;
+
+function ResLoadConstant(rscID: UInt16): UInt32; syscall sysTrapResLoadConstant;
+
+implementation
+
+end.
diff --git a/packages/palmunits/src/vfsmgr.pp b/packages/palmunits/src/vfsmgr.pp
new file mode 100644
index 0000000000..cf1224a74b
--- /dev/null
+++ b/packages/palmunits/src/vfsmgr.pp
@@ -0,0 +1,814 @@
+{$MACRO ON}
+{$define Rsc := }
+(******************************************************************************
+ *
+ * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: VFSMgr.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * Description:
+ * Header file for VFS Manager.
+ *
+ * History:
+ * 02/25/00 jed Created by Jesse Donaldson.
+ *
+ *****************************************************************************)
+
+unit vfsmgr;
+
+interface
+
+uses palmos, coretraps, errorbase, datamgr, systemresources;
+
+const
+ sysTrapVFSMgr = sysTrapFileSystemDispatch;
+
+ vfsFtrIDVersion = 0; // ID of feature containing version of VFSMgr.
+ // Check existence of this feature to see if VFSMgr is installed.
+
+ vfsFtrIDDefaultFS = 1; // ID of feature containing the creator ID of the default filesystem library
+ // this is the default choice when choosing a library for formatting/mounting
+
+ vfsMgrVersionNum = UInt16(200); // version of the VFSMgr, obtained from the feature
+
+// MountClass constants:
+ vfsMountClass_SlotDriver = sysFileTSlotDriver;
+ vfsMountClass_Simulator = sysFileTSimulator;
+ vfsMountClass_POSE = Rsc('pose');
+
+// Base MountParamType; others such as SlotMountParamType are extensions of this base type,
+// switched on value of "mountClass" parameter. It will make more sense someday when there
+// are other kinds of FileSystems... (Trust us. :-)
+type
+ VFSAnyMountParamTag = record
+ volRefNum: UInt16; // The volRefNum of the volume.
+ reserved: UInt16;
+ mountClass: UInt32; // 'libs' for slotDriver-based filesystems
+
+ // Other fields here, depending on value of 'mountClass'
+ end;
+
+ VFSAnyMountParamType = VFSAnyMountParamTag;
+ VFSAnyMountParamPtr = ^VFSAnyMountParamType;
+
+ VFSSlotMountParamTag = record
+ vfsMountParam: VFSAnyMountParamType; // mountClass = VFSMountClass_SlotDriver = 'libs'
+ slotLibRefNum: UInt16;
+ slotRefNum: UInt16;
+ end;
+ VFSSlotMountParamType = VFSSlotMountParamTag;
+
+ VFSPOSEMountParamTag = record
+ vfsMountParam: VFSAnyMountParamType; // mountClass = VFSMountClass_POSE = 'pose'
+ poseSlotNum: UInt8;
+ end;
+ VFSPOSEMountParamType = VFSPOSEMountParamTag;
+
+(* For Example...
+ VFSOtherMountParamTag = record
+ vfsMountParam: VFSAnyMountParamType; // mountClass = 'othr' (for example)
+ otherValue: UInt16;
+ end;
+ VFSOtherMountParamType = VFSOtherMountParamTag;
+*)
+
+ FileInfoTag = record
+ attributes: UInt32;
+ nameP: PChar; // buffer to receive full name; pass NULL to avoid getting name
+ nameBufLen: UInt16; // size of nameP buffer, in bytes
+ end;
+ FileInfoType = FileInfoTag;
+ FileInfoPtr = ^FileInfoType;
+
+ VolumeInfoTag = record
+ attributes: UInt32; // read-only etc.
+ fsType: UInt32; // Filesystem type for this volume (defined below)
+ fsCreator: UInt32; // Creator code of filesystem driver for this volume. For use with VFSCustomControl().
+ mountClass: UInt32; // mount class that mounted this volume
+
+ // For slot based filesystems: (mountClass = vfsMountClass_SlotDriver)
+ slotLibRefNum: UInt16; // Library on which the volume is mounted
+ slotRefNum: UInt16; // ExpMgr slot number of card containing volume
+ mediaType: UInt32; // Type of card media (mediaMemoryStick, mediaCompactFlash, etc...)
+ reserved: UInt32; // reserved for future use (other mountclasses may need more space)
+ end;
+ VolumeInfoType = VolumeInfoTag;
+ VolumeInfoPtr = ^VolumeInfoType;
+
+type
+ FileRef = UInt32;
+
+const
+ vfsInvalidVolRef = 0; // constant for an invalid volume reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*.
+ vfsInvalidFileRef = 0; // constant for an invalid file reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*.
+
+(************************************************************
+ * File Origin constants: (for the origins of relative offsets passed to 'seek' type routines).
+ *************************************************************)
+
+const
+ vfsOriginBeginning = 0; // from the beginning (first data byte of file)
+ vfsOriginCurrent = 1; // from the current position
+ vfsOriginEnd = 2; // from the end of file (one position beyond last data byte, only negative offsets are legal)
+
+type
+ FileOrigin = UInt16;
+
+(************************************************************
+ * openMode flags passed to VFSFileOpen
+ *************************************************************)
+
+const
+ vfsModeExclusive = $0001; // don't let anyone else open it
+ vfsModeRead = $0002; // open for read access
+ vfsModeWrite = $0004 or vfsModeExclusive; // open for write access, implies exclusive
+ vfsModeCreate = $0008; // create the file if it doesn't already exist. Implemented in VFS layer, no FS lib call will ever have to handle this.
+ vfsModeTruncate = $0010; // Truncate file to 0 bytes after opening, removing all existing data. Implemented in VFS layer, no FS lib call will ever have to handle this.
+ vfsModeReadWrite = vfsModeWrite or vfsModeRead; // open for read/write access
+ vfsModeLeaveOpen = $0020; // Leave the file open even if when the foreground task closes
+
+ // Combination flag constants, for error checking purposes:
+ vfsModeAll = vfsModeExclusive or vfsModeRead or vfsModeWrite or vfsModeCreate or vfsModeTruncate or vfsModeReadWrite or vfsModeLeaveOpen;
+ vfsModeVFSLayerOnly = vfsModeCreate or vfsModeTruncate; // flags only used apps & the VFS layer, FS libraries will never see these.
+
+(************************************************************
+ * File Attributes
+ *************************************************************)
+
+ vfsFileAttrReadOnly = $00000001;
+ vfsFileAttrHidden = $00000002;
+ vfsFileAttrSystem = $00000004;
+ vfsFileAttrVolumeLabel = $00000008;
+ vfsFileAttrDirectory = $00000010;
+ vfsFileAttrArchive = $00000020;
+ vfsFileAttrLink = $00000040;
+
+ vfsFileAttrAll = $0000007f;
+
+(************************************************************
+ * Volume Attributes
+ *************************************************************)
+
+ vfsVolumeAttrSlotBased = $00000001; // reserved
+ vfsVolumeAttrReadOnly = $00000002; // volume is read only
+ vfsVolumeAttrHidden = $00000004; // volume should not be user-visible.
+
+(************************************************************
+ * Date constants (for use with VFSFileGet/SetDate)
+ *************************************************************)
+
+ vfsFileDateCreated = 1;
+ vfsFileDateModified = 2;
+ vfsFileDateAccessed = 3;
+
+(************************************************************
+ * Iterator start and stop constants.
+ * Used by VFSVolumeEnumerate, VFSDirEntryEnumerate, VFSDirEntryEnumerate
+ *************************************************************)
+
+ vfsIteratorStart = 0;
+ vfsIteratorStop = $ffffffff;
+
+(************************************************************
+ * 'handled' field bit constants
+ * (for use with Volume Mounted/Unmounted notifications)
+ *************************************************************)
+
+ vfsHandledUIAppSwitch = $01; // Any UI app switching has already been handled.
+ // The VFSMgr will not UIAppSwitch to the start.prc app
+ // (but it will loaded & sent the AutoStart launchcode),
+ // and the Launcher will not switch to itself.
+ vfsHandledStartPrc = $02; // And automatic running of start.prc has already been handled.
+ // VFSMgr will not load it, send it the AutoStart launchcode,
+ // or UIAppSwitch to it.
+
+(************************************************************
+ * Format/Mount flags (for use with VFSVolumeFormat/Mount)
+ *************************************************************)
+
+ vfsMountFlagsUseThisFileSystem = $01; // Mount/Format the volume with the filesystem specified
+// vfsMountFlagsPrivate1 = $02 // for system use only
+// vfsMountFlagsPrivate2 = $04 // for system use only
+ vfsMountFlagsReserved1 = $08; // reserved
+ vfsMountFlagsReserved2 = $10; // reserved
+ vfsMountFlagsReserved3 = $20; // reserved
+ vfsMountFlagsReserved4 = $40; // reserved
+ vfsMountFlagsReserved5 = $80; // reserved
+
+(************************************************************
+ * Common filesystem types. Used by FSFilesystemType and SlotCardIsFilesystemSupported.
+ *************************************************************)
+
+ vfsFilesystemType_VFAT = Rsc('vfat'); // FAT12 and FAT16 extended to handle long file names
+ vfsFilesystemType_FAT = Rsc('fats'); // FAT12 and FAT16 which only handles 8.3 file names
+ vfsFilesystemType_NTFS = Rsc('ntfs'); // Windows NT filesystem
+ vfsFilesystemType_HFSPlus = Rsc('hfse'); // The Macintosh extended hierarchical filesystem
+ vfsFilesystemType_HFS = Rsc('hfss'); // The Macintosh standard hierarchical filesystem
+ vfsFilesystemType_MFS = Rsc('mfso'); // The Macintosh original filesystem
+ vfsFilesystemType_EXT2 = Rsc('ext2'); // Linux filesystem
+ vfsFilesystemType_FFS = Rsc('ffsb'); // Unix Berkeley block based filesystem
+ vfsFilesystemType_NFS = Rsc('nfsu'); // Unix Networked filesystem
+ vfsFilesystemType_AFS = Rsc('afsu'); // Unix Andrew filesystem
+ vfsFilesystemType_Novell = Rsc('novl'); // Novell filesystem
+ vfsFilesystemType_HPFS = Rsc('hpfs'); // OS2 High Performance filesystem
+
+(************************************************************
+ * Error codes
+ *************************************************************)
+
+ vfsErrBufferOverflow = vfsErrorClass or 1; // passed in buffer is too small
+ vfsErrFileGeneric = vfsErrorClass or 2; // Generic file error.
+ vfsErrFileBadRef = vfsErrorClass or 3; // the fileref is invalid (has been closed, or was not obtained from VFSFileOpen())
+ vfsErrFileStillOpen = vfsErrorClass or 4; // returned from FSFileDelete if the file is still open
+ vfsErrFilePermissionDenied = vfsErrorClass or 5; // The file is read only
+ vfsErrFileAlreadyExists = vfsErrorClass or 6; // a file of this name exists already in this location
+ vfsErrFileEOF = vfsErrorClass or 7; // file pointer is at end of file
+ vfsErrFileNotFound = vfsErrorClass or 8; // file was not found at the path specified
+ vfsErrVolumeBadRef = vfsErrorClass or 9; // the volume refnum is invalid.
+ vfsErrVolumeStillMounted = vfsErrorClass or 10; // returned from FSVolumeFormat if the volume is still mounted
+ vfsErrNoFileSystem = vfsErrorClass or 11; // no installed filesystem supports this operation
+ vfsErrBadData = vfsErrorClass or 12; // operation could not be completed because of invalid data (i.e., import DB from .PRC file)
+ vfsErrDirNotEmpty = vfsErrorClass or 13; // can't delete a non-empty directory
+ vfsErrBadName = vfsErrorClass or 14; // invalid filename, or path, or volume label or something...
+ vfsErrVolumeFull = vfsErrorClass or 15; // not enough space left on volume
+ vfsErrUnimplemented = vfsErrorClass or 16; // this call is not implemented
+ vfsErrNotADirectory = vfsErrorClass or 17; // This operation requires a directory
+ vfsErrIsADirectory = vfsErrorClass or 18; // This operation requires a regular file, not a directory
+ vfsErrDirectoryNotFound = vfsErrorClass or 19; // Returned from VFSFileCreate when the path leading up to the new file does not exist
+ vfsErrNameShortened = vfsErrorClass or 20; // A volume name or filename was automatically shortened to conform to filesystem spec
+
+(************************************************************
+ * Selectors for routines found in the VFS manager. The order
+ * of these selectors MUST match the jump table in VFSMgr.c.
+ *************************************************************)
+
+ vfsTrapInit = 0;
+ vfsTrapCustomControl = 1;
+
+ vfsTrapFileCreate = 2;
+ vfsTrapFileOpen = 3;
+ vfsTrapFileClose = 4;
+ vfsTrapFileReadData = 5;
+ vfsTrapFileRead = 6;
+ vfsTrapFileWrite = 7;
+ vfsTrapFileDelete = 8;
+ vfsTrapFileRename = 9;
+ vfsTrapFileSeek = 10;
+ vfsTrapFileEOF = 11;
+ vfsTrapFileTell = 12;
+ vfsTrapFileResize = 13;
+ vfsTrapFileGetAttributes = 14;
+ vfsTrapFileSetAttributes = 15;
+ vfsTrapFileGetDate = 16;
+ vfsTrapFileSetDate = 17;
+ vfsTrapFileSize = 18;
+
+ vfsTrapDirCreate = 19;
+ vfsTrapDirEntryEnumerate = 20;
+ vfsTrapGetDefaultDirectory = 21;
+ vfsTrapRegisterDefaultDirectory = 22;
+ vfsTrapUnregisterDefaultDirectory = 23;
+
+ vfsTrapVolumeFormat = 24;
+ vfsTrapVolumeMount = 25;
+ vfsTrapVolumeUnmount = 26;
+ vfsTrapVolumeEnumerate = 27;
+ vfsTrapVolumeInfo = 28;
+ vfsTrapVolumeGetLabel = 29;
+ vfsTrapVolumeSetLabel = 30;
+ vfsTrapVolumeSize = 31;
+
+ vfsTrapInstallFSLib = 32;
+ vfsTrapRemoveFSLib = 33;
+ vfsTrapImportDatabaseFromFile = 34;
+ vfsTrapExportDatabaseToFile = 35;
+ vfsTrapFileDBGetResource = 36;
+ vfsTrapFileDBInfo = 37;
+ vfsTrapFileDBGetRecord = 38;
+
+ vfsTrapImportDatabaseFromFileCustom = 39;
+ vfsTrapExportDatabaseToFileCustom = 40;
+
+// System use only
+ vfsTrapPrivate1 = 41;
+
+ vfsMaxSelector = vfsTrapPrivate1;
+
+
+type
+ VFSImportProcPtr = function(totalBytes, offset: UInt32; userDataP: Pointer): Err;
+
+ VFSExportProcPtr = function(totalBytes, offset: UInt32; userDataP: Pointer): Err;
+
+function VFSInit: Err;
+
+// if you pass NULL for fsCreator, VFS will iterate through
+// all installed filesystems until it finds one that does not return an error.
+function VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
+ valueP: Pointer; var valueLenP: UInt16): Err;
+
+function VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err;
+
+function VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err;
+
+function VFSFileClose(fileRef: FileRef): Err;
+
+function VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
+ offset: UInt32; var numBytesReadP: UInt32): Err;
+
+function VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err;
+
+function VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err;
+
+// some file routines work on directories
+function VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err;
+
+function VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err;
+
+function VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err;
+
+function VFSFileEOF(fileRef: FileRef): Err;
+
+function VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err;
+
+function VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err;
+
+function VFSFileResize(fileRef: FileRef; newSize: UInt32): Err;
+
+function VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err;
+
+function VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err;
+
+function VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err;
+
+function VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err;
+
+
+function VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err;
+
+function VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err;
+
+
+function VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
+ pathStr: PChar; var bufLenP: UInt16): Err;
+
+function VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
+ const pathStr: PChar): Err;
+
+function VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err;
+
+
+function VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
+
+function VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
+
+function VFSVolumeUnmount(volRefNum: UInt16): Err;
+
+function VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err;
+
+function VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err;
+
+function VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err;
+
+function VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err;
+
+function VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err;
+
+function VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err;
+
+function VFSRemoveFSLib(fsLibRefNum: UInt16): Err;
+
+function VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID): Err;
+
+function VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID;
+ importProcP: VFSImportProcPtr; userDataP: Pointer): Err;
+
+function VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID): Err;
+
+function VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID;
+ exportProcP: VFSExportProcPtr; userDataP: Pointer): Err;
+
+function VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err;
+
+function VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
+ var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
+ var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
+ var numRecordsP: UInt16): Err;
+
+function VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
+ var recAttrP: UInt8; var uniqueIDP: UInt32): Err;
+
+implementation
+
+(**)
+function __VFSInit: Err; syscall sysTrapVFSMgr;
+function __VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
+ valueP: Pointer; var valueLenP: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err; syscall sysTrapVFSMgr;
+function __VFSFileClose(fileRef: FileRef): Err; syscall sysTrapVFSMgr;
+function __VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
+ offset: UInt32; var numBytesReadP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err; syscall sysTrapVFSMgr;
+// some file routines work on directories
+function __VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err; syscall sysTrapVFSMgr;
+function __VFSFileEOF(fileRef: FileRef): Err; syscall sysTrapVFSMgr;
+function __VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileResize(fileRef: FileRef; newSize: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err; syscall sysTrapVFSMgr;
+function __VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
+ pathStr: PChar; var bufLenP: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
+ const pathStr: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeUnmount(volRefNum: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err; syscall sysTrapVFSMgr;
+function __VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err; syscall sysTrapVFSMgr;
+function __VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSRemoveFSLib(fsLibRefNum: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID): Err; syscall sysTrapVFSMgr;
+function __VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID;
+ importProcP: VFSImportProcPtr; userDataP: Pointer): Err; syscall sysTrapVFSMgr;
+function __VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID): Err; syscall sysTrapVFSMgr;
+function __VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID;
+ exportProcP: VFSExportProcPtr; userDataP: Pointer): Err; syscall sysTrapVFSMgr;
+function __VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err; syscall sysTrapVFSMgr;
+function __VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
+ var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
+ var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
+ var numRecordsP: UInt16): Err; syscall sysTrapVFSMgr;
+function __VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
+ var recAttrP: UInt8; var uniqueIDP: UInt32): Err; syscall sysTrapVFSMgr;
+(**)
+
+function VFSInit: Err;
+begin
+ asm
+ move.l #$vfsTrapInit, D2;
+ end;
+ VFSInit := __VFSInit;
+end;
+
+function VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
+ valueP: Pointer; var valueLenP: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapCustomControl, D2;
+ end;
+ VFSCustomControl := __VFSCustomControl(fsCreator, apiCreator, apiSelector, valueP, valueLenP);
+end;
+
+function VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapFileCreate, D2;
+ end;
+ VFSFileCreate := __VFSFileCreate(volRefNum, pathNameP);
+end;
+
+function VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err;
+begin
+ asm
+ move.l #$vfsTrapFileOpen, D2;
+ end;
+ VFSFileOpen := __VFSFileOpen(volRefNum, pathNameP, openMode, fileRefP);
+end;
+
+function VFSFileClose(fileRef: FileRef): Err;
+begin
+ asm
+ move.l #$vfsTrapFileClose, D2;
+ end;
+ VFSFileClose := __VFSFileClose(fileRef);
+end;
+
+function VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
+ offset: UInt32; var numBytesReadP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileReadData, D2;
+ end;
+ VFSFileReadData := __VFSFileReadData(fileRef, numBytes, bufBaseP, offset, numBytesReadP);
+end;
+
+function VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileRead, D2;
+ end;
+ VFSFileRead := __VFSFileRead(fileRef, numBytes, bufP, numBytesReadP);
+end;
+
+function VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileWrite, D2;
+ end;
+ VFSFileWrite := __VFSFileWrite(fileRef, numBytes, dataP, numBytesWrittenP);
+end;
+
+function VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapFileDelete, D2;
+ end;
+ VFSFileDelete := __VFSFileDelete(volRefNum, pathNameP);
+end;
+
+function VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapFileRename, D2;
+ end;
+ VFSFileRename := __VFSFileRename(volRefNum, pathNameP, newNameP);
+end;
+
+function VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileSeek, D2;
+ end;
+ VFSFileSeek := __VFSFileSeek(fileRef, origin, offset);
+end;
+
+function VFSFileEOF(fileRef: FileRef): Err;
+begin
+ asm
+ move.l #$vfsTrapFileEOF, D2;
+ end;
+ VFSFileEOF := __VFSFileEOF(fileRef);
+end;
+
+function VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileTell, D2;
+ end;
+ VFSFileTell := __VFSFileTell(fileRef, filePosP);
+end;
+
+function VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileSize, D2;
+ end;
+ VFSFileSize := __VFSFileSize(fileRef, fileSizeP);
+end;
+
+function VFSFileResize(fileRef: FileRef; newSize: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileResize, D2;
+ end;
+ VFSFileResize := __VFSFileResize(fileRef, newSize);
+end;
+
+function VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileGetAttributes, D2;
+ end;
+ VFSFileGetAttributes := __VFSFileGetAttributes(fileRef, attributesP);
+end;
+
+function VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileSetAttributes, D2;
+ end;
+ VFSFileSetAttributes := __VFSFileSetAttributes(fileRef, attributes);
+end;
+
+function VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileGetDate, D2;
+ end;
+ VFSFileGetDate := __VFSFileGetDate(fileRef, whichDate, dateP);
+end;
+
+function VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileSetDate, D2;
+ end;
+ VFSFileSetDate := __VFSFileSetDate(fileRef, whichDate, date);
+end;
+
+function VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapDirCreate, D2;
+ end;
+ VFSDirCreate := __VFSDirCreate(volRefNum, dirNameP);
+end;
+
+function VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err;
+begin
+ asm
+ move.l #$vfsTrapDirEntryEnumerate, D2;
+ end;
+ VFSDirEntryEnumerate := __VFSDirEntryEnumerate(dirRef, dirEntryIteratorP, infoP);
+end;
+
+function VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
+ pathStr: PChar; var bufLenP: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapGetDefaultDirectory, D2;
+ end;
+ VFSGetDefaultDirectory := __VFSGetDefaultDirectory(volRefNum, fileTypeStr, pathStr, bufLenP);
+end;
+
+function VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
+ const pathStr: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapRegisterDefaultDirectory, D2;
+ end;
+ VFSRegisterDefaultDirectory := __VFSRegisterDefaultDirectory(fileTypeStr, mediaType, pathStr);
+end;
+
+function VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapUnregisterDefaultDirectory, D2;
+ end;
+ VFSUnregisterDefaultDirectory := __VFSUnregisterDefaultDirectory(fileTypeStr, mediaType);
+end;
+
+function VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeFormat, D2;
+ end;
+ VFSVolumeFormat := __VFSVolumeFormat(flags, fsLibRefNum, vfsMountParamP);
+end;
+
+function VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeMount, D2;
+ end;
+ VFSVolumeMount := __VFSVolumeMount(flags, fsLibRefNum, vfsMountParamP);
+end;
+
+function VFSVolumeUnmount(volRefNum: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeUnmount, D2;
+ end;
+ VFSVolumeUnmount := __VFSVolumeUnmount(volRefNum);
+end;
+
+function VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeEnumerate, D2;
+ end;
+ VFSVolumeEnumerate := __VFSVolumeEnumerate(volRefNumP, volIteratorP);
+end;
+
+function VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeInfo, D2;
+ end;
+ VFSVolumeInfo := __VFSVolumeInfo(volRefNum, volInfoP);
+end;
+
+function VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeGetLabel, D2;
+ end;
+ VFSVolumeGetLabel := __VFSVolumeGetLabel(volRefNum, labelP, bufLen);
+end;
+
+function VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeSetLabel, D2;
+ end;
+ VFSVolumeSetLabel := __VFSVolumeSetLabel(volRefNum, labelP);
+end;
+
+function VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapVolumeSize, D2;
+ end;
+ VFSVolumeSize := __VFSVolumeSize(volRefNum, volumeUsedP, volumeTotalP);
+end;
+
+function VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapInstallFSLib, D2;
+ end;
+ VFSInstallFSLib := __VFSInstallFSLib(creator, fsLibRefNumP);
+end;
+
+function VFSRemoveFSLib(fsLibRefNum: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapRemoveFSLib, D2;
+ end;
+ VFSRemoveFSLib := __VFSRemoveFSLib(fsLibRefNum);
+end;
+
+function VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID): Err;
+begin
+ asm
+ move.l #$vfsTrapImportDatabaseFromFile, D2;
+ end;
+ VFSImportDatabaseFromFile := __VFSImportDatabaseFromFile(volRefNum, pathNameP, cardNoP, dbIDP);
+end;
+
+function VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ var cardNoP: UInt16; var dbIDP: LocalID;
+ importProcP: VFSImportProcPtr; userDataP: Pointer): Err;
+begin
+ asm
+ move.l #$vfsTrapImportDatabaseFromFileCustom, D2;
+ end;
+ VFSImportDatabaseFromFileCustom := __VFSImportDatabaseFromFileCustom(volRefNum, pathNameP,
+ cardNoP, dbIDP, importProcP, userDataP);
+end;
+
+function VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID): Err;
+begin
+ asm
+ move.l #$vfsTrapExportDatabaseToFile, D2;
+ end;
+ VFSExportDatabaseToFile := __VFSExportDatabaseToFile(volRefNum, pathNameP, cardNo, dbID);
+end;
+
+function VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
+ cardNo: UInt16; dbID: LocalID;
+ exportProcP: VFSExportProcPtr; userDataP: Pointer): Err;
+begin
+ asm
+ move.l #$vfsTrapExportDatabaseToFileCustom, D2;
+ end;
+ VFSExportDatabaseToFileCustom := __VFSExportDatabaseToFileCustom(volRefNum, pathNameP,
+ cardNo, dbID, exportProcP, userDataP);
+end;
+
+function VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err;
+begin
+ asm
+ move.l #$vfsTrapFileDBGetResource, D2;
+ end;
+ VFSFileDBGetResource := __VFSFileDBGetResource(ref, type_, resID, resHP);
+end;
+
+function VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
+ var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
+ var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
+ var numRecordsP: UInt16): Err;
+begin
+ asm
+ move.l #$vfsTrapFileDBInfo, D2;
+ end;
+ VFSFileDBInfo := __VFSFileDBInfo(ref, nameP, attributesP, versionP, crDateP, modDateP,
+ bckUpDateP, modNumP, appInfoHP, sortInfoHP, typeP, creatorP, numRecordsP);
+end;
+
+function VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
+ var recAttrP: UInt8; var uniqueIDP: UInt32): Err;
+begin
+ asm
+ move.l #$vfsTrapFileDBGetRecord, D2;
+ end;
+ VFSFileDBGetRecord := __VFSFileDBGetRecord(ref, recIndex, recHP, recAttrP, uniqueIDP);
+end;
+
+end.
diff --git a/packages/palmunits/src/window.pp b/packages/palmunits/src/window.pp
new file mode 100644
index 0000000000..4dff43c43c
--- /dev/null
+++ b/packages/palmunits/src/window.pp
@@ -0,0 +1,524 @@
+(******************************************************************************
+ *
+ * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
+ * All rights reserved.
+ *
+ * File: Window.h
+ *
+ * Release: Palm OS SDK 4.0 (63220)
+ *
+ * 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.
+ *
+ *****************************************************************************)
+{$MACRO ON}
+unit window;
+
+interface
+
+uses palmos, coretraps, rect, errorbase, bitmap;
+
+const
+ kWinVersion = 3;
+
+// enum for WinScrollRectangle
+type
+ WinDirectionType = Enum;
+
+const
+ winUp = 0;
+ winDown = Succ(winUp);
+ winLeft = Succ(winDown);
+ winRight = Succ(winLeft);
+
+// enum for WinCreateOffscreenWindow
+type
+ WindowFormatType = Enum;
+
+const
+ screenFormat = 0;
+ genericFormat = Succ(screenFormat);
+
+// enum for WinLockScreen
+type
+ WinLockInitType = Enum;
+
+const
+ winLockCopy = 0;
+ winLockErase = Succ(winLockCopy);
+ winLockDontCare = Succ(winLockErase);
+
+// operations for the WinScreenMode function
+type
+ WinScreenModeOperation = Enum;
+
+const
+ winScreenModeGetDefaults = 0;
+ winScreenModeGet = Succ(winScreenModeGetDefaults);
+ winScreenModeSetToDefaults = Succ(winScreenModeGet);
+ winScreenModeSet = Succ(winScreenModeSetToDefaults);
+ winScreenModeGetSupportedDepths = Succ(winScreenModeSet);
+ winScreenModeGetSupportsColor = Succ(winScreenModeGetSupportedDepths);
+
+// Operations for the WinPalette function
+const
+ winPaletteGet = 0;
+ winPaletteSet = 1;
+ winPaletteSetToDefault = 2;
+ winPaletteInit = 3; // for internal use only
+
+// transfer modes for color drawing
+type
+ WinDrawOperation = Enum;
+
+const
+ winPaint = 0;
+ winErase = Succ(winPaint);
+ winMask = Succ(winErase);
+ winInvert = Succ(winMask);
+ winOverlay = Succ(winInvert);
+ winPaintInverse = Succ(winOverlay);
+ winSwap = Succ(winPaintInverse);
+
+type
+ PatternType = Enum;
+
+const
+ blackPattern = 0;
+ whitePattern = Succ(blackPattern);
+ grayPattern = Succ(whitePattern);
+ customPattern = Succ(grayPattern);
+
+const
+ noPattern = blackPattern;
+ grayHLinePattern = $AA;
+ grayHLinePatternOdd = $55;
+
+// grayUnderline means dotted current foreground color
+// solidUnderline means solid current foreground color
+// colorUnderline redundant, use solidUnderline instead
+type
+ UnderlineModeType = Enum;
+
+const
+ noUnderline = 0;
+ grayUnderline = Succ(noUnderline);
+ solidUnderline = Succ(grayUnderline);
+ colorUnderline = Succ(solidUnderline);
+
+const
+ WinMaxSupportedDepth = 8;
+ WinNumSupportedColors = 4;
+
+type
+ IndexedColorType = UInt8; // 1-, 2-, 4-, or 8-bit index
+ CustomPatternType = array [0..7] of UInt8; // 8x8 1-bit deep pattern
+ CustomPatternPtr = ^CustomPatternType;
+
+// for WinPalette startIndex value, respect indexes in passed table
+const
+ WinUseTableIndexes = -1;
+
+//-----------------------------------------------
+// Draw state structures.
+//-----------------------------------------------
+
+type
+ DrawStateType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
+ transferMode: WinDrawOperation;
+ pattern: PatternType;
+ underlineMode: UnderlineModeType;
+ fontId: FontID;
+ font: FontPtr;
+ patternData: CustomPatternType;
+
+ // These are only valid for indexed color bitmaps
+
+ foreColor: IndexedColorType;
+ backColor: IndexedColorType;
+ textColor: IndexedColorType;
+ reserved: UInt8;
+
+ // These are only valid for direct color bitmaps
+ foreColorRGB: RGBColorType;
+ backColorRGB: RGBColorType;
+ textColorRGB: RGBColorType;
+ {$endif}
+ end;
+
+const
+ DrawStateStackSize = 5; // enough for a control in a field in a window
+
+//-----------------------------------------------
+// The Window Structures.
+//-----------------------------------------------
+
+type
+ FrameBitsType = record
+ case Integer of
+ 1: (bits: UInt16);
+{
+ (
+ 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;
+}
+ 2: (word: UInt16); // IMPORTANT: INITIALIZE word to zero before setting bits!
+ end;
+
+ FrameType = UInt16;
+
+// Standard Frame Types
+const
+ noFrame = 0;
+ simpleFrame = 1;
+ rectangleFrame = 1;
+ simple3DFrame = $0012; // 3d, frame = 2
+ roundFrame = $0401; // corner = 7, frame = 1
+ boldRoundFrame = $0702; // corner = 7, frame = 2
+ popupFrame = $0205; // corner = 2, frame = 1, shadow = 1
+ dialogFrame = $0302; // corner = 3, frame = 2
+ menuFrame = popupFrame;
+
+ winDefaultDepthFlag = $FF;
+
+type
+ WindowFlagsType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
+ Bits: UInt16;
+{
+ 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;
+}
+ {$endif}
+ end;
+
+ WindowType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
+ displayWidthV20: Coord; // use WinGetDisplayExtent instead
+ displayHeightV20: Coord; // use WinGetDisplayExtent instead
+ displayAddrV20: Pointer; // use the drawing functions instead
+ windowFlags: WindowFlagsType;
+ windowBounds: RectangleType;
+ clippingBounds: AbsRectType;
+ bitmapP: BitmapPtr;
+ frameType: FrameBitsType;
+ drawStateP: ^DrawStateType; // was GraphicStatePtr
+ nextWindow: ^WindowType;
+ {$endif}
+ end;
+
+ WinPtr = ^WindowType;
+ WinHandle = ^WindowType;
+
+//-----------------------------------------------
+// More graphics shapes
+//-----------------------------------------------
+
+ WinLineType = record
+ x1: Coord;
+ y1: Coord;
+ x2: Coord;
+ y2: Coord;
+ end;
+ WinLinePtr = ^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
+
+ GraphicStateType = record
+ {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
+ drawStateP: ^DrawStateType;
+ drawStateStackP: ^DrawStateType;
+ drawStateIndex: Int16;
+ unused: UInt16; //was screenLockCount
+ {$endif}
+ end;
+
+// ----------------------
+// Window manager errors
+// ----------------------
+
+const
+ winErrPalette = winErrorClass or 1;
+
+//-----------------------------------------------
+// Macros
+//-----------------------------------------------
+
+// For now, the window handle is a pointer to a window structure,
+// this however may change, so use the following macros.
+
+function WinGetWindowPointer(winHandle: WinHandle): WinPtr;
+
+function WinGetWindowHandle(winPtr: WinPtr): WinHandle;
+
+//-----------------------------------------------
+// Routines relating to windows management
+//-----------------------------------------------
+
+function WinValidateHandle(winHandle: WinHandle): Boolean; syscall sysTrapWinValidateHandle;
+
+function WinCreateWindow({const} var bounds: RectangleType; frame: FrameType; modal, focusable: Boolean;
+ var error: UInt16): WinHandle; syscall sysTrapWinCreateWindow;
+
+function WinCreateOffscreenWindow(width, height: Coord; format: WindowFormatType; var error: UInt16): WinHandle; syscall sysTrapWinCreateOffscreenWindow;
+
+function WinCreateBitmapWindow(bitmapP: BitmapPtr; var error: UInt16): WinHandle; syscall sysTrapWinCreateBitmapWindow;
+
+procedure WinDeleteWindow(winHandle: WinHandle; eraseIt: Boolean); syscall sysTrapWinDeleteWindow;
+
+procedure WinInitializeWindow(winHandle: WinHandle); syscall sysTrapWinInitializeWindow;
+
+procedure WinAddWindow(winHandle: WinHandle); syscall sysTrapWinAddWindow;
+
+procedure WinRemoveWindow(winHandle: WinHandle); syscall sysTrapWinRemoveWindow;
+
+procedure WinMoveWindowAddr(oldLocationP, newLocationP: WinPtr); syscall sysTrapWinMoveWindowAddr;
+
+procedure WinSetActiveWindow(winHandle: WinHandle); syscall sysTrapWinSetActiveWindow;
+
+function WinSetDrawWindow(winHandle: WinHandle): WinHandle; syscall sysTrapWinSetDrawWindow;
+
+function WinGetDrawWindow: WinHandle; syscall sysTrapWinGetDrawWindow;
+
+function WinGetActiveWindow: WinHandle; syscall sysTrapWinGetActiveWindow;
+
+function WinGetDisplayWindow: WinHandle; syscall sysTrapWinGetDisplayWindow;
+
+function WinGetFirstWindow: WinHandle; syscall sysTrapWinGetFirstWindow;
+
+procedure WinEnableWindow(winHandle: WinHandle); syscall sysTrapWinEnableWindow;
+
+procedure WinDisableWindow(winHandle: WinHandle); syscall sysTrapWinDisableWindow;
+
+procedure WinGetWindowFrameRect(winHandle: WinHandle; var r: RectangleType); syscall sysTrapWinGetWindowFrameRect;
+
+procedure WinDrawWindowFrame; syscall sysTrapWinDrawWindowFrame;
+
+procedure WinEraseWindow; syscall sysTrapWinEraseWindow;
+
+function WinSaveBits({const} var source: RectangleType; var error: UInt16): WinHandle; syscall sysTrapWinSaveBits;
+
+procedure WinRestoreBits(winHandle: WinHandle; destX, destY: Coord); syscall sysTrapWinRestoreBits;
+
+procedure WinCopyRectangle(srcWin, dstWin: WinHandle; {const} var srcRect: RectangleType;
+ destX, destY: Coord; mode: WinDrawOperation); syscall sysTrapWinCopyRectangle;
+
+procedure WinScrollRectangle({const} var rP: RectangleType; direction: WinDirectionType;
+ distance: Coord; var vacatedP: RectangleType); syscall sysTrapWinScrollRectangle;
+
+procedure WinGetDisplayExtent(var extentX, extentY: Coord); syscall sysTrapWinGetDisplayExtent;
+
+procedure WinGetDrawWindowBounds(var rP: RectangleType); syscall sysTrapWinGetDrawWindowBounds;
+
+procedure WinGetBounds(winH: WinHandle; var rP: RectangleType); syscall sysTrapWinGetBounds;
+
+procedure WinSetBounds(winHandle: WinHandle; {const} var rP: RectangleType); syscall sysTrapWinSetBounds;
+
+{$ifdef ALLOW_OLD_API_NAMES}
+procedure WinGetWindowBounds(var rP: RectangleType); syscall sysTrapWinGetWindowBounds;
+
+procedure WinSetWindowBounds(winHandle: WinHandle; {const} var rP: RectangleType); syscall WinSetWindowBounds;
+{$endif}
+
+procedure WinGetWindowExtent(var extentX, extentY: Coord); syscall sysTrapWinGetWindowExtent;
+
+procedure WinDisplayToWindowPt(var extentX, extentY: Coord); syscall sysTrapWinDisplayToWindowPt;
+
+procedure WinWindowToDisplayPt(var extentX, extentY: Coord); syscall sysTrapWinWindowToDisplayPt;
+
+function WinGetBitmap(winHandle: WinHandle): BitmapPtr; syscall sysTrapWinGetBitmap;
+
+procedure WinGetClip(var rP: RectangleType); syscall sysTrapWinGetClip;
+
+procedure WinSetClip({const} var rP: RectangleType); syscall sysTrapWinSetClip;
+
+procedure WinResetClip; syscall sysTrapWinResetClip;
+
+procedure WinClipRectangle(var rP: RectangleType); syscall sysTrapWinClipRectangle;
+
+function WinModal(winHandle: WinHandle): Boolean; syscall sysTrapWinModal;
+
+//-----------------------------------------------
+// Routines to draw shapes or frames shapes
+//-----------------------------------------------
+
+// Pixel(s)
+function WinGetPixel(x, y: Coord): IndexedColorType; syscall sysTrapWinGetPixel;
+
+procedure WinPaintPixel(x, y: Coord); syscall sysTrapWinPaintPixel; // uses drawing mode
+
+function WinGetPixelRGB (x, y: Coord; var rgbP: RGBColorType): Err; syscall sysTrapWinGetPixelRGB; // Direct color version
+
+procedure WinDrawPixel(x, y: Coord); syscall sysTrapWinDrawPixel;
+
+procedure WinErasePixel(x, y: Coord); syscall sysTrapWinErasePixel;
+
+procedure WinInvertPixel(x, y: Coord); syscall sysTrapWinInvertPixel;
+
+procedure WinPaintPixels(numPoints: UInt16; pts: PointPtr); syscall sysTrapWinPaintPixels;
+
+// Line(s)
+procedure WinPaintLines(numLines: UInt16; lines: WinLinePtr); syscall sysTrapWinPaintLines;
+
+procedure WinPaintLine(x1, y1, x2, y2: Coord); syscall sysTrapWinPaintLine;
+
+procedure WinDrawLine(x1, y1, x2, y2: Coord); syscall sysTrapWinDrawLine;
+
+procedure WinDrawGrayLine(x1, y1, x2, y2: Coord); syscall sysTrapWinDrawGrayLine;
+
+procedure WinEraseLine(x1, y1, x2, y2: Coord); syscall sysTrapWinEraseLine;
+
+procedure WinInvertLine(x1, y1, x2, y2: Coord); syscall sysTrapWinInvertLine;
+
+procedure WinFillLine(x1, y1, x2, y2: Coord); syscall sysTrapWinFillLine;
+
+// Rectangle
+procedure WinPaintRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinPaintRectangle;
+
+procedure WinDrawRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinDrawRectangle;
+
+procedure WinEraseRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinEraseRectangle;
+
+procedure WinInvertRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinInvertRectangle;
+
+procedure WinFillRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinFillRectangle;
+
+// Rectangle frames
+procedure WinPaintRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinPaintRectangleFrame;
+
+procedure WinDrawRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinDrawRectangleFrame;
+
+procedure WinDrawGrayRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinDrawGrayRectangleFrame;
+
+procedure WinEraseRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinEraseRectangleFrame;
+
+procedure WinInvertRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinInvertRectangleFrame;
+
+procedure WinGetFramesRectangle(frame: FrameType; {const} var rP, obscuredRect: RectangleType); syscall sysTrapWinGetFramesRectangle;
+
+// Bitmap
+procedure WinDrawBitmap(bitmapP: BitmapPtr; x, y: Coord); syscall sysTrapWinDrawBitmap;
+
+procedure WinPaintBitmap(bitmapP: BitmapPtr; x, y: Coord); syscall sysTrapWinPaintBitmap;
+
+// Characters
+procedure WinDrawChar(theChar: WChar; x, y: Coord); syscall sysTrapWinDrawChar;
+
+procedure WinDrawChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinDrawChars;
+
+procedure WinPaintChar(theChar: WChar; x, y: Coord); syscall sysTrapWinPaintChar;
+
+procedure WinPaintChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinPaintChars;
+
+procedure WinDrawInvertedChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinDrawInvertedChars;
+
+procedure WinDrawTruncChars(const chars: PChar; len: Int16; x, y, maxWidth: Coord); syscall sysTrapWinDrawTruncChars;
+
+procedure WinEraseChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinEraseChars;
+
+procedure WinInvertChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinInvertChars;
+
+function WinSetUnderlineMode(mode: UnderlineModeType): UnderlineModeType; syscall sysTrapWinSetUnderlineMode;
+
+//-----------------------------------------------
+// Routines for patterns and colors
+//-----------------------------------------------
+
+procedure WinPushDrawState; syscall sysTrapWinPushDrawState; // "save" fore, back, text color, pattern, underline mode, font
+
+procedure WinPopDrawState; syscall sysTrapWinPopDrawState; // "restore" saved drawing variables
+
+function WinSetDrawMode(newMode: WinDrawOperation): WinDrawOperation; syscall sysTrapWinSetDrawMode;
+
+function WinSetForeColor(foreColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetForeColor;
+
+function WinSetBackColor(backColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetBackColor;
+
+function WinSetTextColor(textColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetTextColor;
+
+// Direct color versions
+procedure WinSetForeColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetForeColorRGB;
+
+procedure WinSetBackColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetBackColorRGB;
+
+procedure WinSetTextColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetTextColorRGB;
+
+procedure WinGetPattern(patternP: CustomPatternPtr); syscall sysTrapWinGetPattern;
+
+function WinGetPatternType: PatternType; syscall sysTrapWinGetPatternType;
+
+procedure WinSetPattern(const patternP: CustomPatternPtr); syscall sysTrapWinSetPattern;
+
+procedure WinSetPatternType(newPattern: PatternType); syscall sysTrapWinSetPatternType;
+
+function WinPalette(operation: UInt8; startIndex: Int16; paletteEntries: UInt16; tableP: RGBColorPtr): Err; syscall sysTrapWinPalette;
+
+function WinRGBToIndex(const rgbP: RGBColorPtr): IndexedColorType; syscall sysTrapWinRGBToIndex;
+
+procedure WinIndexToRGB(i: IndexedColorType; rgbP: RGBColorPtr); syscall sysTrapWinIndexToRGB;
+
+// "obsolete" color call, supported for backwards compatibility
+
+procedure WinSetColors(const newForeColorP: RGBColorPtr; oldForeColorP: RGBColorPtr;
+ const newBackColorP: RGBColorPtr; oldBackColorP: RGBColorPtr); syscall sysTrapWinSetColors;
+
+
+//-----------------------------------------------
+// WinScreen functions
+//-----------------------------------------------
+
+procedure WinScreenInit; syscall sysTrapWinScreenInit;
+
+function WinScreenMode(operation: WinScreenModeOperation; var widthP, heightP, depthP: UInt32;
+ var enableColorP: Boolean): Err; syscall sysTrapWinScreenMode;
+
+//-----------------------------------------------
+// Screen tracking (double buffering) support
+//-----------------------------------------------
+
+function WinScreenLock(initMode: WinLockInitType): UInt8Ptr; syscall sysTrapWinScreenLock;
+
+procedure WinScreenUnlock; syscall sysTrapWinScreenUnlock;
+
+implementation
+
+function WinGetWindowPointer(winHandle: WinHandle): WinPtr;
+begin
+ WinGetWindowPointer := winHandle;
+end;
+
+function WinGetWindowHandle(winPtr: WinPtr): WinHandle;
+begin
+ WinGetWindowHandle := winPtr
+end;
+
+end.